tpm2-software / tpm2-totp

Attest the trustworthiness of a device against a human using time-based one-time passwords
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
159 stars 35 forks source link

tpm2-totp: display more specific messages for common error cases #70

Closed diabonas closed 3 years ago

diabonas commented 3 years ago

I thought I had submitted this ages ago, but apparently I didn't... Add some custom error messages for frequent problems like trying to call tpm2-totp calculate twice, being unable to calculate the TOTP after a change in PCRs etc. If none of the custom error messages are applicable, fall back to the messages from tss2-rc instead of displaying a raw response code.

Closes: #61

codecov[bot] commented 3 years ago

Codecov Report

Merging #70 into master will increase coverage by 0.35%. The diff coverage is 30.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
+ Coverage   84.05%   84.41%   +0.35%     
==========================================
  Files           4        4              
  Lines         759      757       -2     
==========================================
+ Hits          638      639       +1     
+ Misses        121      118       -3     
Impacted Files Coverage Δ
src/libtpm2-totp.c 86.65% <0.00%> (+1.98%) :arrow_up:
src/tpm2-totp.c 81.90% <36.36%> (-2.46%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a93ddcc...ff9559e. Read the comment docs.