diff options
author | Bodo Möller <bodo@openssl.org> | 2001-09-20 18:35:52 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2001-09-20 18:35:52 +0000 |
commit | ee60d9fb282030be3f25e951b86d74d8f2dd1bdd (patch) | |
tree | 307f2414af069a1717aaa5a9906dd586024d2f2e /ssl/t1_enc.c | |
parent | be6d77005f0d474462ed5df896596d06402c05b2 (diff) |
Fix ssl/s3_enc.c, ssl/t1_enc.c and ssl/s3_pkt.c so that we don't
reveal whether illegal block cipher padding was found or a MAC
verification error occured.
In ssl/s2_pkt.c, verify that the purported number of padding bytes is in
the legal range.
Diffstat (limited to 'ssl/t1_enc.c')
-rw-r--r-- | ssl/t1_enc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c index 9686edde75..81583ecae9 100644 --- a/ssl/t1_enc.c +++ b/ssl/t1_enc.c @@ -517,8 +517,8 @@ int tls1_enc(SSL *s, int send) if (l == 0 || l%bs != 0) { SSLerr(SSL_F_TLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); - ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPT_ERROR); - return(0); + ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED); + return 0; } } @@ -550,17 +550,17 @@ int tls1_enc(SSL *s, int send) * All of them must have value 'padding_length'. */ if (i > (int)rec->length) { - SSLerr(SSL_F_TLS1_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); - ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED); - return(0); + /* Incorrect padding. SSLerr() and ssl3_alert are done + * by caller: we don't want to reveal whether this is + * a decryption error or a MAC verification failure. */ + return -1; } for (j=(int)(l-i); j<(int)l; j++) { if (rec->data[j] != ii) { - SSLerr(SSL_F_TLS1_ENC,SSL_R_DECRYPTION_FAILED); - ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_DECRYPTION_FAILED); - return(0); + /* Incorrect padding */ + return -1; } } rec->length-=i; |