mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
9199bec9e8
* ext/openssl/extconf.rb: Check if RAND_pseudo_bytes() is usable. It is marked as deprecated in OpenSSL 1.1.0. [ruby-core:75225] [Feature #12324] * ext/openssl/ossl_rand.c: Disable Random.pseudo_bytes if RAND_pseudo_bytes() is unavailable. * test/openssl/test_random.rb: Don't test Random.pseudo_bytes if not defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
15 lines
523 B
Ruby
15 lines
523 B
Ruby
# frozen_string_literal: false
|
|
require_relative "utils"
|
|
|
|
class OpenSSL::TestRandom < OpenSSL::TestCase
|
|
def test_random_bytes
|
|
assert_equal("", OpenSSL::Random.random_bytes(0))
|
|
assert_equal(12, OpenSSL::Random.random_bytes(12).bytesize)
|
|
end
|
|
|
|
def test_pseudo_bytes
|
|
# deprecated as of OpenSSL 1.1.0
|
|
assert_equal("", OpenSSL::Random.pseudo_bytes(0))
|
|
assert_equal(12, OpenSSL::Random.pseudo_bytes(12).bytesize)
|
|
end if OpenSSL::Random.methods.include?(:pseudo_bytes)
|
|
end if defined?(OpenSSL::TestCase)
|