evp/e_des3.c: fix typo with potential integer overflow on 32-bit platforms.

Submitted by: Yuriy Kaminskiy
(cherry picked from commit 524b00c0da42b129ed8622dfb3f5eab9cc5d6617)

Resolved conflicts:

	crypto/evp/e_des3.c
This commit is contained in:
Andy Polyakov 2013-10-03 10:55:49 +02:00
parent b93916149d
commit eb22b7ec75

View File

@ -101,7 +101,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, static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl) const unsigned char *in, size_t inl)
{ {
if (inl>=EVP_MAXCHUNK) while (inl>=EVP_MAXCHUNK)
{ {
DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK, DES_ede3_ofb64_encrypt(in, out, (long)EVP_MAXCHUNK,
&data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
@ -132,7 +132,7 @@ static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
printf("\n"); printf("\n");
} }
#endif /* KSSL_DEBUG */ #endif /* KSSL_DEBUG */
if (inl>=EVP_MAXCHUNK) while (inl>=EVP_MAXCHUNK)
{ {
DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, DES_ede3_cbc_encrypt(in, out, (long)EVP_MAXCHUNK,
&data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,
@ -151,7 +151,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, static int des_ede_cfb64_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl) const unsigned char *in, size_t inl)
{ {
if (inl>=EVP_MAXCHUNK) while (inl>=EVP_MAXCHUNK)
{ {
DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK, DES_ede3_cfb64_encrypt(in, out, (long)EVP_MAXCHUNK,
&data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3, &data(ctx)->ks1, &data(ctx)->ks2, &data(ctx)->ks3,