summaryrefslogtreecommitdiff
path: root/src/fido/bio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fido/bio.h')
-rw-r--r--src/fido/bio.h95
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
17struct fido_bio_template {
18 fido_blob_t id;
19 char *name;
20};
21
22struct 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
28struct fido_bio_enroll {
29 uint8_t remaining_samples;
30 uint8_t last_status;
31 fido_blob_t *token;
32};
33
34struct fido_bio_info {
35 uint8_t type;
36 uint8_t max_samples;
37};
38#endif
39
40typedef struct fido_bio_template fido_bio_template_t;
41typedef struct fido_bio_template_array fido_bio_template_array_t;
42typedef struct fido_bio_enroll fido_bio_enroll_t;
43typedef 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
61const char *fido_bio_template_name(const fido_bio_template_t *);
62const fido_bio_template_t *fido_bio_template(const fido_bio_template_array_t *,
63 size_t);
64const unsigned char *fido_bio_template_id_ptr(const fido_bio_template_t *);
65fido_bio_enroll_t *fido_bio_enroll_new(void);
66fido_bio_info_t *fido_bio_info_new(void);
67fido_bio_template_array_t *fido_bio_template_array_new(void);
68fido_bio_template_t *fido_bio_template_new(void);
69int fido_bio_dev_enroll_begin(fido_dev_t *, fido_bio_template_t *,
70 fido_bio_enroll_t *, uint32_t, const char *);
71int fido_bio_dev_enroll_cancel(fido_dev_t *);
72int fido_bio_dev_enroll_continue(fido_dev_t *, const fido_bio_template_t *,
73 fido_bio_enroll_t *, uint32_t);
74int fido_bio_dev_enroll_remove(fido_dev_t *, const fido_bio_template_t *,
75 const char *);
76int fido_bio_dev_get_info(fido_dev_t *, fido_bio_info_t *);
77int fido_bio_dev_get_template_array(fido_dev_t *, fido_bio_template_array_t *,
78 const char *);
79int fido_bio_dev_set_template_name(fido_dev_t *, const fido_bio_template_t *,
80 const char *);
81int fido_bio_template_set_id(fido_bio_template_t *, const unsigned char *,
82 size_t);
83int fido_bio_template_set_name(fido_bio_template_t *, const char *);
84size_t fido_bio_template_array_count(const fido_bio_template_array_t *);
85size_t fido_bio_template_id_len(const fido_bio_template_t *);
86uint8_t fido_bio_enroll_last_status(const fido_bio_enroll_t *);
87uint8_t fido_bio_enroll_remaining_samples(const fido_bio_enroll_t *);
88uint8_t fido_bio_info_max_samples(const fido_bio_info_t *);
89uint8_t fido_bio_info_type(const fido_bio_info_t *);
90void fido_bio_enroll_free(fido_bio_enroll_t **);
91void fido_bio_info_free(fido_bio_info_t **);
92void fido_bio_template_array_free(fido_bio_template_array_t **);
93void fido_bio_template_free(fido_bio_template_t **);
94
95#endif /* !_FIDO_BIO_H */