diff options
Diffstat (limited to 'src/fido/bio.h')
-rw-r--r-- | src/fido/bio.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/fido/bio.h b/src/fido/bio.h new file mode 100644 index 0000000..31dffe4 --- /dev/null +++ b/src/fido/bio.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2019 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 _FIDO_BIO_H | ||
8 | #define _FIDO_BIO_H | ||
9 | |||
10 | #include <stdint.h> | ||
11 | #include <stdlib.h> | ||
12 | |||
13 | #include "fido/err.h" | ||
14 | #include "fido/param.h" | ||
15 | |||
16 | #ifdef _FIDO_INTERNAL | ||
17 | struct fido_bio_template { | ||
18 | fido_blob_t id; | ||
19 | char *name; | ||
20 | }; | ||
21 | |||
22 | struct fido_bio_template_array { | ||
23 | struct fido_bio_template *ptr; | ||
24 | size_t n_alloc; /* number of allocated entries */ | ||
25 | size_t n_rx; /* number of populated entries */ | ||
26 | }; | ||
27 | |||
28 | struct fido_bio_enroll { | ||
29 | uint8_t remaining_samples; | ||
30 | uint8_t last_status; | ||
31 | fido_blob_t *token; | ||
32 | }; | ||
33 | |||
34 | struct fido_bio_info { | ||
35 | uint8_t type; | ||
36 | uint8_t max_samples; | ||
37 | }; | ||
38 | #endif | ||
39 | |||
40 | typedef struct fido_bio_template fido_bio_template_t; | ||
41 | typedef struct fido_bio_template_array fido_bio_template_array_t; | ||
42 | typedef struct fido_bio_enroll fido_bio_enroll_t; | ||
43 | typedef struct fido_bio_info fido_bio_info_t; | ||
44 | |||
45 | #define FIDO_BIO_ENROLL_FP_GOOD 0x00 | ||
46 | #define FIDO_BIO_ENROLL_FP_TOO_HIGH 0x01 | ||
47 | #define FIDO_BIO_ENROLL_FP_TOO_LOW 0x02 | ||
48 | #define FIDO_BIO_ENROLL_FP_TOO_LEFT 0x03 | ||
49 | #define FIDO_BIO_ENROLL_FP_TOO_RIGHT 0x04 | ||
50 | #define FIDO_BIO_ENROLL_FP_TOO_FAST 0x05 | ||
51 | #define FIDO_BIO_ENROLL_FP_TOO_SLOW 0x06 | ||
52 | #define FIDO_BIO_ENROLL_FP_POOR_QUALITY 0x07 | ||
53 | #define FIDO_BIO_ENROLL_FP_TOO_SKEWED 0x08 | ||
54 | #define FIDO_BIO_ENROLL_FP_TOO_SHORT 0x09 | ||
55 | #define FIDO_BIO_ENROLL_FP_MERGE_FAILURE 0x0a | ||
56 | #define FIDO_BIO_ENROLL_FP_EXISTS 0x0b | ||
57 | #define FIDO_BIO_ENROLL_FP_DATABASE_FULL 0x0c | ||
58 | #define FIDO_BIO_ENROLL_NO_USER_ACTIVITY 0x0d | ||
59 | #define FIDO_BIO_ENROLL_NO_USER_PRESENCE_TRANSITION 0x0e | ||
60 | |||
61 | const char *fido_bio_template_name(const fido_bio_template_t *); | ||
62 | const fido_bio_template_t *fido_bio_template(const fido_bio_template_array_t *, | ||
63 | size_t); | ||
64 | const unsigned char *fido_bio_template_id_ptr(const fido_bio_template_t *); | ||
65 | fido_bio_enroll_t *fido_bio_enroll_new(void); | ||
66 | fido_bio_info_t *fido_bio_info_new(void); | ||
67 | fido_bio_template_array_t *fido_bio_template_array_new(void); | ||
68 | fido_bio_template_t *fido_bio_template_new(void); | ||
69 | int fido_bio_dev_enroll_begin(fido_dev_t *, fido_bio_template_t *, | ||
70 | fido_bio_enroll_t *, uint32_t, const char *); | ||
71 | int fido_bio_dev_enroll_cancel(fido_dev_t *); | ||
72 | int fido_bio_dev_enroll_continue(fido_dev_t *, const fido_bio_template_t *, | ||
73 | fido_bio_enroll_t *, uint32_t); | ||
74 | int fido_bio_dev_enroll_remove(fido_dev_t *, const fido_bio_template_t *, | ||
75 | const char *); | ||
76 | int fido_bio_dev_get_info(fido_dev_t *, fido_bio_info_t *); | ||
77 | int fido_bio_dev_get_template_array(fido_dev_t *, fido_bio_template_array_t *, | ||
78 | const char *); | ||
79 | int fido_bio_dev_set_template_name(fido_dev_t *, const fido_bio_template_t *, | ||
80 | const char *); | ||
81 | int fido_bio_template_set_id(fido_bio_template_t *, const unsigned char *, | ||
82 | size_t); | ||
83 | int fido_bio_template_set_name(fido_bio_template_t *, const char *); | ||
84 | size_t fido_bio_template_array_count(const fido_bio_template_array_t *); | ||
85 | size_t fido_bio_template_id_len(const fido_bio_template_t *); | ||
86 | uint8_t fido_bio_enroll_last_status(const fido_bio_enroll_t *); | ||
87 | uint8_t fido_bio_enroll_remaining_samples(const fido_bio_enroll_t *); | ||
88 | uint8_t fido_bio_info_max_samples(const fido_bio_info_t *); | ||
89 | uint8_t fido_bio_info_type(const fido_bio_info_t *); | ||
90 | void fido_bio_enroll_free(fido_bio_enroll_t **); | ||
91 | void fido_bio_info_free(fido_bio_info_t **); | ||
92 | void fido_bio_template_array_free(fido_bio_template_array_t **); | ||
93 | void fido_bio_template_free(fido_bio_template_t **); | ||
94 | |||
95 | #endif /* !_FIDO_BIO_H */ | ||