Commit 87aace1
committed
Validate PKCS#7 padding bytes in AES-CBC-PAD decrypt
WP11_AesCbcPad_DecryptFinal only checked the last byte as the pad
count without verifying all padding bytes matched. This allowed
tampered ciphertext to decrypt without error. Add constant-time
validation that padCnt is 1..AES_BLOCK_SIZE and all padding bytes
equal padCnt, returning BAD_PADDING_E on failure. Add test exercising
tampered ciphertext in both one-shot and multi-part decrypt paths.
F-8211 parent 0f35bc8 commit 87aace1
3 files changed
Lines changed: 574 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12993 | 12993 | | |
12994 | 12994 | | |
12995 | 12995 | | |
| 12996 | + | |
| 12997 | + | |
12996 | 12998 | | |
| 12999 | + | |
| 13000 | + | |
| 13001 | + | |
| 13002 | + | |
| 13003 | + | |
| 13004 | + | |
| 13005 | + | |
| 13006 | + | |
| 13007 | + | |
| 13008 | + | |
| 13009 | + | |
| 13010 | + | |
| 13011 | + | |
| 13012 | + | |
| 13013 | + | |
| 13014 | + | |
| 13015 | + | |
12997 | 13016 | | |
12998 | 13017 | | |
12999 | 13018 | | |
| |||
0 commit comments