xref: /freebsd/contrib/libfido2/tools/extern.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
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  * 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	0x01
27 #define FLAG_QUIET	0x02
28 #define FLAG_RK		0x04
29 #define FLAG_UV		0x08
30 #define FLAG_U2F	0x10
31 #define FLAG_HMAC	0x20
32 #define FLAG_UP		0x40
33 #define FLAG_LARGEBLOB	0x80
34 
35 #define PINBUF_LEN	256
36 
37 EC_KEY *read_ec_pubkey(const char *);
38 fido_dev_t *open_dev(const char *);
39 FILE *open_read(const char *);
40 FILE *open_write(const char *);
41 char *get_pin(const char *);
42 const char *plural(size_t);
43 const char *cose_string(int);
44 const char *prot_string(int);
45 int assert_get(int, char **);
46 int assert_verify(int, char **);
47 int base64_decode(const char *, void **, size_t *);
48 int base64_encode(const void *, size_t, char **);
49 int base64_read(FILE *, struct blob *);
50 int bio_delete(const char *, const char *);
51 int bio_enroll(const char *);
52 void bio_info(fido_dev_t *);
53 int bio_list(const char *);
54 int bio_set_name(const char *, const char *, const char *);
55 int blob_clean(const char *);
56 int blob_list(const char *);
57 int blob_delete(const char *, const char *, const char *, const char *);
58 int blob_get(const char *, const char *, const char *, const char *,
59     const char *);
60 int blob_set(const char *, const char *, const char *, const char *,
61     const char *);
62 int config_always_uv(char *, int);
63 int config_entattest(char *);
64 int config_force_pin_change(char *);
65 int config_pin_minlen(char *, const char *);
66 int config_pin_minlen_rpid(char *, const char *);
67 int cose_type(const char *, int *);
68 int cred_make(int, char **);
69 int cred_verify(int, char **);
70 int credman_delete_rk(const char *, const char *);
71 int credman_update_rk(const char *, const char *, const char *, const char *,
72     const char *);
73 int credman_get_metadata(fido_dev_t *, const char *);
74 int credman_list_rk(const char *, const char *);
75 int credman_list_rp(const char *);
76 int credman_print_rk(fido_dev_t *, const char *, const char *, const char *);
77 int get_devopt(fido_dev_t *, const char *, int *);
78 int pin_change(char *);
79 int pin_set(char *);
80 int should_retry_with_pin(const fido_dev_t *, int);
81 int string_read(FILE *, char **);
82 int token_config(int, char **, char *);
83 int token_delete(int, char **, char *);
84 int token_get(int, char **, char *);
85 int token_info(int, char **, char *);
86 int token_list(int, char **, char *);
87 int token_reset(char *);
88 int token_set(int, char **, char *);
89 int write_es256_pubkey(FILE *, const void *, size_t);
90 int write_es384_pubkey(FILE *, const void *, size_t);
91 int write_rsa_pubkey(FILE *, const void *, size_t);
92 int read_file(const char *, u_char **, size_t *);
93 int write_file(const char *, const u_char *, size_t);
94 RSA *read_rsa_pubkey(const char *);
95 EVP_PKEY *read_eddsa_pubkey(const char *);
96 int write_eddsa_pubkey(FILE *, const void *, size_t);
97 void print_cred(FILE *, int, const fido_cred_t *);
98 void usage(void);
99 void xxd(const void *, size_t);
100 int base10(const char *);
101 
102 #endif /* _EXTERN_H_ */
103