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 typedef struct fido_blob { 14 unsigned char *ptr; 15 size_t len; 16 } fido_blob_t; 17 18 typedef struct fido_blob_array { 19 fido_blob_t *ptr; 20 size_t len; 21 } fido_blob_array_t; 22 23 cbor_item_t *fido_blob_encode(const fido_blob_t *); 24 fido_blob_t *fido_blob_new(void); 25 int fido_blob_decode(const cbor_item_t *, fido_blob_t *); 26 int fido_blob_is_empty(const fido_blob_t *); 27 int fido_blob_set(fido_blob_t *, const unsigned char *, size_t); 28 void fido_blob_free(fido_blob_t **); 29 void fido_free_blob_array(fido_blob_array_t *); 30 31 #endif /* !_BLOB_H */ 32