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 #ifndef TH_H
12 #define TH_H
13 
14 #include "suites.h"
15 #include "c_x.h"
16 
17 #include "common/byte_array.h"
18 #include "common/oscore_edhoc_error.h"
19 
20 /**
21  * @brief   calculates transcript hash th2
22  * @param   alg hash algorithm to be used
23  * @param   msg1 pointer to a message 1
24  * @param   msg1_len length of message 1
25  * @param   g_y Pointer to the public DH parameter
26  * @param   c_r Pointer to the conception identifier of the responder
27  * @param   th2 ouput buffer
28  */
29 enum err th2_calculate(enum hash_alg alg, uint8_t *msg1, uint32_t msg1_len,
30 		       uint8_t *g_y, uint32_t g_y_len, struct c_x *c_r,
31 		       uint8_t *th2);
32 
33 /**
34  * @brief   calculates transcript hash th3
35  * @param   alg hash algorithm to be used
36  * @param   th2 pointer to a th2
37  * @param   th2_len length of th2
38  * @param   ciphertext_2
39  * @param   ciphertext_2_len  length of ciphertext_2_len
40  * @param   th3 ouput buffer
41  */
42 enum err th3_calculate(enum hash_alg alg, uint8_t *th2, uint32_t th2_len,
43 		       uint8_t *ciphertext_2, uint32_t ciphertext_2_len,
44 		       uint8_t *th3);
45 
46 /**
47  * @brief   calculates transcript hash th4
48  * @param   alg hash algorithm to be used
49  * @param   th3 pointer to a th3
50  * @param   th3_len length of th3
51  * @param   ciphertext_3
52  * @param   ciphertext_3_len  length of ciphertext_3_len
53  * @param   th4 ouput buffer
54  */
55 enum err th4_calculate(enum hash_alg alg, uint8_t *th3, uint32_t th3_len,
56 		       uint8_t *ciphertext_3, uint32_t ciphertext_3_len,
57 		       uint8_t *th4);
58 
59 #endif
60