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 SIGNATURE_OR_MAC_MSG_H
12 #define SIGNATURE_OR_MAC_MSG_H
13 
14 #include <stdbool.h>
15 
16 #include "suites.h"
17 
18 #include "common/oscore_edhoc_error.h"
19 
20 enum sgn_or_mac_op { VERIFY, GENERATE };
21 
22 /**
23  * @brief                        Computes or verify a signature or a mac.
24  *
25  * @param op                     VERIFY or GENERATE
26  * @param static_dh              True if static DH keys are used.
27  * @param suite                  The cipher suite.
28  * @param[in] sk                 Secret key.
29  * @param[in] pk                 Public key.
30  * @param[in] prk                Pseudo random key used in key/iv generation.
31  * @param[in] th                 Transcript hash.
32  * @param[in] id_cred            ID_CRED of the calling party.
33  * @param[in] cred               CRED of the calling party.
34  * @param[in] ead                External authorization data.
35  * @param mac_label              MAC label, see specification.
36  * @param[in,out] sig_or_mac     The computed signature or mac.
37  * @return                       Ok or error.
38  */
39 enum err
40 signature_or_mac(enum sgn_or_mac_op op, bool static_dh, struct suite *suite,
41 		 const struct byte_array *sk, const struct byte_array *pk,
42 		 const struct byte_array *prk, const struct byte_array *c_r,
43 		 const struct byte_array *th, const struct byte_array *id_cred,
44 		 const struct byte_array *cred, const struct byte_array *ead,
45 		 enum info_label mac_label, struct byte_array *sig_or_mac);
46 
47 #endif
48