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 | 3b19ada1e8e5f87b844d2cc1e72907cfb7774fb6 (patch) | |
tree | 97ecedd5f90991a7abe96b7ca0cb51fa579341b5 /crypto/openssl/ssl/s3_enc.c | |
parent | 12896e829e9474d92c70a1528cc64270e9dc08ad (diff) | |
download | FreeBSD-src-3b19ada1e8e5f87b844d2cc1e72907cfb7774fb6.zip FreeBSD-src-3b19ada1e8e5f87b844d2cc1e72907cfb7774fb6.tar.gz |
Initial import of OpenSSL 0.9.6b
Diffstat (limited to 'crypto/openssl/ssl/s3_enc.c')
-rw-r--r-- | crypto/openssl/ssl/s3_enc.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/crypto/openssl/ssl/s3_enc.c b/crypto/openssl/ssl/s3_enc.c index 9f52c39..8709da9 100644 --- a/crypto/openssl/ssl/s3_enc.c +++ b/crypto/openssl/ssl/s3_enc.c @@ -356,7 +356,7 @@ int ssl3_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 @@ -366,7 +366,6 @@ int ssl3_enc(SSL *s, int send) /* COMPRESS */ - /* This should be using (bs-1) and bs instead of 7 and 8 */ if ((bs != 1) && send) { i=bs-((int)l%bs); @@ -376,12 +375,24 @@ int ssl3_enc(SSL *s, int send) rec->length+=i; rec->input[l-1]=(i-1); } - + + if (!send) + { + if (l == 0 || l%bs != 0) + { + SSLerr(SSL_F_SSL3_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) { i=rec->data[l-1]+1; + /* SSL 3.0 bounds the number of padding bytes by the block size; + * padding bytes (except that last) are arbitrary */ if (i > bs) { SSLerr(SSL_F_SSL3_ENC,SSL_R_BLOCK_CIPHER_PAD_IS_WRONG); |