Commit a0752c3
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 86db2d4 commit a0752c3
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3355 | 3355 | | |
3356 | 3356 | | |
3357 | 3357 | | |
3358 | | - | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
3359 | 3367 | | |
3360 | 3368 | | |
3361 | 3369 | | |
| |||
3753 | 3761 | | |
3754 | 3762 | | |
3755 | 3763 | | |
3756 | | - | |
3757 | | - | |
| 3764 | + | |
| 3765 | + | |
| 3766 | + | |
| 3767 | + | |
| 3768 | + | |
| 3769 | + | |
| 3770 | + | |
3758 | 3771 | | |
3759 | 3772 | | |
3760 | 3773 | | |
| |||
0 commit comments