mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/openssl/ossl.h: Introduced OSSL_BIO_reset macro for PEM/DER
fallback scenarios. * ext/openssl/ossl_pkey_dsa.c * ext/openssl/ossl_x509req.c * ext/openssl/ossl_pkey_rsa.c * ext/openssl/ossl_pkey_ec.c * ext/openssl/ossl_ssl_session.c * ext/openssl/ossl_x509crl.c * ext/openssl/ossl_pkey.c * ext/openssl/ossl_pkey_dh.c * ext/openssl/ossl_x509cert.c * ext/openssl/ossl_pkcs7.c: Use OSSL_BIO_reset. * ext/openssl/ossl_ssl.c * ext/openssl/ossl_cipher.c * ext/openssl/ossl_pkey_ec.c * ext/openssl/ossl_pkcs12.c * ext/openssl/ossl_ssl_session.c: Replace rb_raise occurences by ossl_raise. This automatically flushes OpenSSL's error queue. * ext/openssl/ossl_pkcs7.c: Raise error if DER fallback for parsing fails. * test/openssl/test_pkey_ec.rb * test/openssl/test_pkey_dsa.rb * test/openssl/test_pkey_rsa.rb: Add assertions that OpenSSL.errors is empty. * test/openssl/test_pkey_rsa.rb: Remove initial OpenSSL.errors call in test_new. [ Ruby 1.9 - Bug #4885 ] [ruby-core:37134] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									41c517d132
								
							
						
					
					
						commit
						26cb830df9
					
				
					 18 changed files with 121 additions and 70 deletions
				
			
		| 
						 | 
				
			
			@ -166,28 +166,24 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
 | 
			
		|||
	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();
 | 
			
		||||
	    OSSL_BIO_reset(in);
 | 
			
		||||
	    dsa = PEM_read_bio_DSA_PUBKEY(in, NULL, NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	if (!dsa) {
 | 
			
		||||
	    (void)BIO_reset(in);
 | 
			
		||||
	    (void)ERR_get_error();
 | 
			
		||||
	    OSSL_BIO_reset(in);
 | 
			
		||||
	    dsa = d2i_DSAPrivateKey_bio(in, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	if (!dsa) {
 | 
			
		||||
	    (void)BIO_reset(in);
 | 
			
		||||
	    (void)ERR_get_error();
 | 
			
		||||
	    OSSL_BIO_reset(in);
 | 
			
		||||
	    dsa = d2i_DSA_PUBKEY_bio(in, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	if (!dsa) {
 | 
			
		||||
	    (void)BIO_reset(in);
 | 
			
		||||
	    (void)ERR_get_error();
 | 
			
		||||
	    OSSL_BIO_reset(in);
 | 
			
		||||
	    dsa = PEM_read_bio_DSAPublicKey(in, NULL, NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	if (!dsa) {
 | 
			
		||||
	    (void)ERR_get_error();
 | 
			
		||||
	    ERR_clear_error();
 | 
			
		||||
	    ossl_raise(eDSAError, "Neither PUB key nor PRIV key:");
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue