1 /* 2 * Copyright (c) 2022 Eriptic Technologies. 3 * 4 * SPDX-License-Identifier: Apache-2.0 or MIT 5 */ 6 7 #ifndef BSTR_ENCODE_DECODE_H 8 #define BSTR_ENCODE_DECODE_H 9 10 #include <stdint.h> 11 /** 12 * @brief Encodes an array of data to cbor byte string. 13 * 14 * @param[in] in Data to be encoded. 15 * @param[out] out The output buffer. 16 * @retval Ok or error code. 17 */ 18 enum err encode_bstr(const struct byte_array *in, struct byte_array *out); 19 20 /** 21 * @brief Decodes an a cbor bstr to an array of data. 22 * 23 * @param[in] in Cbor bstr. 24 * @param[out] out Ouput buffer. 25 * @return Ok or error code. 26 */ 27 enum err decode_bstr(const struct byte_array *in, struct byte_array *out); 28 29 #endif