1 /*
2    Copyright (c) 2021 Fraunhofer AISEC. See the COPYRIGHT
3    file at the top-level directory of this distribution.
4 
5    Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6    http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7    <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8    option. This file may not be copied, modified, or distributed
9    except according to those terms.
10 */
11 
12 #include <stdint.h>
13 #include <string.h>
14 
15 #include "edhoc/edhoc_cose.h"
16 #include "edhoc/associated_data_encode.h"
17 
18 #include "common/oscore_edhoc_error.h"
19 #include "common/print_util.h"
20 
associated_data_encode(uint8_t * thX,const uint32_t thX_len,uint8_t * out,uint32_t * out_len)21 enum err associated_data_encode(uint8_t *thX, const uint32_t thX_len,
22 				uint8_t *out, uint32_t *out_len)
23 {
24 	uint8_t context_str[] = { "Encrypt0" };
25 	return cose_enc_structure_encode(context_str,
26 					 (uint32_t)strlen((char *)context_str),
27 					 NULL, 0, thX, thX_len, out, out_len);
28 }
29