<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openssl/test/crypto_memcmp_test.c, branch master</title>
<subtitle>TLS/SSL and crypto library.</subtitle>
<id>http://git.bktus.com/gpgfrontend/openssl/atom?h=master</id>
<link rel='self' href='http://git.bktus.com/gpgfrontend/openssl/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://git.bktus.com/gpgfrontend/openssl/'/>
<updated>2026-06-11T16:11:57Z</updated>
<entry>
<title>Add constant-time validation for CRYPTO_memcmp</title>
<updated>2026-06-11T16:11:57Z</updated>
<author>
<name>David Foster</name>
<email>david@dafoster.net</email>
</author>
<published>2026-06-05T02:02:44Z</published>
<link rel='alternate' type='text/html' href='http://git.bktus.com/gpgfrontend/openssl/commit/?id=1a824261ef16231ea036b7935613ea4b219e3a42'/>
<id>urn:sha1:1a824261ef16231ea036b7935613ea4b219e3a42</id>
<content type='text'>
Add test/crypto_memcmp_test.c which provides functional coverage for
CRYPTO_memcmp under regular builds and constant-time coverage under
enable-ct-validation builds.

The added constant-time coverage checks:
- there are no data dependent branches or memory accesses,
  on x86_64 and aarch64 architectures

The added constant-time coverage does NOT check:
- there are no data-dependent variable-time instructions, such as
  instructions NOT on the x86 Data Operand Independent Timing list
  or NOT on the ARM Data-Independent Timing list
- any architectures beyond x86_64 and aarch64

New CONSTTIME_SECRET annotations live only in the test rather than in
the generic C version of CRYPTO_memcmp so that both the C and
assembler versions of CRYPTO_memcmp are constant-time covered.

CRYPTO_memcmp directly backs CPython's secrets.compare_digest() and
hmac.compare_digest(), so a timing leak in it is high impact, yet it had
essentially no direct test coverage.

References #15076.

Co-Authored-By: Claude Opus 4.8 &lt;noreply@anthropic.com&gt;

Reviewed-by: Milan Broz &lt;mbroz@openssl.org&gt;
Reviewed-by: Bob Beck &lt;beck@openssl.org&gt;
MergeDate: Thu Jun 11 16:11:58 2026
(Merged from https://github.com/openssl/openssl/pull/31398)
</content>
</entry>
</feed>
