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 #ifndef HKDF_INFO_H 13 #define HKDF_INFO_H 14 15 #include "suites.h" 16 17 #include "common/byte_array.h" 18 #include "common/oscore_edhoc_error.h" 19 20 enum info_label { 21 KEYSTREAM_2 = 0, 22 SALT_3e2m = 1, 23 MAC_2 = 2, 24 K_3 = 3, 25 IV_3 = 4, 26 SALT_4e3m = 5, 27 MAC_3 = 6, 28 PRK_out = 7, 29 K_4 = 8, 30 IV_4 = 9, 31 PRK_exporter = 10, 32 PRK_out_update = 11, 33 }; 34 35 /** 36 * @brief Encodes the HKDF Info 37 * 38 * @param label an in value indicating what kind of output we are generating 39 * @param context all possible contexts are listed in figure 7 in the spec 40 * @param context_len length of context 41 * @param okm_len the length of the output keying material 42 * @param out out-array 43 * @param out_len length of out 44 * @return err 45 */ 46 enum err create_hkdf_info(uint8_t label, uint8_t *context, uint32_t context_len, 47 uint32_t okm_len, uint8_t *out, uint32_t *out_len); 48 49 #endif 50