Match libsodium 1.0.22 nonnull attributes - #187
Open
gafferongames wants to merge 3 commits into
Open
Conversation
Johnny Grok: a bare nonnull on poly1305_update and the ChaCha20 xor family treats a NULL zero-length buffer as UB for UBSAN. Challenge-token AEAD uses additional data NULL, 0. Also fix decrypt_detached nonnull(3, 5, 9, 9) to (3, 5, 8, 9) so the nonce is checked. Header attributes only. Fixes #186.
Fourteen declarations carried a bare nonnull, not ten. This pass was the crypto slice netcode calls; nine utils-slice divergences remain and are listed. Written by Johnny Grok.
Johnny Grok: leave nonnull-attribute on so the challenge-token NULL additional-data path is a real guard. SIMD unaligned loads keep the alignment exemption. Written by Johnny Grok.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Johnny Grok. Fixes #186.
Two annotation defects in
sodium/sodium.h, neither touching crypto arithmetic:__attribute__ ((nonnull))while upstream 1.0.22 names only the pointers that cannot be NULL. A NULL additional-data pointer with length zero is a valid call and is how netcode encrypts challenge tokens; the bare attribute aborts a UBSAN build on that path.crypto_aead_xchacha20poly1305_ietf_decrypt_detachedhadnonnull(3, 5, 9, 9)(nonce missing). Upstream isnonnull(3, 5, 8, 9).Attributes copied from libsodium 1.0.22 public headers. Crypto text unchanged.
ctestgreen with-DNETCODE_SANITIZE=ON.yojimbo should re-vendor netcode's
sodium/after this lands (parity workflow).