1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize):

pop pushed error after each try of reading. fixes #4550

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-04-06 02:44:46 +00:00
parent a63105a45f
commit e61d269f34
2 changed files with 14 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Apr 6 11:36:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/openssl/ossl_pkey_rsa.c (ossl_rsa_initialize):
pop pushed error after each try of reading. fixes #4550
Tue Apr 5 20:33:43 2011 Tanaka Akira <akr@fsij.org>
* include/ruby/encoding.h: parenthesize macro arguments.

View file

@ -158,26 +158,34 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
rsa = PEM_read_bio_RSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd);
if (!rsa) {
(void)BIO_reset(in);
(void)ERR_get_error();
rsa = PEM_read_bio_RSAPublicKey(in, NULL, NULL, NULL);
}
if (!rsa) {
(void)BIO_reset(in);
(void)ERR_get_error();
rsa = PEM_read_bio_RSA_PUBKEY(in, NULL, NULL, NULL);
}
if (!rsa) {
(void)BIO_reset(in);
(void)ERR_get_error();
rsa = d2i_RSAPrivateKey_bio(in, NULL);
}
if (!rsa) {
(void)BIO_reset(in);
(void)ERR_get_error();
rsa = d2i_RSAPublicKey_bio(in, NULL);
}
if (!rsa) {
(void)BIO_reset(in);
(void)ERR_get_error();
rsa = d2i_RSA_PUBKEY_bio(in, NULL);
}
BIO_free(in);
if (!rsa) ossl_raise(eRSAError, "Neither PUB key nor PRIV key:");
if (!rsa) {
(void)ERR_get_error();
ossl_raise(eRSAError, "Neither PUB key nor PRIV key:");
}
}
if (!EVP_PKEY_assign_RSA(pkey, rsa)) {
RSA_free(rsa);