diff options
Diffstat (limited to 'src/fido/credman.h')
-rw-r--r-- | src/fido/credman.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/fido/credman.h b/src/fido/credman.h new file mode 100644 index 0000000..1c7cafe --- /dev/null +++ b/src/fido/credman.h | |||
@@ -0,0 +1,74 @@ | |||
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_CREDMAN_H | ||
8 | #define _FIDO_CREDMAN_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_credman_metadata { | ||
18 | uint64_t rk_existing; | ||
19 | uint64_t rk_remaining; | ||
20 | }; | ||
21 | |||
22 | struct fido_credman_single_rp { | ||
23 | fido_rp_t rp_entity; | ||
24 | fido_blob_t rp_id_hash; | ||
25 | }; | ||
26 | |||
27 | struct fido_credman_rp { | ||
28 | struct fido_credman_single_rp *ptr; | ||
29 | size_t n_alloc; /* number of allocated entries */ | ||
30 | size_t n_rx; /* number of populated entries */ | ||
31 | }; | ||
32 | |||
33 | struct fido_credman_rk { | ||
34 | fido_cred_t *ptr; | ||
35 | size_t n_alloc; /* number of allocated entries */ | ||
36 | size_t n_rx; /* number of populated entries */ | ||
37 | }; | ||
38 | #endif | ||
39 | |||
40 | typedef struct fido_credman_metadata fido_credman_metadata_t; | ||
41 | typedef struct fido_credman_rk fido_credman_rk_t; | ||
42 | typedef struct fido_credman_rp fido_credman_rp_t; | ||
43 | |||
44 | const char *fido_credman_rp_id(const fido_credman_rp_t *, size_t); | ||
45 | const char *fido_credman_rp_name(const fido_credman_rp_t *, size_t); | ||
46 | |||
47 | const fido_cred_t *fido_credman_rk(const fido_credman_rk_t *, size_t); | ||
48 | const unsigned char *fido_credman_rp_id_hash_ptr(const fido_credman_rp_t *, | ||
49 | size_t); | ||
50 | |||
51 | fido_credman_metadata_t *fido_credman_metadata_new(void); | ||
52 | fido_credman_rk_t *fido_credman_rk_new(void); | ||
53 | fido_credman_rp_t *fido_credman_rp_new(void); | ||
54 | |||
55 | int fido_credman_del_dev_rk(fido_dev_t *, const unsigned char *, size_t, | ||
56 | const char *); | ||
57 | int fido_credman_get_dev_metadata(fido_dev_t *, fido_credman_metadata_t *, | ||
58 | const char *); | ||
59 | int fido_credman_get_dev_rk(fido_dev_t *, const char *, fido_credman_rk_t *, | ||
60 | const char *); | ||
61 | int fido_credman_get_dev_rp(fido_dev_t *, fido_credman_rp_t *, const char *); | ||
62 | |||
63 | size_t fido_credman_rk_count(const fido_credman_rk_t *); | ||
64 | size_t fido_credman_rp_count(const fido_credman_rp_t *); | ||
65 | size_t fido_credman_rp_id_hash_len(const fido_credman_rp_t *, size_t); | ||
66 | |||
67 | uint64_t fido_credman_rk_existing(const fido_credman_metadata_t *); | ||
68 | uint64_t fido_credman_rk_remaining(const fido_credman_metadata_t *); | ||
69 | |||
70 | void fido_credman_metadata_free(fido_credman_metadata_t **); | ||
71 | void fido_credman_rk_free(fido_credman_rk_t **); | ||
72 | void fido_credman_rp_free(fido_credman_rp_t **); | ||
73 | |||
74 | #endif /* !_FIDO_CREDMAN_H */ | ||