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 PRK_H
13 #define PRK_H
14 
15 #include <stdint.h>
16 #include <stdbool.h>
17 
18 #include "common/byte_array.h"
19 #include "common/oscore_edhoc_error.h"
20 
21 /**
22  * @brief                       Derives a pseudo random key (prk) form anther
23  *                              prk and static DH keys.
24  *
25  * @param static_dh_auth        True if static DH keys should be used.
26  * @param suite                 The cipher suite to be used.
27  * @param label                 EDHOC-KDF label.
28  * @param[in] context           EDHOC-KDF context.
29  * @param[in] prk_in            Input prk.
30  * @param[in] stat_pk           Static public DH key.
31  * @param[in] stat_sk           Static secret DH key.
32  * @param[out] prk_out          The result.
33  * @retval                      Ok or error code.
34  */
35 enum err prk_derive(bool static_dh_auth, struct suite suite, uint8_t label,
36 		    struct byte_array *context, const struct byte_array *prk_in,
37 		    const struct byte_array *stat_pk,
38 		    const struct byte_array *stat_sk, uint8_t *prk_out);
39 
40 #endif
41