mirror of
https://git.sr.ht/~nabijaczleweli/tzpfms
synced 2025-04-13 09:37:13 +03:00
swtpm is in Debian now :)
This commit is contained in:
parent
02195933bc
commit
b811862e0a
@ -74,7 +74,7 @@ See the [repository README](//debian.nabijaczleweli.xyz/README) for more informa
|
||||
### Testing
|
||||
#### TPM2
|
||||
|
||||
Build [`swtpm`](//github.com/stefanberger/swtpm), then prepare and run it:
|
||||
Install [`swtpm`](//github.com/stefanberger/swtpm), then prepare and run it:
|
||||
```sh
|
||||
swtpm_setup --tpmstate tpm2-state --tpm2 --createek --display --logfile /dev/tty --overwrite
|
||||
swtpm socket --server type=tcp,port=2321 --ctrl type=tcp,port=2322 --tpm2 --tpmstate dir=tpm2-state --flags not-need-init --log level=10
|
||||
@ -86,7 +86,7 @@ ln -s /usr/lib/i386-linux-gnu/libtss2-tcti-{swtpm,default}.so
|
||||
```
|
||||
#### TPM1.x
|
||||
|
||||
Build [`swtpm`](//github.com/stefanberger/swtpm), then prepare and run it and
|
||||
Install [`swtpm`](//github.com/stefanberger/swtpm), then prepare and run it and
|
||||
([hopefully](//github.com/stefanberger/swtpm/issues/5#issuecomment-210607890)) [TrouSerS](//sourceforge.net/projects/trousers), as `root`/`tpm`:
|
||||
```sh
|
||||
swtpm_setup --tpmstate tpm1x-state --createek --display --logfile /dev/tty --overwrite
|
||||
|
@ -158,8 +158,8 @@ static int get_key_material_raw(const char * whom, bool again, bool newkey, uint
|
||||
|
||||
caught_interrupt = 0;
|
||||
act.sa_handler = [](auto sig) {
|
||||
caught_interrupt = sig;
|
||||
fputs("^C\n", stderr);
|
||||
caught_interrupt = sig;
|
||||
fputs("^C\n", stderr);
|
||||
};
|
||||
sigaction(SIGINT, &act, &osigint);
|
||||
|
||||
@ -197,7 +197,9 @@ static int get_key_material_raw(const char * whom, bool again, bool newkey, uint
|
||||
// Read the key material
|
||||
size_t buflen{};
|
||||
errno = 0;
|
||||
printf("pretline buf=%s (%p); bl=%d\n", buf, (void *)buf, (int)buflen);
|
||||
auto bytes = getline((char **)&buf, &buflen, stdin);
|
||||
printf("\ngetline returned: %d; errnp=%d; buf=%s (%p); bl=%d\n\n", (int)bytes, errno, buf, (void *)buf, (int)buflen);
|
||||
switch(bytes) {
|
||||
case -1:
|
||||
if(errno != 0)
|
||||
@ -256,6 +258,7 @@ int read_new_passphrase(const char * whom, uint8_t *& buf, size_t & len_out, siz
|
||||
TRY_MAIN(get_key_material_dispatch(whom, false, true, first_passphrase, first_passphrase_len));
|
||||
quickscope_wrapper first_passphrase_deleter{[&] { free(first_passphrase); }};
|
||||
|
||||
printf("fp=%s; fps=%zu\n", first_passphrase, first_passphrase_len);
|
||||
if(first_passphrase_len != 0 && first_passphrase_len < MIN_PASSPHRASE_LEN)
|
||||
return fprintf(stderr, "Passphrase too short (min %u)\n", MIN_PASSPHRASE_LEN), __LINE__;
|
||||
if(first_passphrase_len > max_len)
|
||||
@ -269,6 +272,7 @@ int read_new_passphrase(const char * whom, uint8_t *& buf, size_t & len_out, siz
|
||||
if(second_passphrase_len != first_passphrase_len || memcmp(first_passphrase, second_passphrase, first_passphrase_len))
|
||||
return fprintf(stderr, "Provided keys do not match.\n"), __LINE__;
|
||||
|
||||
printf("sp=%s; sps=%zu\n", second_passphrase, second_passphrase_len);
|
||||
if(second_passphrase_len) {
|
||||
buf = second_passphrase;
|
||||
second_passphrase = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user