ascon: error out when word64 not available

This commit is contained in:
Juliusz Sosinowicz
2025-01-29 11:36:33 +01:00
parent 76e29be1a9
commit f47bbfc174
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,10 @@
* - Add support for big-endian systems
* - Add support for 32-bit and smaller systems */
#ifndef WORD64_AVAILABLE
#error "Ascon implementation requires a 64-bit word"
#endif
/* Data block size in bytes */
#define ASCON_HASH256_RATE 8
#define ASCON_HASH256_ROUNDS 12

View File

@ -37,7 +37,9 @@ extern "C" {
#define ASCON_AEAD128_TAG_SZ 16
typedef union AsconState {
#ifdef WORD64_AVAILABLE
word64 s64[5];
#endif
word32 s32[10];
word16 s16[20];
byte s8[40];
@ -56,7 +58,9 @@ enum {
typedef struct wc_AsconAEAD128 {
/* needed throughout both encrypt and decrypt */
#ifdef WORD64_AVAILABLE
word64 key[ASCON_AEAD128_KEY_SZ/sizeof(word64)];
#endif
AsconState state;
byte lastBlkSz;
byte KeySet:1; /* has the key been processed */