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 #include "common/byte_array.h"
21 
associated_data_encode(struct byte_array * thX,struct byte_array * out)22 enum err associated_data_encode(struct byte_array *thX, struct byte_array *out)
23 {
24 	uint8_t context_str[] = { "Encrypt0" };
25 	struct byte_array context = BYTE_ARRAY_INIT(
26 		context_str, (uint32_t)strlen((char *)context_str));
27 
28 	return cose_enc_structure_encode(&context, &NULL_ARRAY, thX, out);
29 }
30