]> granicus.if.org Git - openssl/commitdiff
evp/e_des3.c: fix typo with potential integer overflow on 32-bit platforms.
authorAndy Polyakov <appro@openssl.org>
Thu, 3 Oct 2013 08:55:49 +0000 (10:55 +0200)
committerBen Laurie <ben@links.org>
Sat, 5 Oct 2013 20:09:50 +0000 (21:09 +0100)
Submitted by: Yuriy Kaminskiy
(cherry picked from commit 524b00c0da42b129ed8622dfb3f5eab9cc5d6617)

crypto/evp/e_des3.c

index 157d0d515e4b3086439ee9afaf4bf2e105dc2401..fa3b05cf142c22ebbc3a8419cdddf92749925c27 100644 (file)
@@ -119,7 +119,7 @@ static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                              const unsigned char *in, size_t inl)
 {
-       if (inl>=EVP_MAXCHUNK)
+       while (inl>=EVP_MAXCHUNK)
                {
                DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK,
                               &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
@@ -158,7 +158,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                return 1;
                }
 
-       if (inl>=EVP_MAXCHUNK)
+       while (inl>=EVP_MAXCHUNK)
                {
                DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK,
                             &dat->ks1, &dat->ks2, &dat->ks3,
@@ -177,7 +177,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
 static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
                              const unsigned char *in, size_t inl)
 {
-       if (inl>=EVP_MAXCHUNK)
+       while (inl>=EVP_MAXCHUNK)
                {
                DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, 
                               &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,