Commit eefa39a
Fix RSA-OAEP to allow zero-length plaintext per RFC 8017
RsaPublicEncryptEx() rejected inLen==0 unconditionally with
BAD_FUNC_ARG. RFC 8017 Section 7.1.1 (RSAES-OAEP-ENCRYPT) permits
zero-length messages: the only length constraint is
mLen <= k - 2*hLen - 2, which mLen=0 always satisfies.
RsaPrivateDecryptEx() converted a zero-length decryption result to
RSA_BUFFER_E (unless WOLFSSL_RSA_DECRYPT_TO_0_LEN was defined).
RFC 8017 Section 7.1.2 (RSAES-OAEP-DECRYPT) produces the original
message M which may be empty. The fix uses constant-time masking to
allow ret==0 when pad_type is WC_RSA_OAEP_PAD, preserving the
existing timing-safe behavior for other padding types.
Both OpenSSL and BoringSSL accept empty OAEP plaintexts.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 922d04b commit eefa39a
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3318 | 3318 | | |
3319 | 3319 | | |
3320 | 3320 | | |
3321 | | - | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
3322 | 3330 | | |
3323 | 3331 | | |
3324 | 3332 | | |
| |||
3706 | 3714 | | |
3707 | 3715 | | |
3708 | 3716 | | |
3709 | | - | |
3710 | | - | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
3711 | 3724 | | |
3712 | 3725 | | |
3713 | 3726 | | |
| |||
0 commit comments