Recent if_wg work: Should DIAGNOSTIC imply KASSERT is available?

David Wolfskill david at catwhisker.org
Mon Mar 15 11:20:45 UTC 2021


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 618 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20210315/31a78088/attachment.sig>


More information about the freebsd-current mailing list