Fix PKCS#8 on 32-bit systems.

The previous commit fixed a signed/unsigned warning but, on 32-bit
systems, long is only 32 bits, so the fix was incorrect there.

Change-Id: I6afe340164de0e176c7f710fcdd095b2a4cddee4
This commit is contained in:
Adam Langley 2015-10-27 16:18:51 -07:00
parent 13f1dd497f
commit de659cdc2e

View File

@ -356,7 +356,8 @@ static int PKCS5_v2_PBKDF2_keyivgen(EVP_CIPHER_CTX *ctx,
goto err;
}
long iterations = ASN1_INTEGER_get(pbkdf2param->iter);
if (iterations <= 0 || iterations > (long) UINT_MAX) {
if (iterations <= 0 ||
(sizeof(long) > sizeof(unsigned) && iterations > (long)UINT_MAX)) {
OPENSSL_PUT_ERROR(PKCS8, PKCS8_R_BAD_ITERATION_COUNT);
goto err;
}