From 1cd6641cdefb51c9070284b50da8b4c01287ca9a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 3 Jan 2019 18:52:43 +0100 Subject: [PATCH] Add an extra compile-time assertion --- .../crypto_generichash/blake2b/ref/generichash_blake2b.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c b/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c index 99aa9324..7a8598c7 100644 --- a/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c +++ b/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c @@ -5,6 +5,7 @@ #include "blake2.h" #include "crypto_generichash_blake2b.h" +#include "private/common.h" #include "private/implementations.h" int @@ -52,6 +53,7 @@ crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state, } assert(outlen <= UINT8_MAX); assert(keylen <= UINT8_MAX); + COMPILER_ASSERT(sizeof(blake2b_state) <= sizeof *state); if (key == NULL || keylen <= 0U) { if (blake2b_init((blake2b_state *) (void *) state, (uint8_t) outlen) != 0) { return -1; /* LCOV_EXCL_LINE */