[openssl/openssl] d4c900: test: fix unreachable code in test_kdf_pbkdf2_larg...

"'AntonMoryakov' via openssl-commits" <[email protected]>
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/master/[email protected]>
  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: d4c900174ceaacf413600b1c97b03e8991b1966d
      https://github.com/openssl/openssl/commit/d4c900174ceaacf413600b1c97b03e8991b1966d
  Author: Anton Moryakov <[email protected]>
  Date:   2026-06-02 (Tue, 02 Jun 2026)

  Changed paths:
    M test/evp_kdf_test.c

  Log Message:
  -----------
  test: fix unreachable code in test_kdf_pbkdf2_large_output in evp_kdf_test.c

The condition `if (sizeof(len) > 32)` was intended to set `len` to
SIZE_MAX on platforms where size_t can hold values larger than 32 bits.
However, sizeof() returns the size in bytes, not bits. Since sizeof(size_t)
is typically 4 or 8 bytes on all current platforms, the condition was
always false, leaving len at 0 and skipping the large-output test.

This commit fixes the check by comparing SIZE_MAX directly against
0xFFFFFFFFU, which correctly detects whether size_t can represent
values exceeding 32-bit range. This ensures the test properly validates
PBKDF2 behavior when requested output length is excessively large.

Fixes: 1cae59d14b9e "Make KDFs fail if requesting a zero-length key."
Signed-off-by: Anton Moryakov <[email protected]>

Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Daniel Kubec <[email protected]>
MergeDate: Tue Jun  2 11:10:23 2026
(Merged from https://github.com/openssl/openssl/pull/31344)



To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications

-- 
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/master/0a396b-d4c900%40github.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.