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
164 stars 37 forks source link

Status sub command #91

Open EvilBit opened 3 years ago

EvilBit commented 3 years ago

implements #85

Generates valid YAML as output, so can easily be processed with e.g. yq while still remaining reasonably appealing for human consumption. Tip: try piping into bat -l yaml -pp for CLI syntax highlighting.

Example: tpm2-totp status:

NVRAM index:    0x018094AF                                                     
                # default NVRAM index
enrolled:       true
resealable:     true
NVRAM data:
  # INFO: PCRs and PCR banks stored in NVRAM are not integrity
  #       protected and susceptible to undetected modification.
  #       Do not rely on their authenticity (e.g. for resealing).
  PCRs:         [0,2,4]
                # default PCRs
  PCR banks:    [SHA1,SHA256]
                # default PCR banks
---
defaults:
  NVRAM index:  0x018094AF
  PCRs:         [0,2,4]
  PCR banks:    [SHA1,SHA256]

Some keyBlob handling code has been refactored to reduce repetition. Also, man page formatting is much nicer now (fixed wrong formatting for pandoc to man).

codecov[bot] commented 3 years ago

Codecov Report

Merging #91 (83d823c) into master (49a81b9) will decrease coverage by 6.20%. The diff coverage is 37.39%.

:exclamation: Current head 83d823c differs from pull request most recent head 979ba11. Consider uploading reports for the commit 979ba11 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
- Coverage   81.75%   75.54%   -6.21%     
==========================================
  Files           4        4              
  Lines         822      822              
==========================================
- Hits          672      621      -51     
- Misses        150      201      +51     
Impacted Files Coverage Δ
src/tpm2-totp.c 63.90% <5.45%> (-12.68%) :arrow_down:
src/libtpm2-totp.c 83.24% <66.66%> (-2.51%) :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 49a81b9...979ba11. Read the comment docs.

EvilBit commented 3 years ago

The whitespace checker fail is anticipated - the two trailing whitespaces are necessary to coerce pandoc into rendering sensible man pages. <br> doesn't cut it here.