ext/openssl/ossl_x509req.c in openssl-2.0.6 vs ext/openssl/ossl_x509req.c in openssl-2.0.7
- old
+ new
@@ -328,15 +328,14 @@
{
X509_REQ *req;
EVP_PKEY *pkey;
GetX509Req(self, req);
- pkey = GetPKeyPtr(key); /* NO NEED TO DUP */
- if (!X509_REQ_set_pubkey(req, pkey)) {
- ossl_raise(eX509ReqError, NULL);
- }
-
+ pkey = GetPKeyPtr(key);
+ ossl_pkey_check_public_key(pkey);
+ if (!X509_REQ_set_pubkey(req, pkey))
+ ossl_raise(eX509ReqError, "X509_REQ_set_pubkey");
return key;
}
static VALUE
ossl_x509req_sign(VALUE self, VALUE key, VALUE digest)
@@ -363,10 +362,11 @@
{
X509_REQ *req;
EVP_PKEY *pkey;
GetX509Req(self, req);
- pkey = GetPKeyPtr(key); /* NO NEED TO DUP */
+ pkey = GetPKeyPtr(key);
+ ossl_pkey_check_public_key(pkey);
switch (X509_REQ_verify(req, pkey)) {
case 1:
return Qtrue;
case 0:
ossl_clear_error();