diff options
author | Richard Levitte <levitte@openssl.org> | 2001-04-08 05:41:42 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-04-08 05:41:42 +0000 |
commit | 42748c084ee12dfa35d49f52308bafb369873443 (patch) | |
tree | 9fa62f6bf3b134f9b2f1b7d6fe2e6102d0c3c274 /ssl/s3_enc.c | |
parent | 77dd9c1850a35c504c5cfcb2d62c4f362bf9691f (diff) |
Resize a local buffer to accomodate the size requirements of AES.
Protect against future mistakes with an assert().
Diffstat (limited to 'ssl/s3_enc.c')
-rw-r--r-- | ssl/s3_enc.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 9e442a1f1b..2112602dc8 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -57,6 +57,7 @@ */ #include <stdio.h> +#include <assert.h> #include <openssl/md5.h> #include <openssl/sha.h> #include <openssl/evp.h> @@ -85,7 +86,7 @@ static void ssl3_generate_key_block(SSL *s, unsigned char *km, int num) { MD5_CTX m5; SHA_CTX s1; - unsigned char buf[8],smd[SHA_DIGEST_LENGTH]; + unsigned char buf[16],smd[SHA_DIGEST_LENGTH]; unsigned char c='A'; int i,j,k; @@ -96,6 +97,9 @@ static void ssl3_generate_key_block(SSL *s, unsigned char *km, int num) for (i=0; i<num; i+=MD5_DIGEST_LENGTH) { k++; + /* If this assert is triggered, it means buf needs to be + resized. This should never be triggered in a release. */ + assert(k <= sizeof(buf)); for (j=0; j<k; j++) buf[j]=c; c++; |