[#35027] [Ruby 1.9-Bug#4352][Open] [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s) — "James M. Lawrence" <redmine@...>

Bug #4352: [patch] Fix eval(s, b) backtrace; make eval(s, b) consistent with eval(s)

16 messages 2011/02/01

[#35114] [Ruby 1.9-Bug#4373][Open] http.rb:677: [BUG] Segmentation fault — Christian Fazzini <redmine@...>

Bug #4373: http.rb:677: [BUG] Segmentation fault

59 messages 2011/02/06

[#35171] [Ruby 1.9-Bug#4386][Open] encoding: directive does not affect regex expressions — mathew murphy <redmine@...>

Bug #4386: encoding: directive does not affect regex expressions

9 messages 2011/02/09

[#35237] [Ruby 1.9-Bug#4400][Open] nested at_exit hooks run in strange order — Suraj Kurapati <redmine@...>

Bug #4400: nested at_exit hooks run in strange order

12 messages 2011/02/15

[ruby-core:35328] [Ruby 1.9-Bug#4422][Open] [ext/openssl] Fix DSA public key PEM encoding

From: Martin Bosslet <redmine@...>
Date: 2011-02-21 23:26:01 UTC
List: ruby-core #35328
Bug #4422: [ext/openssl] Fix DSA public key PEM encoding
http://redmine.ruby-lang.org/issues/show/4422

Author: Martin Bosslet
Status: Open, Priority: Normal
Category: ext, Target version: 1.9.3
ruby -v: ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]

Related to http://redmine.ruby-lang.org/issues/show/4421.

The difference is that DSA already uses the "right" function for DER encoding,
but the "wrong" function (PEM_write_bio_DSAPublicKey instead of 
PEM_write_bio_DSA_PUBKEY) for PEM encoding.

Similar to the RSA case, fallbacks in initialize are also re-prioritized
and again this should cause no trouble because initialize recognizes all
of the formats.

Regards,
Martin


----------------------------------------
http://redmine.ruby-lang.org

Attachments (1)

fix_dsa_pub_encoding.diff (1.05 KB, text/x-diff)
Index: ruby/ext/openssl/ossl_pkey_dsa.c
===================================================================
--- ruby/ext/openssl/ossl_pkey_dsa.c	(revision 30938)
+++ ruby/ext/openssl/ossl_pkey_dsa.c	(working copy)
@@ -162,10 +164,6 @@
 	dsa = PEM_read_bio_DSAPrivateKey(in, NULL, ossl_pem_passwd_cb, passwd);
 	if (!dsa) {
 	    (void)BIO_reset(in);
-	    dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL);
-	}
-	if (!dsa) {
-	    (void)BIO_reset(in);
 	    dsa = PEM_read_bio_DSA_PUBKEY(in, NULL, NULL, NULL);
 	}
 	if (!dsa) {
@@ -176,6 +174,10 @@
 	    (void)BIO_reset(in);
 	    dsa = d2i_DSA_PUBKEY_bio(in, NULL);
 	}
+	if (!dsa) {
+	    (void)BIO_reset(in);
+	    dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL);
+	}
 	BIO_free(in);
 	if (!dsa) ossl_raise(eDSAError, "Neither PUB key nor PRIV key:");
     }
@@ -257,7 +259,7 @@
 	    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);
 	}

In This Thread

Prev Next