]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libfido2/src/blob.h
MFV 66082b6c88b9: libbsdxml (expat) 2.4.9
[FreeBSD/FreeBSD.git] / contrib / libfido2 / src / blob.h
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 _BLOB_H
8 #define _BLOB_H
9
10 #include <cbor.h>
11 #include <stdlib.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif /* __cplusplus */
16
17 typedef struct fido_blob {
18         unsigned char   *ptr;
19         size_t           len;
20 } fido_blob_t;
21
22 typedef struct fido_blob_array {
23         fido_blob_t     *ptr;
24         size_t           len;
25 } fido_blob_array_t;
26
27 cbor_item_t *fido_blob_encode(const fido_blob_t *);
28 fido_blob_t *fido_blob_new(void);
29 int fido_blob_decode(const cbor_item_t *, fido_blob_t *);
30 int fido_blob_is_empty(const fido_blob_t *);
31 int fido_blob_set(fido_blob_t *, const u_char *, size_t);
32 int fido_blob_append(fido_blob_t *, const u_char *, size_t);
33 void fido_blob_free(fido_blob_t **);
34 void fido_blob_reset(fido_blob_t *);
35 void fido_free_blob_array(fido_blob_array_t *);
36
37 #ifdef __cplusplus
38 } /* extern "C" */
39 #endif /* __cplusplus */
40
41 #endif /* !_BLOB_H */