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
163 stars 36 forks source link

Make TCTI configurable and force the tests to use the simulator #18

Closed diabonas closed 5 years ago

diabonas commented 5 years ago

This PR makes allows configuring the TCTI to be used with

The syntax and the implementation for the command option/environment variable follow the implementations in tpm2-tools (https://github.com/tpm2-software/tpm2-tools/pull/765, tpm2_options.c and tpm2_tcti_ldr.c) and tpm2-tss-engine (https://github.com/tpm2-software/tpm2-tss-engine/pull/62, tpm2-tss-engine-tcti.c).

Using these configuration options, we can force the tests to use the TPM simulator, enabling the possibility to run the tests (in parallel) on systems with existing hardware TPMs. The implementation is adapted from tpm2-tss-engine (https://github.com/tpm2-software/tpm2-tss-engine/pull/107, sh_log_compiler.sh).

Closes #7.

codecov[bot] commented 5 years ago

Codecov Report

Merging #18 into master will decrease coverage by 3.8%. The diff coverage is 65.8%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
- Coverage   84.34%   80.53%   -3.81%     
==========================================
  Files           3        4       +1     
  Lines         658      745      +87     
==========================================
+ Hits          555      600      +45     
- Misses        103      145      +42
Impacted Files Coverage Δ
src/libtpm2-totp.c 84.66% <100%> (ø) :arrow_up:
src/tpm2-totp-tcti.c 52.23% <52.23%> (ø)
src/tpm2-totp.c 81.06% <68.18%> (-1.59%) :arrow_down:
test/libtpm2-totp.c 81.25% <79.41%> (-8.23%) :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 8dba9e8...bde2981. Read the comment docs.

diabonas commented 5 years ago

Awesome, tss2-tctildr will indeed make things much easier :+1: