aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_cipher.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2018-05-12 15:49:42 +0900
committerKazuki Yamaguchi <k@rhe.jp>2018-05-12 15:49:42 +0900
commita72989b72380a4cf5ba3f821969f072f0e71b1d4 (patch)
tree339b5ec8cf0d4b64499de1cdd963e5cff102466e /ext/openssl/ossl_cipher.c
parentb8b8f74e95854a8db793d8189952a51e5af53dea (diff)
parent1f90516e32ecd755d592002585e97cb78752eae2 (diff)
downloadruby-openssl-a72989b72380a4cf5ba3f821969f072f0e71b1d4.tar.gz
Merge branch 'maint-2.0' into maint
* maint-2.0: Ruby/OpenSSL 2.0.8 test/test_ssl_session: set client protocol version explicitly test/test_pkey_rsa: fix test failure with OpenSSL 1.1.1 extconf.rb: fix build with LibreSSL 2.7.0 cipher: validate iterations argument for Cipher#pkcs5_keyivgen test/utils: disable Thread's report_on_exception in start_server
Diffstat (limited to 'ext/openssl/ossl_cipher.c')
-rw-r--r--ext/openssl/ossl_cipher.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 3038a766..0840c84a 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -317,6 +317,8 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self)
salt = (unsigned char *)RSTRING_PTR(vsalt);
}
iter = NIL_P(viter) ? 2048 : NUM2INT(viter);
+ if (iter <= 0)
+ rb_raise(rb_eArgError, "iterations must be a positive integer");
digest = NIL_P(vdigest) ? EVP_md5() : ossl_evp_get_digestbyname(vdigest);
GetCipher(self, ctx);
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt,