[openssl/openssl] 192969: Restore empty raw PKCS#1 verify-recover behavior

"'Mounir IDRASSI' via openssl-commits" <[email protected]> Fri, 24 Jul 2026 06:08:38 -0700
Newsgroups gmane.comp.encryption.openssl.cvs
Message-ID <openssl/openssl/push/refs/heads/openssl-4.0/[email protected]>
  Branch: refs/heads/openssl-4.0
  Home:   https://github.com/openssl/openssl
  Commit: 1929690cfcfad7747367024d193a9228f64f37c4
      https://github.com/openssl/openssl/commit/1929690cfcfad7747367024d193a9228f64f37c4
  Author: Mounir IDRASSI <[email protected]>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M providers/implementations/signature/rsa_sig.c
    M test/evp_extra_test.c

  Log Message:
  -----------
  Restore empty raw PKCS#1 verify-recover behavior

EVP_PKEY_verify_recover() with RSA PKCS#1 v1.5 padding and no configured
signature digest rejected a valid signature whose recovered payload is
empty, instead of returning success with a recovered length of zero.

RSA_public_decrypt() returns -1 on error and otherwise the number of
recovered bytes, which may legitimately be zero for a raw PKCS#1 v1.5
signature that encodes an empty payload.  Pull request #28306 ("Make
error checks on RSA_public_decrypt() consistent") changed the error
check in the raw, no-digest verify-recover path from "ret < 0" to
"ret <= 0", so a valid zero recovered length was mistaken for an error.

Restore the "< 0" check in that branch only, leaving the digest-aware
PKCS#1, X9.31, PSS and ordinary verification paths untouched.

Add test_RSA_verify_recover_empty_payload, which performs a complete
zero-length raw PKCS#1 v1.5 sign-and-recover round trip through EVP and
fails on the unmodified implementation specifically at the
EVP_PKEY_verify_recover() call.  OpenSSL 3.0.13 recovers the same
signature and reports a zero-byte result.

The behavior regressed as a result of #28306.

Fixes #32000

Assisted-by: OpenCode:GLM-5.2

Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Jakub Zelenka <[email protected]>
MergeDate: Fri Jul 24 13:06:58 2026
(Merged from https://github.com/openssl/openssl/pull/32001)

(cherry picked from commit 5f48317d6d847e555bf788f8b71d51ac032a6344)



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/openssl-4.0/22116d-192969%40github.com.