diff options
author | kris <kris@FreeBSD.org> | 2001-07-19 19:59:37 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-07-19 19:59:37 +0000 |
commit | 84fabcda925860c067e7f03b07d3a988add59e0b (patch) | |
tree | ef18fca7a2e8717f4db054621eb99df1a2637e56 /crypto/openssl/ssl/t1_enc.c | |
parent | d0bb02b6446135ca9fe648fd3c37af5f01a47815 (diff) | |
parent | 3b19ada1e8e5f87b844d2cc1e72907cfb7774fb6 (diff) | |
download | FreeBSD-src-84fabcda925860c067e7f03b07d3a988add59e0b.zip FreeBSD-src-84fabcda925860c067e7f03b07d3a988add59e0b.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r79998,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'crypto/openssl/ssl/t1_enc.c')
-rw-r--r-- | crypto/openssl/ssl/t1_enc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crypto/openssl/ssl/t1_enc.c b/crypto/openssl/ssl/t1_enc.c index d10a23a..a0758e9 100644 --- a/crypto/openssl/ssl/t1_enc.c +++ b/crypto/openssl/ssl/t1_enc.c @@ -420,7 +420,7 @@ int tls1_enc(SSL *s, int send) if ((s->session == NULL) || (ds == NULL) || (enc == NULL)) { - memcpy(rec->data,rec->input,rec->length); + memmove(rec->data,rec->input,rec->length); rec->input=rec->data; } else @@ -447,11 +447,21 @@ int tls1_enc(SSL *s, int send) rec->length+=i; } + if (!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); + } + } + EVP_Cipher(ds,rec->data,rec->input,l); if ((bs != 1) && !send) { - ii=i=rec->data[l-1]; + ii=i=rec->data[l-1]; /* padding_length */ i++; if (s->options&SSL_OP_TLS_BLOCK_PADDING_BUG) { @@ -462,6 +472,8 @@ int tls1_enc(SSL *s, int send) if (s->s3->flags & TLS1_FLAGS_TLS_PADDING_BUG) i--; } + /* TLS 1.0 does not bound the number of padding bytes by the block size. + * 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); |