diff options
author | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-24 16:26:22 +0000 |
---|---|---|
committer | rhe <rhe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-24 16:26:22 +0000 |
commit | 4b76fa4bb86d50babc99864216cc46b18713d6af (patch) | |
tree | eb0d6c1a2db76e67f146af950c3180dad15487f9 /test/openssl/test_engine.rb | |
parent | 3e2a2a7aaae0af2c42e20202019c0a3e02a819b1 (diff) | |
download | ruby-4b76fa4bb86d50babc99864216cc46b18713d6af.tar.gz |
openssl: import e72d960db262
Sync with master branch of ruby/openssl.git to import changes in
v2.1.0.beta1..v2.0.6. The commit log since v2.1.0.beta1 which was
imported by r59734 can be found at:
https://github.com/ruby/openssl/compare/v2.1.0.beta1...e72d960db262
----------------------------------------------------------------
Kazuki Yamaguchi (16):
test/test_pair: fix test_write_nonblock{,_no_exceptions}
x509name: fix a typo in docs
test/test_fips: skip if setting FIPS mode fails
test/test_asn1: fix possible failure in test_utctime
test/test_ssl: suppress warning in test_alpn_protocol_selection_cancel
test/test_pair: disable compression
test/test_ssl: skip tmp_ecdh_callback test for LibreSSL >= 2.6.1
test/test_ssl: do not run NPN tests for LibreSSL >= 2.6.1
tool/ruby-openssl-docker: update
test/test_pair: replace sleep with IO.select
ssl: prevent SSLSocket#sysread* from leaking uninitialized data
ossl.c: use struct CRYPTO_dynlock_value for non-dynamic locks
ossl.c: make legacy locking callbacks reentrant
test/test_engine: suppress stderr
test/test_engine: check if RC4 is supported
Ruby/OpenSSL 2.0.6
SHIBATA Hiroshi (1):
To use upstream url of github
nobu (1):
ruby.h: unnormalized Fixnum value
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl/test_engine.rb')
-rw-r--r-- | test/openssl/test_engine.rb | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/test/openssl/test_engine.rb b/test/openssl/test_engine.rb index 4f3973a7c6..bb1123d516 100644 --- a/test/openssl/test_engine.rb +++ b/test/openssl/test_engine.rb @@ -52,32 +52,28 @@ class OpenSSL::TestEngine < OpenSSL::TestCase end def test_openssl_engine_cipher_rc4 - with_openssl <<-'end;' - begin - engine = get_engine - algo = "RC4" #AES is not supported by openssl Engine (<=1.0.0e) - data = "a" * 1000 - key = OpenSSL::Random.random_bytes(16) - # suppress message from openssl Engine's RC4 cipher [ruby-core:41026] - err_back = $stderr.dup - $stderr.reopen(IO::NULL) - encrypted = crypt_data(data, key, :encrypt) { engine.cipher(algo) } - decrypted = crypt_data(encrypted, key, :decrypt) { OpenSSL::Cipher.new(algo) } - assert_equal(data, decrypted) - ensure - if err_back - $stderr.reopen(err_back) - err_back.close - end - end + begin + OpenSSL::Cipher.new("rc4") + rescue OpenSSL::Cipher::CipherError + pend "RC4 is not supported" + end + + with_openssl(<<-'end;', ignore_stderr: true) + engine = get_engine + algo = "RC4" + data = "a" * 1000 + key = OpenSSL::Random.random_bytes(16) + encrypted = crypt_data(data, key, :encrypt) { engine.cipher(algo) } + decrypted = crypt_data(encrypted, key, :decrypt) { OpenSSL::Cipher.new(algo) } + assert_equal(data, decrypted) end; end private # this is required because OpenSSL::Engine methods change global state - def with_openssl(code) - assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;") + def with_openssl(code, **opts) + assert_separately([{ "OSSL_MDEBUG" => nil }, "-ropenssl"], <<~"end;", **opts) require #{__FILE__.dump} include OpenSSL::TestEngine::Utils #{code} |