xref: /netbsd-src/external/bsd/libfido2/dist/tools/extern.h (revision e5d758f832e07a177fa24707c434b7ce26d0f762)
1 /*
2  * Copyright (c) 2018 Yubico AB. All rights reserved.
3  * Use of this source code is governed by a BSD-style
4  * license that can be found in the LICENSE file.
5  */
6 
7 #ifndef _EXTERN_H_
8 #define _EXTERN_H_
9 
10 #include <stddef.h>
11 #include <stdio.h>
12 
13 #include <openssl/ec.h>
14 #include <fido.h>
15 
16 struct blob {
17 	unsigned char *ptr;
18 	size_t len;
19 };
20 
21 #define TOKEN_OPT	"CDILPRSVbcdei:k:n:r"
22 
23 #define FLAG_DEBUG	0x01
24 #define FLAG_QUIET	0x02
25 #define FLAG_RK		0x04
26 #define FLAG_UV		0x08
27 #define FLAG_U2F	0x10
28 #define FLAG_HMAC	0x20
29 #define FLAG_UP		0x40
30 
31 EC_KEY *read_ec_pubkey(const char *);
32 fido_dev_t *open_dev(const char *);
33 FILE *open_read(const char *);
34 FILE *open_write(const char *);
35 const char *cose_string(int);
36 const char *prot_string(int);
37 int assert_get(int, char **);
38 int assert_verify(int, char **);
39 int base64_decode(const char *, void **, size_t *);
40 int base64_encode(const void *, size_t, char **);
41 int base64_read(FILE *, struct blob *);
42 int bio_delete(fido_dev_t *, char *, char *);
43 int bio_enroll(char *);
44 void bio_info(fido_dev_t *);
45 int bio_list(char *);
46 int bio_set_name(char *, char *, char *);
47 int cose_type(const char *, int *);
48 int cred_make(int, char **);
49 int cred_verify(int, char **);
50 int credman_delete_rk(fido_dev_t *, const char *, char *);
51 int credman_get_metadata(fido_dev_t *, const char *);
52 int credman_list_rk(char *, const char *);
53 int credman_list_rp(char *);
54 int credman_print_rk(fido_dev_t *, const char *, char *, char *);
55 int pin_change(char *);
56 int pin_set(char *);
57 int string_read(FILE *, char **);
58 int token_delete(int, char **, char *);
59 int token_info(int, char **, char *);
60 int token_list(int, char **, char *);
61 int token_reset(char *);
62 int token_set(int, char **, char *);
63 int write_ec_pubkey(FILE *, const void *, size_t);
64 int write_rsa_pubkey(FILE *, const void *, size_t);
65 RSA *read_rsa_pubkey(const char *);
66 EVP_PKEY *read_eddsa_pubkey(const char *);
67 int write_eddsa_pubkey(FILE *, const void *, size_t);
68 void print_cred(FILE *, int, const fido_cred_t *);
69 void read_pin(const char *, char *, size_t);
70 void usage(void);
71 void xxd(const void *, size_t);
72 int base10(const char *);
73 
74 #endif /* _EXTERN_H_ */
75