Commit 06bc366
Fix AES-EAX to allow empty plaintext
The one-shot wc_AesEaxEncryptAuth/wc_AesEaxDecryptAuth and the
incremental wc_AesEaxEncryptUpdate/wc_AesEaxDecryptUpdate functions
unconditionally required non-NULL out/in/authIn pointers, returning
BAD_FUNC_ARG even when the corresponding length was 0.
EAX mode with empty plaintext is a valid authentication-only operation
that produces just an authentication tag (OMAC over nonce and AAD).
This is permitted by the EAX specification (Bellare, Rogaway, Wagner
2004) and exercised by Wycheproof test vectors.
Fix: gate NULL pointer checks on the corresponding length being > 0.
In the incremental Update functions, skip the AES-CTR and CMAC
ciphertext update when inSz is 0 to avoid passing NULL to
wc_AesCtrEncrypt (which also rejects NULL unconditionally).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c4c71ee commit 06bc366
1 file changed
Lines changed: 38 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16779 | 16779 | | |
16780 | 16780 | | |
16781 | 16781 | | |
16782 | | - | |
16783 | | - | |
| 16782 | + | |
| 16783 | + | |
| 16784 | + | |
16784 | 16785 | | |
16785 | 16786 | | |
16786 | 16787 | | |
| |||
16842 | 16843 | | |
16843 | 16844 | | |
16844 | 16845 | | |
16845 | | - | |
16846 | | - | |
| 16846 | + | |
| 16847 | + | |
| 16848 | + | |
16847 | 16849 | | |
16848 | 16850 | | |
16849 | 16851 | | |
| |||
17031 | 17033 | | |
17032 | 17034 | | |
17033 | 17035 | | |
17034 | | - | |
| 17036 | + | |
17035 | 17037 | | |
17036 | 17038 | | |
17037 | 17039 | | |
17038 | | - | |
17039 | | - | |
17040 | | - | |
17041 | | - | |
17042 | | - | |
17043 | | - | |
17044 | | - | |
| 17040 | + | |
| 17041 | + | |
| 17042 | + | |
| 17043 | + | |
| 17044 | + | |
| 17045 | + | |
| 17046 | + | |
| 17047 | + | |
17045 | 17048 | | |
17046 | | - | |
17047 | | - | |
17048 | | - | |
17049 | | - | |
17050 | | - | |
17051 | | - | |
| 17049 | + | |
| 17050 | + | |
| 17051 | + | |
| 17052 | + | |
| 17053 | + | |
| 17054 | + | |
| 17055 | + | |
17052 | 17056 | | |
17053 | 17057 | | |
17054 | 17058 | | |
| |||
17076 | 17080 | | |
17077 | 17081 | | |
17078 | 17082 | | |
17079 | | - | |
| 17083 | + | |
17080 | 17084 | | |
17081 | 17085 | | |
17082 | 17086 | | |
17083 | | - | |
17084 | | - | |
17085 | | - | |
17086 | | - | |
17087 | | - | |
17088 | | - | |
17089 | | - | |
| 17087 | + | |
| 17088 | + | |
| 17089 | + | |
| 17090 | + | |
| 17091 | + | |
| 17092 | + | |
| 17093 | + | |
| 17094 | + | |
17090 | 17095 | | |
17091 | | - | |
17092 | | - | |
17093 | | - | |
17094 | | - | |
17095 | | - | |
17096 | | - | |
| 17096 | + | |
| 17097 | + | |
| 17098 | + | |
| 17099 | + | |
| 17100 | + | |
| 17101 | + | |
| 17102 | + | |
17097 | 17103 | | |
17098 | 17104 | | |
17099 | 17105 | | |
| |||
0 commit comments