p5_scrypt.c: fix error check of RAND_bytes() call
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Tue, 17 Apr 2018 06:39:42 +0000 (08:39 +0200)
committerDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Tue, 17 Apr 2018 15:26:25 +0000 (17:26 +0200)
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
(Merged from https://github.com/openssl/openssl/pull/5977)

crypto/asn1/p5_scrypt.c

index c556d017f1dac342e2a47189948973e377139c40..1daaa6f8341bbfc43b32517913cda0faa340060c 100644 (file)
@@ -82,7 +82,7 @@ X509_ALGOR *PKCS5_pbe2_set_scrypt(const EVP_CIPHER *cipher,
     if (EVP_CIPHER_iv_length(cipher)) {
         if (aiv)
             memcpy(iv, aiv, EVP_CIPHER_iv_length(cipher));
-        else if (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) < 0)
+        else if (RAND_bytes(iv, EVP_CIPHER_iv_length(cipher)) <= 0)
             goto err;
     }