diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-29 22:49:10 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-29 22:49:10 +0000 |
commit | 61ce01276dc8b2fe7afa85a8d788f7774a451f0a (patch) | |
tree | d9b2cc1ad0bc5472fe324171e2090971b4fe636a /ext | |
parent | 1dd5d8e4f00692b3cdc32f7781e590ac00e70f5e (diff) |
merges r31244 from trunk into ruby_1_9_2.
--
* ext/openssl/ossl_pkey_dh.c (ossl_dh_initialize):
pop pushed error after each try of reading. fixes #4550
* ext/openssl/ossl_pkey_dsa.c (ossl_dsa_initialize): ditto.
* ext/openssl/ossl_pkey_ec.c (ossl_ec_initialize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/openssl/ossl_pkey_dh.c | 6 | ||||
-rw-r--r-- | ext/openssl/ossl_pkey_dsa.c | 9 | ||||
-rw-r--r-- | ext/openssl/ossl_pkey_ec.c | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c index 97535db368..756ce6620c 100644 --- a/ext/openssl/ossl_pkey_dh.c +++ b/ext/openssl/ossl_pkey_dh.c @@ -170,10 +170,14 @@ ossl_dh_initialize(int argc, VALUE *argv, VALUE self) dh = PEM_read_bio_DHparams(in, NULL, NULL, NULL); if (!dh){ (void)BIO_reset(in); + (void)ERR_get_error(); dh = d2i_DHparams_bio(in, NULL); } BIO_free(in); - if (!dh) ossl_raise(eDHError, NULL); + if (!dh) { + (void)ERR_get_error(); + ossl_raise(eDHError, NULL); + } } if (!EVP_PKEY_assign_DH(pkey, dh)) { DH_free(dh); diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index a6e7f8dc43..f87238a13c 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -162,22 +162,29 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self) dsa = PEM_read_bio_DSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd); if (!dsa) { (void)BIO_reset(in); + (void)ERR_get_error(); dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL); } if (!dsa) { (void)BIO_reset(in); + (void)ERR_get_error(); dsa = PEM_read_bio_DSA_PUBKEY(in, NULL, NULL, NULL); } if (!dsa) { (void)BIO_reset(in); + (void)ERR_get_error(); dsa = d2i_DSAPrivateKey_bio(in, NULL); } if (!dsa) { (void)BIO_reset(in); + (void)ERR_get_error(); dsa = d2i_DSA_PUBKEY_bio(in, NULL); } BIO_free(in); - if (!dsa) ossl_raise(eDSAError, "Neither PUB key nor PRIV key:"); + if (!dsa) { + (void)ERR_get_error(); + ossl_raise(eDSAError, "Neither PUB key nor PRIV key:"); + } } if (!EVP_PKEY_assign_DSA(pkey, dsa)) { DSA_free(dsa); diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index df23fba3af..18bcaa873c 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -187,14 +187,17 @@ static VALUE ossl_ec_key_initialize(int argc, VALUE *argv, VALUE self) ec = PEM_read_bio_ECPrivateKey(in, NULL, NULL, NULL); if (!ec) { (void)BIO_reset(in); + (void)ERR_get_error(); ec = PEM_read_bio_EC_PUBKEY(in, NULL, NULL, NULL); } if (!ec) { (void)BIO_reset(in); + (void)ERR_get_error(); ec = d2i_ECPrivateKey_bio(in, NULL); } if (!ec) { (void)BIO_reset(in); + (void)ERR_get_error(); ec = d2i_EC_PUBKEY_bio(in, NULL); } @@ -204,6 +207,7 @@ static VALUE ossl_ec_key_initialize(int argc, VALUE *argv, VALUE self) const char *name = StringValueCStr(arg); int nid = OBJ_sn2nid(name); + (void)ERR_get_error(); if (nid == NID_undef) ossl_raise(eECError, "unknown curve name (%s)\n", name); |