summaryrefslogtreecommitdiff
path: root/examples/cred.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cred.c')
-rw-r--r--examples/cred.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/cred.c b/examples/cred.c
index 3e0a30f..6bd0faf 100644
--- a/examples/cred.c
+++ b/examples/cred.c
@@ -16,14 +16,9 @@
16#include <unistd.h> 16#include <unistd.h>
17#endif 17#endif
18 18
19#include "../openbsd-compat/openbsd-compat.h"
20
21#include "fido.h" 19#include "fido.h"
22#include "extern.h" 20#include "extern.h"
23 21#include "../openbsd-compat/openbsd-compat.h"
24#ifdef SIGNAL_EXAMPLE
25extern volatile sig_atomic_t got_signal;
26#endif
27 22
28static const unsigned char cdh[32] = { 23static const unsigned char cdh[32] = {
29 0xf9, 0x64, 0x57, 0xe7, 0x2d, 0x97, 0xf6, 0xbb, 24 0xf9, 0x64, 0x57, 0xe7, 0x2d, 0x97, 0xf6, 0xbb,
@@ -192,13 +187,15 @@ main(int argc, char **argv)
192 break; 187 break;
193 case 'T': 188 case 'T':
194#ifndef SIGNAL_EXAMPLE 189#ifndef SIGNAL_EXAMPLE
190 (void)seconds;
195 errx(1, "-T not supported"); 191 errx(1, "-T not supported");
196#endif 192#else
197 if (base10(optarg, &seconds) < 0) 193 if (base10(optarg, &seconds) < 0)
198 errx(1, "base10: %s", optarg); 194 errx(1, "base10: %s", optarg);
199 if (seconds <= 0 || seconds > 30) 195 if (seconds <= 0 || seconds > 30)
200 errx(1, "-T: %s must be in (0,30]", optarg); 196 errx(1, "-T: %s must be in (0,30]", optarg);
201 break; 197 break;
198#endif
202 case 'e': 199 case 'e':
203 if (read_blob(optarg, &body, &len) < 0) 200 if (read_blob(optarg, &body, &len) < 0)
204 errx(1, "read_blob: %s", optarg); 201 errx(1, "read_blob: %s", optarg);
@@ -318,6 +315,10 @@ main(int argc, char **argv)
318 315
319 fido_dev_free(&dev); 316 fido_dev_free(&dev);
320 317
318 /* when verifying, pin implies uv */
319 if (pin)
320 uv = true;
321
321 verify_cred(type, fido_cred_fmt(cred), fido_cred_authdata_ptr(cred), 322 verify_cred(type, fido_cred_fmt(cred), fido_cred_authdata_ptr(cred),
322 fido_cred_authdata_len(cred), fido_cred_x5c_ptr(cred), 323 fido_cred_authdata_len(cred), fido_cred_x5c_ptr(cred),
323 fido_cred_x5c_len(cred), fido_cred_sig_ptr(cred), 324 fido_cred_x5c_len(cred), fido_cred_sig_ptr(cred),