From f47bbfc17482cbeffe5d283834543f26563fa903 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Wed, 29 Jan 2025 11:36:33 +0100 Subject: [PATCH] ascon: error out when word64 not available --- wolfcrypt/src/ascon.c | 4 ++++ wolfssl/wolfcrypt/ascon.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/wolfcrypt/src/ascon.c b/wolfcrypt/src/ascon.c index 4da892c53..775614a7b 100644 --- a/wolfcrypt/src/ascon.c +++ b/wolfcrypt/src/ascon.c @@ -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 diff --git a/wolfssl/wolfcrypt/ascon.h b/wolfssl/wolfcrypt/ascon.h index 3e95d521f..52cb889f7 100644 --- a/wolfssl/wolfcrypt/ascon.h +++ b/wolfssl/wolfcrypt/ascon.h @@ -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 */