From af293b3df26a0a176bba226b28d9800bfbd2b00a Mon Sep 17 00:00:00 2001 From: miod Date: Fri, 3 Feb 2023 18:31:16 +0000 Subject: [PATCH] Remove redundant DIAGNOSTIC wrappers around KASSERT macros. From Crystal Kolipe. --- sys/crypto/blake2s.c | 8 +------- sys/crypto/blake2s.h | 4 +--- sys/dev/ic/ahci.c | 4 +--- sys/net/wg_noise.c | 4 +--- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/sys/crypto/blake2s.c b/sys/crypto/blake2s.c index ea7fec64b80..82d53ed4a51 100644 --- a/sys/crypto/blake2s.c +++ b/sys/crypto/blake2s.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blake2s.c,v 1.2 2020/07/22 13:54:30 tobhe Exp $ */ +/* $OpenBSD: blake2s.c,v 1.3 2023/02/03 18:31:16 miod Exp $ */ /* * Copyright (C) 2012 Samuel Neves . All Rights Reserved. * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. @@ -73,9 +73,7 @@ static inline void blake2s_init_param(struct blake2s_state *state, void blake2s_init(struct blake2s_state *state, const size_t outlen) { -#ifdef DIAGNOSTIC KASSERT(!(!outlen || outlen > BLAKE2S_HASH_SIZE)); -#endif blake2s_init_param(state, 0x01010000 | outlen); state->outlen = outlen; } @@ -85,10 +83,8 @@ void blake2s_init_key(struct blake2s_state *state, const size_t outlen, { uint8_t block[BLAKE2S_BLOCK_SIZE] = { 0 }; -#ifdef DIAGNOSTIC KASSERT(!(!outlen || outlen > BLAKE2S_HASH_SIZE || !key || !keylen || keylen > BLAKE2S_KEY_SIZE)); -#endif blake2s_init_param(state, 0x01010000 | keylen << 8 | outlen); state->outlen = outlen; @@ -105,9 +101,7 @@ static inline void blake2s_compress(struct blake2s_state *state, uint32_t v[16]; int i; -#ifdef DIAGNOSTIC KASSERT(!((nblocks > 1 && inc != BLAKE2S_BLOCK_SIZE))); -#endif while (nblocks > 0) { blake2s_increment_counter(state, inc); diff --git a/sys/crypto/blake2s.h b/sys/crypto/blake2s.h index 69c5b23f7f1..a56e82fec96 100644 --- a/sys/crypto/blake2s.h +++ b/sys/crypto/blake2s.h @@ -1,4 +1,4 @@ -/* $OpenBSD: blake2s.h,v 1.2 2020/07/22 13:54:30 tobhe Exp $ */ +/* $OpenBSD: blake2s.h,v 1.3 2023/02/03 18:31:16 miod Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. * Copyright (C) 2019-2020 Matt Dunwoodie . @@ -48,11 +48,9 @@ static inline void blake2s( { struct blake2s_state state; -#ifdef DIAGNOSTIC KASSERT((in != NULL || inlen == 0) && out != NULL && outlen <= BLAKE2S_HASH_SIZE && (key != NULL || keylen == 0) && keylen <= BLAKE2S_KEY_SIZE); -#endif if (keylen) blake2s_init_key(&state, outlen, key, keylen); diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index a4004001c14..4a679bc5e38 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.38 2022/04/09 20:10:26 naddy Exp $ */ +/* $OpenBSD: ahci.c,v 1.39 2023/02/03 18:31:16 miod Exp $ */ /* * Copyright (c) 2006 David Gwynne @@ -2481,10 +2481,8 @@ ahci_put_err_ccb(struct ahci_ccb *ccb) printf("ahci_put_err_ccb but SACT %08x != 0?\n", sact); KASSERT(ahci_pread(ap, AHCI_PREG_CI) == 0); -#ifdef DIAGNOSTIC /* Done with the CCB */ KASSERT(ccb == ap->ap_ccb_err); -#endif /* Restore outstanding command state */ ap->ap_sactive = ap->ap_err_saved_sactive; diff --git a/sys/net/wg_noise.c b/sys/net/wg_noise.c index 47552229b8a..2a1954d94cc 100644 --- a/sys/net/wg_noise.c +++ b/sys/net/wg_noise.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wg_noise.c,v 1.5 2021/03/21 18:13:59 sthen Exp $ */ +/* $OpenBSD: wg_noise.c,v 1.6 2023/02/03 18:31:17 miod Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. * Copyright (C) 2019-2020 Matt Dunwoodie @@ -791,12 +791,10 @@ noise_kdf(uint8_t *a, uint8_t *b, uint8_t *c, const uint8_t *x, uint8_t out[BLAKE2S_HASH_SIZE + 1]; uint8_t sec[BLAKE2S_HASH_SIZE]; -#ifdef DIAGNOSTIC KASSERT(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE && c_len <= BLAKE2S_HASH_SIZE); KASSERT(!(b || b_len || c || c_len) || (a && a_len)); KASSERT(!(c || c_len) || (b && b_len)); -#endif /* Extract entropy from "x" into sec */ blake2s_hmac(sec, x, ck, BLAKE2S_HASH_SIZE, x_len, NOISE_HASH_LEN); -- 2.20.1