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