xref: /freebsd/contrib/libfido2/tools/extern.h (revision 60a517b66a69b8c011b04063ef63a938738719bd)
1 /*
2  * Copyright (c) 2018-2023 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  * SPDX-License-Identifier: BSD-2-Clause
6  */
7 
8 #ifndef _EXTERN_H_
9 #define _EXTERN_H_
10 
11 #include <sys/types.h>
12 
13 #include <openssl/ec.h>
14 
15 #include <fido.h>
16 #include <stddef.h>
17 #include <stdio.h>
18 
19 struct blob {
20 	unsigned char *ptr;
21 	size_t len;
22 };
23 
24 #define TOKEN_OPT	"CDGILPRSVabcdefi:k:l:m:n:p:ru"
25 
26 #define FLAG_DEBUG	0x001
27 #define FLAG_QUIET	0x002
28 #define FLAG_RK		0x004
29 #define FLAG_UV		0x008
30 #define FLAG_U2F	0x010
31 #define FLAG_HMAC	0x020
32 #define FLAG_UP		0x040
33 #define FLAG_LARGEBLOB	0x080
34 #define FLAG_CD		0x100
35 
36 #define PINBUF_LEN	256
37 
38 EC_KEY *read_ec_pubkey(const char *);
39 fido_dev_t *open_dev(const char *);
40 FILE *open_read(const char *);
41 FILE *open_write(const char *);
42 char *get_pin(const char *);
43 const char *plural(size_t);
44 const char *cose_string(int);
45 const char *prot_string(int);
46 int assert_get(int, char **);
47 int assert_verify(int, char **);
48 int base64_decode(const char *, void **, size_t *);
49 int base64_encode(const void *, size_t, char **);
50 int base64_read(FILE *, struct blob *);
51 int bio_delete(const char *, const char *);
52 int bio_enroll(const char *);
53 void bio_info(fido_dev_t *);
54 int bio_list(const char *);
55 int bio_set_name(const char *, const char *, const char *);
56 int blob_clean(const char *);
57 int blob_list(const char *);
58 int blob_delete(const char *, const char *, const char *, const char *);
59 int blob_get(const char *, const char *, const char *, const char *,
60     const char *);
61 int blob_set(const char *, const char *, const char *, const char *,
62     const char *);
63 int config_always_uv(char *, int);
64 int config_entattest(char *);
65 int config_force_pin_change(char *);
66 int config_pin_minlen(char *, const char *);
67 int config_pin_minlen_rpid(char *, const char *);
68 int cose_type(const char *, int *);
69 int cred_make(int, char **);
70 int cred_verify(int, char **);
71 int credman_delete_rk(const char *, const char *);
72 int credman_update_rk(const char *, const char *, const char *, const char *,
73     const char *);
74 int credman_get_metadata(fido_dev_t *, const char *);
75 int credman_list_rk(const char *, const char *);
76 int credman_list_rp(const char *);
77 int credman_print_rk(fido_dev_t *, const char *, const char *, const char *);
78 int get_devopt(fido_dev_t *, const char *, int *);
79 int pin_change(char *);
80 int pin_set(char *);
81 int should_retry_with_pin(const fido_dev_t *, int);
82 int string_read(FILE *, char **);
83 int token_config(int, char **, char *);
84 int token_delete(int, char **, char *);
85 int token_get(int, char **, char *);
86 int token_info(int, char **, char *);
87 int token_list(int, char **, char *);
88 int token_reset(char *);
89 int token_set(int, char **, char *);
90 int write_es256_pubkey(FILE *, const void *, size_t);
91 int write_es384_pubkey(FILE *, const void *, size_t);
92 int write_rsa_pubkey(FILE *, const void *, size_t);
93 int read_file(const char *, u_char **, size_t *);
94 int write_file(const char *, const u_char *, size_t);
95 RSA *read_rsa_pubkey(const char *);
96 EVP_PKEY *read_eddsa_pubkey(const char *);
97 int write_eddsa_pubkey(FILE *, const void *, size_t);
98 void print_cred(FILE *, int, const fido_cred_t *);
99 void usage(void);
100 void xxd(const void *, size_t);
101 int base10(const char *);
102 
103 #endif /* _EXTERN_H_ */
104