mirror of https://github.com/ipxe/ipxe.git
[tls] Treat invalid block padding as zero length padding
Harden against padding oracle attacks by treating invalid block padding as zero length padding, thereby deferring the failure until after computing the (incorrect) MAC. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/801/head
parent
634a86093a
commit
186306d619
|
@ -2821,8 +2821,8 @@ static int tls_new_ciphertext ( struct tls_connection *tls,
|
|||
if ( is_block_cipher ( cipher ) ) {
|
||||
pad_len = tls_verify_padding ( tls, last );
|
||||
if ( pad_len < 0 ) {
|
||||
rc = pad_len;
|
||||
return rc;
|
||||
/* Assume zero padding length to avoid timing attacks */
|
||||
pad_len = 0;
|
||||
}
|
||||
iob_unput ( last, pad_len );
|
||||
len -= pad_len;
|
||||
|
|
Loading…
Reference in New Issue