Flatten the Curve 448 source structure
[openssl.git] / crypto / ec / curve448 / keccak_internal.h
1 /**
2  * @cond internal
3  * @file keccak_internal.h
4  * @copyright
5  *   Copyright (c) 2016 Cryptography Research, Inc.  \n
6  *   Released under the MIT License.  See LICENSE.txt for license information.
7  * @author Mike Hamburg
8  * @brief Keccak internal interfaces.  Will be used by STROBE once reintegrated.
9  */
10 #ifndef __DECAF_KECCAK_INTERNAL_H__
11 #define __DECAF_KECCAK_INTERNAL_H__ 1
12
13 #include <stdint.h>
14
15 /* The internal, non-opaque definition of the decaf_sponge struct. */
16 typedef union {
17     uint64_t w[25]; uint8_t b[25*8];
18 } kdomain_t[1];
19
20 typedef struct decaf_kparams_s {
21     uint8_t position, flags, rate, start_round, pad, rate_pad, max_out, remaining;
22 } decaf_kparams_s, decaf_kparams_t[1];
23
24 typedef struct decaf_keccak_sponge_s {
25     kdomain_t state;
26     decaf_kparams_t params;
27 } decaf_keccak_sponge_s, decaf_keccak_sponge_t[1];
28
29 #define INTERNAL_SPONGE_STRUCT 1
30
31 void __attribute__((noinline)) keccakf(kdomain_t state, uint8_t start_round);
32
33 static inline void dokeccak (decaf_keccak_sponge_t decaf_sponge) {
34     keccakf(decaf_sponge->state, decaf_sponge->params->start_round);
35     decaf_sponge->params->position = 0;
36 }
37
38 #endif /* __DECAF_KECCAK_INTERNAL_H__ */