summaryrefslogtreecommitdiff
path: root/src/fido/credman.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/fido/credman.h')
-rw-r--r--src/fido/credman.h74
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
17struct fido_credman_metadata {
18 uint64_t rk_existing;
19 uint64_t rk_remaining;
20};
21
22struct fido_credman_single_rp {
23 fido_rp_t rp_entity;
24 fido_blob_t rp_id_hash;
25};
26
27struct 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
33struct 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
40typedef struct fido_credman_metadata fido_credman_metadata_t;
41typedef struct fido_credman_rk fido_credman_rk_t;
42typedef struct fido_credman_rp fido_credman_rp_t;
43
44const char *fido_credman_rp_id(const fido_credman_rp_t *, size_t);
45const char *fido_credman_rp_name(const fido_credman_rp_t *, size_t);
46
47const fido_cred_t *fido_credman_rk(const fido_credman_rk_t *, size_t);
48const unsigned char *fido_credman_rp_id_hash_ptr(const fido_credman_rp_t *,
49 size_t);
50
51fido_credman_metadata_t *fido_credman_metadata_new(void);
52fido_credman_rk_t *fido_credman_rk_new(void);
53fido_credman_rp_t *fido_credman_rp_new(void);
54
55int fido_credman_del_dev_rk(fido_dev_t *, const unsigned char *, size_t,
56 const char *);
57int fido_credman_get_dev_metadata(fido_dev_t *, fido_credman_metadata_t *,
58 const char *);
59int fido_credman_get_dev_rk(fido_dev_t *, const char *, fido_credman_rk_t *,
60 const char *);
61int fido_credman_get_dev_rp(fido_dev_t *, fido_credman_rp_t *, const char *);
62
63size_t fido_credman_rk_count(const fido_credman_rk_t *);
64size_t fido_credman_rp_count(const fido_credman_rp_t *);
65size_t fido_credman_rp_id_hash_len(const fido_credman_rp_t *, size_t);
66
67uint64_t fido_credman_rk_existing(const fido_credman_metadata_t *);
68uint64_t fido_credman_rk_remaining(const fido_credman_metadata_t *);
69
70void fido_credman_metadata_free(fido_credman_metadata_t **);
71void fido_credman_rk_free(fido_credman_rk_t **);
72void fido_credman_rp_free(fido_credman_rp_t **);
73
74#endif /* !_FIDO_CREDMAN_H */