summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authornaruse <naruse@ruby-lang.org>2011-04-06 02:44:46 +0000
committernaruse <naruse@ruby-lang.org>2011-04-06 02:44:46 +0000
commitb2605bb1745694e235467689f8cd97962fa9ce1b (patch)
tree99aa36a387e4f5c55d9baa5ca28c450326ef0085 /ext
parent74760b2d19c2ca41c4768131d462f9185b8fb291 (diff)
downloadruby-openssl-history-b2605bb1745694e235467689f8cd97962fa9ce1b.tar.gz
* 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
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_pkey_rsa.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index 519b1cf..15c1d69 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -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);