10afa8e06SEd Maste /* 20afa8e06SEd Maste * Copyright (c) 2018 Yubico AB. All rights reserved. 30afa8e06SEd Maste * Use of this source code is governed by a BSD-style 40afa8e06SEd Maste * license that can be found in the LICENSE file. 5*2ccfa855SEd Maste * SPDX-License-Identifier: BSD-2-Clause 60afa8e06SEd Maste */ 70afa8e06SEd Maste 80afa8e06SEd Maste #ifndef _BLOB_H 90afa8e06SEd Maste #define _BLOB_H 100afa8e06SEd Maste 110afa8e06SEd Maste #include <cbor.h> 120afa8e06SEd Maste #include <stdlib.h> 130afa8e06SEd Maste 140afa8e06SEd Maste #ifdef __cplusplus 150afa8e06SEd Maste extern "C" { 160afa8e06SEd Maste #endif /* __cplusplus */ 170afa8e06SEd Maste 180afa8e06SEd Maste typedef struct fido_blob { 190afa8e06SEd Maste unsigned char *ptr; 200afa8e06SEd Maste size_t len; 210afa8e06SEd Maste } fido_blob_t; 220afa8e06SEd Maste 230afa8e06SEd Maste typedef struct fido_blob_array { 240afa8e06SEd Maste fido_blob_t *ptr; 250afa8e06SEd Maste size_t len; 260afa8e06SEd Maste } fido_blob_array_t; 270afa8e06SEd Maste 280afa8e06SEd Maste cbor_item_t *fido_blob_encode(const fido_blob_t *); 290afa8e06SEd Maste fido_blob_t *fido_blob_new(void); 300afa8e06SEd Maste int fido_blob_decode(const cbor_item_t *, fido_blob_t *); 310afa8e06SEd Maste int fido_blob_is_empty(const fido_blob_t *); 320afa8e06SEd Maste int fido_blob_set(fido_blob_t *, const u_char *, size_t); 330afa8e06SEd Maste int fido_blob_append(fido_blob_t *, const u_char *, size_t); 340afa8e06SEd Maste void fido_blob_free(fido_blob_t **); 350afa8e06SEd Maste void fido_blob_reset(fido_blob_t *); 360afa8e06SEd Maste void fido_free_blob_array(fido_blob_array_t *); 370afa8e06SEd Maste 380afa8e06SEd Maste #ifdef __cplusplus 390afa8e06SEd Maste } /* extern "C" */ 400afa8e06SEd Maste #endif /* __cplusplus */ 410afa8e06SEd Maste 420afa8e06SEd Maste #endif /* !_BLOB_H */ 43