Recent if_wg work: Should DIAGNOSTIC imply KASSERT is available?

From: David Wolfskill <david_at_catwhisker.org>
Date: Mon, 15 Mar 2021 04:20:42 -0700
For my laptop, the kernel config includes GENERIC, does not have

options       INVARIANTS

but does have

options         DIAGNOSTIC

which has not been a problem until today.

In src/sys/dev/if_wg/wg_noise.c, as of main-n245465-16b2290447de, I see:

...
    778 static void
    779 noise_kdf(uint8_t *a, uint8_t *b, uint8_t *c, const uint8_t *x,
    780     size_t a_len, size_t b_len, size_t c_len, size_t x_len,
    781     const uint8_t ck[NOISE_HASH_LEN])
    782 {
    783         uint8_t out[BLAKE2S_HASH_SIZE + 1];
    784         uint8_t sec[BLAKE2S_HASH_SIZE];
    785 
    786 #ifdef DIAGNOSTIC
    787         KASSERT(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE    787  &&
    788                         c_len <= BLAKE2S_HASH_SIZE);
    789         KASSERT(!(b || b_len || c || c_len) || (a && a_len));
    790         KASSERT(!(c || c_len) || (b && b_len));
    791 #endif
    792 
....

which the compiler helpfully pointed out to me attempts to use KASSERT
without having it defined.

So: Is DIAGNOSTIC intended to necessarily imply that KASSERT is
available for use?

Thanks!

Peace,
david
-- 
David H. Wolfskill                              david_at_catwhisker.org
That broadly-popular "American Rescue Plan" (stimulus/COVID relrief)?
Ever Republican vote in Congress was against it.

See https://www.catwhisker.org/~david/publickey.gpg for my public key.

Received on Mon Mar 15 2021 - 10:20:45 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:27 UTC