Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status sub command #91

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

EvilBit
Copy link
Contributor

@EvilBit EvilBit commented Jul 21, 2021

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).

Signed-off-by: Oskar Kohout <oskar@evilbit.at>
Signed-off-by: Oskar Kohout <oskar@evilbit.at>
Signed-off-by: Oskar Kohout <oskar@evilbit.at>
Signed-off-by: Oskar Kohout <oskar@evilbit.at>
Signed-off-by: Oskar Kohout <oskar@evilbit.at>
Signed-off-by: Oskar Kohout <oskar@evilbit.at>
@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

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

❗ 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%) ⬇️
src/libtpm2-totp.c 83.24% <66.66%> (-2.51%) ⬇️

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.

Copy link
Member

@diabonas diabonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool 🎉 Please rebase to include 83d823c ("fix: semi-colon required after switch case") into 253d8ee (" feat: implement status sub-command") to make future bisects easier, otherwise LGTM.

@EvilBit EvilBit force-pushed the status_sub-command branch 2 times, most recently from 7f4f4bd to 979ba11 Compare July 23, 2021 22:29
@EvilBit
Copy link
Contributor Author

EvilBit commented Jul 23, 2021

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.

Comment on lines +101 to +102
**tpm2-totp -P** *-* **init**
\> *verysecret***\<CTRL-D\>**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

I'd prefer to use a backslash, followed directly like a line break instead of the trailing whitespace to be able to keep the whitespace checker without modification, otherwise LGTM!

**tpm2-totp -P** *-* **init**\
\> *verysecret***\<CTRL-D\>**

Comment on lines +104 to +105
\# or (recommended)
**gpg --decrypt** */path/to/password.gpg* **|** **tpm2-totp** **-P** *-* **init**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Comment on lines +107 to +108
\# or (discouraged)
**tpm2-totp -P** *verysecret* **init**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants