diff options
Diffstat (limited to 'examples/assert.c')
-rw-r--r-- | examples/assert.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/assert.c b/examples/assert.c index a421a51..a18d8af 100644 --- a/examples/assert.c +++ b/examples/assert.c | |||
@@ -14,17 +14,12 @@ | |||
14 | #include <unistd.h> | 14 | #include <unistd.h> |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #include "../openbsd-compat/openbsd-compat.h" | ||
18 | |||
19 | #include "fido.h" | 17 | #include "fido.h" |
20 | #include "fido/es256.h" | 18 | #include "fido/es256.h" |
21 | #include "fido/rs256.h" | 19 | #include "fido/rs256.h" |
22 | #include "fido/eddsa.h" | 20 | #include "fido/eddsa.h" |
23 | #include "extern.h" | 21 | #include "extern.h" |
24 | 22 | #include "../openbsd-compat/openbsd-compat.h" | |
25 | #ifdef SIGNAL_EXAMPLE | ||
26 | extern volatile sig_atomic_t got_signal; | ||
27 | #endif | ||
28 | 23 | ||
29 | static const unsigned char cdh[32] = { | 24 | static const unsigned char cdh[32] = { |
30 | 0xec, 0x8d, 0x8f, 0x78, 0x42, 0x4a, 0x2b, 0xb7, | 25 | 0xec, 0x8d, 0x8f, 0x78, 0x42, 0x4a, 0x2b, 0xb7, |
@@ -188,13 +183,15 @@ main(int argc, char **argv) | |||
188 | break; | 183 | break; |
189 | case 'T': | 184 | case 'T': |
190 | #ifndef SIGNAL_EXAMPLE | 185 | #ifndef SIGNAL_EXAMPLE |
186 | (void)seconds; | ||
191 | errx(1, "-T not supported"); | 187 | errx(1, "-T not supported"); |
192 | #endif | 188 | #else |
193 | if (base10(optarg, &seconds) < 0) | 189 | if (base10(optarg, &seconds) < 0) |
194 | errx(1, "base10: %s", optarg); | 190 | errx(1, "base10: %s", optarg); |
195 | if (seconds <= 0 || seconds > 30) | 191 | if (seconds <= 0 || seconds > 30) |
196 | errx(1, "-T: %s must be in (0,30]", optarg); | 192 | errx(1, "-T: %s must be in (0,30]", optarg); |
197 | break; | 193 | break; |
194 | #endif | ||
198 | case 'a': | 195 | case 'a': |
199 | if (read_blob(optarg, &body, &len) < 0) | 196 | if (read_blob(optarg, &body, &len) < 0) |
200 | errx(1, "read_blob: %s", optarg); | 197 | errx(1, "read_blob: %s", optarg); |
@@ -312,6 +309,10 @@ main(int argc, char **argv) | |||
312 | errx(1, "fido_assert_count: %d signatures returned", | 309 | errx(1, "fido_assert_count: %d signatures returned", |
313 | (int)fido_assert_count(assert)); | 310 | (int)fido_assert_count(assert)); |
314 | 311 | ||
312 | /* when verifying, pin implies uv */ | ||
313 | if (pin) | ||
314 | uv = true; | ||
315 | |||
315 | verify_assert(type, fido_assert_authdata_ptr(assert, 0), | 316 | verify_assert(type, fido_assert_authdata_ptr(assert, 0), |
316 | fido_assert_authdata_len(assert, 0), fido_assert_sig_ptr(assert, 0), | 317 | fido_assert_authdata_len(assert, 0), fido_assert_sig_ptr(assert, 0), |
317 | fido_assert_sig_len(assert, 0), up, uv, ext, argv[0]); | 318 | fido_assert_sig_len(assert, 0), up, uv, ext, argv[0]); |