diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-01 04:03:09 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-02 14:37:53 +0200 |
commit | 01698421ef7b621442f1d4a7a6fe768718ec1479 (patch) | |
tree | 0f89e57afaeb834750427354280f7e03a2a6f0b6 /src/noise.c | |
parent | poly1305: document rationale for base 2^26->2^64/32 conversion (diff) | |
download | wireguard-monolithic-historical-01698421ef7b621442f1d4a7a6fe768718ec1479.tar.xz wireguard-monolithic-historical-01698421ef7b621442f1d4a7a6fe768718ec1479.zip |
global: change BUG_ON to WARN_ON
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Diffstat (limited to 'src/noise.c')
-rw-r--r-- | src/noise.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/noise.c b/src/noise.c index 814dc11..830858c 100644 --- a/src/noise.c +++ b/src/noise.c @@ -291,13 +291,12 @@ static void kdf(u8 *first_dst, u8 *second_dst, u8 *third_dst, const u8 *data, u8 output[BLAKE2S_HASH_SIZE + 1]; u8 secret[BLAKE2S_HASH_SIZE]; -#ifdef DEBUG - BUG_ON(first_len > BLAKE2S_HASH_SIZE || second_len > BLAKE2S_HASH_SIZE || - third_len > BLAKE2S_HASH_SIZE || - ((second_len || second_dst || third_len || third_dst) && - (!first_len || !first_dst)) || - ((third_len || third_dst) && (!second_len || !second_dst))); -#endif + WARN_ON(IS_ENABLED(DEBUG) && + (first_len > BLAKE2S_HASH_SIZE || second_len > BLAKE2S_HASH_SIZE || + third_len > BLAKE2S_HASH_SIZE || + ((second_len || second_dst || third_len || third_dst) && + (!first_len || !first_dst)) || + ((third_len || third_dst) && (!second_len || !second_dst)))); /* Extract entropy from data into secret */ blake2s_hmac(secret, data, chaining_key, BLAKE2S_HASH_SIZE, data_len, |