diff --git a/ChangeLog b/ChangeLog index 77caf51ac5..3165fa66a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu May 12 08:18:45 2011 Martin Bosslet + + * ext/openssl/ossl_pkey_dsa.c: Use generic X.509 SubjectPublicKeyInfo + format for PEM-encoding DSA public keys. + [ruby-core:35328] [Bug #4422] + Thu May 12 07:27:31 2011 Martin Bosslet * ext/openssl/ossl_pkey_rsa.c: Use generic X.509 SubjectPublicKeyInfo diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index 976e15eeef..3a46866cd7 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -160,11 +160,6 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self) arg = ossl_to_der_if_possible(arg); in = ossl_obj2bio(arg); 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(); @@ -180,6 +175,11 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self) (void)ERR_get_error(); dsa = d2i_DSA_PUBKEY_bio(in, NULL); } + if (!dsa) { + (void)BIO_reset(in); + (void)ERR_get_error(); + dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL); + } BIO_free(in); if (!dsa) { (void)ERR_get_error(); @@ -264,7 +264,7 @@ ossl_dsa_export(int argc, VALUE *argv, VALUE self) ossl_raise(eDSAError, NULL); } } else { - if (!PEM_write_bio_DSAPublicKey(out, pkey->pkey.dsa)) { + if (!PEM_write_bio_DSA_PUBKEY(out, pkey->pkey.dsa)) { BIO_free(out); ossl_raise(eDSAError, NULL); }