X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/e5b61a8dec3586f96d25bd3ef454176526ff0f69..1c54c7d261e18560a07ba9e809f4aaff0c64e647:/symm/square.c diff --git a/symm/square.c b/symm/square.c index f3056dea..34d313d7 100644 --- a/symm/square.c +++ b/symm/square.c @@ -31,6 +31,7 @@ #include #include +#include #include "blkc.h" #include "gcipher.h" @@ -46,7 +47,7 @@ const octet square_keysz[] = { KSZ_RANGE, SQUARE_KEYSZ, 4, 16, 4 }; extern const octet square_s[256], square_si[256]; extern const uint32 square_t[4][256], square_ti[4][256]; extern const uint32 square_u[4][256]; -extern const octet square_rcon[32]; +extern const octet square_rcon[35]; #define S square_s #define SI square_si @@ -92,10 +93,17 @@ void square_init(square_ctx *k, const void *buf, size_t sz) } nr = 8; + /* --- GCC complains about an out-of-bounds subscript here --- * + * + * This is impossible. Thanks to @KSZ_ASSERT@, we know that @4 <= sz <= + * 16@ and hence @1 <= i <= nk <= 4@; but @SQUARE_KWORDS == 36@. + */ + + ww = MUFFLE_WARNINGS_EXPR(GCC_WARNING("-Warray-bounds"), kk[i - 1]); + /* --- Expand this material to fill the rest of the table --- */ nw = (nr + 1) * 4; - ww = kk[i - 1]; p = RCON; for (; i < nw; i++) { uint32 w = kk[i - nk];