mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-24 04:25:10 -07:00
Add an extra compile-time assertion
This commit is contained in:
parent
74ccac9e83
commit
1cd6641cde
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "blake2.h"
|
#include "blake2.h"
|
||||||
#include "crypto_generichash_blake2b.h"
|
#include "crypto_generichash_blake2b.h"
|
||||||
|
#include "private/common.h"
|
||||||
#include "private/implementations.h"
|
#include "private/implementations.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -52,6 +53,7 @@ crypto_generichash_blake2b_init(crypto_generichash_blake2b_state *state,
|
|||||||
}
|
}
|
||||||
assert(outlen <= UINT8_MAX);
|
assert(outlen <= UINT8_MAX);
|
||||||
assert(keylen <= UINT8_MAX);
|
assert(keylen <= UINT8_MAX);
|
||||||
|
COMPILER_ASSERT(sizeof(blake2b_state) <= sizeof *state);
|
||||||
if (key == NULL || keylen <= 0U) {
|
if (key == NULL || keylen <= 0U) {
|
||||||
if (blake2b_init((blake2b_state *) (void *) state, (uint8_t) outlen) != 0) {
|
if (blake2b_init((blake2b_state *) (void *) state, (uint8_t) outlen) != 0) {
|
||||||
return -1; /* LCOV_EXCL_LINE */
|
return -1; /* LCOV_EXCL_LINE */
|
||||||
|
Loading…
Reference in New Issue
Block a user