Add __msan_unpoison for X25519 assembly output buffers#30021
Open
alexey-milovidov wants to merge 1 commit intoopenssl:masterfrom
Open
Add __msan_unpoison for X25519 assembly output buffers#30021alexey-milovidov wants to merge 1 commit intoopenssl:masterfrom
alexey-milovidov wants to merge 1 commit intoopenssl:masterfrom
Conversation
x25519_scalar_mult and fe_tobytes may dispatch to assembly implementations (e.g. x25519-x86_64.s) that MemorySanitizer cannot instrument. As a result, output buffers written by the assembly appear uninitialized to MSan, causing false positives when subsequent code reads them (e.g. CRYPTO_memcmp in ossl_x25519). Add __msan_unpoison annotations after assembly writes in ossl_x25519 and ossl_x25519_public_from_private, following the same pattern already used in sha3.c, bn_intern.c, and eng_rdrand.c.
Member
Note: this means usually you use a secret value in a non-constant time function, |
paulidale
approved these changes
Feb 16, 2026
Author
|
This usage is in |
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.
x25519_scalar_multandfe_tobytesmay dispatch to assemblyimplementations (e.g.
x25519-x86_64.s) that MemorySanitizercannot instrument. As a result, output buffers written by the
assembly appear uninitialized to MSan, causing false positives
when subsequent code reads them (e.g.
CRYPTO_memcmpinossl_x25519).This adds
__msan_unpoisonannotations after assembly writes inossl_x25519andossl_x25519_public_from_private, following thesame pattern already used in
sha3.c,bn_intern.c, andeng_rdrand.c.The issue was discovered while testing ClickHouse's SSH protocol
support with MSan: the libssh library calls
EVP_PKEY_deriveforX25519 key exchange, and the shared secret buffer produced by the
assembly implementation triggers a false
use-of-uninitialized-valuereport in
BN_bin2bn.