summaryrefslogtreecommitdiff
path: root/test/openssl/test_digest.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2020-03-09 18:26:19 +0900
committerKazuki Yamaguchi <k@rhe.jp>2020-03-10 17:41:01 +0900
commite4a26cd4f8e74e5d29de10a3a0ce5829829301b0 (patch)
tree3e2ca67325456a954d6f0f898594453b13119a0d /test/openssl/test_digest.rb
parent61cfd6da84e9cbf02c2e3ff5fae476fec92a1cec (diff)
openssl: sync with upstream repository
Import current master (2c43241dc0ed) of ruby/openssl.git. Below are the commits that were made since the last batch at commit b99775b163ce (ruby/openssl.git commit f49e7110ca1e). Note that some of them have been applied already. ---------------------------------------------------------------- Benoit Daloze (1): Remove redundant and ignored workflow file DBL-Lee (1): add support for SHA512_256/SHA512_224 Hiroshi SHIBATA (2): Guard for OpenSSL::PKey::EC::Group::Error with unsupported platforms Fixed inconsistency directory structure with ruby/ruby repo Jeremy Evans (2): Fix keyword argument separation issues in OpenSSL::SSL::SSLSocket#sys{read,write}_nonblock Remove taint support Kazuki Yamaguchi (26): config: support .include directive random: make OpenSSL::Random.pseudo_bytes alias of .random_bytes extconf.rb: get rid of -Werror=deprecated-declarations test/openssl/test_ssl: skip test_fallback_scsv if necessary ts: simplify OpenSSL::Timestamp::Request#algorithm History.md: add missing references to GitHub issues config: deprecate OpenSSL::Config#add_value and #[]= test/openssl/test_ssl: remove sleep from test_finished_messages test/openssl/test_ssl: fix random failure in SSLSocket.open test test/openssl/test_ssl: avoid explicitly-sized private keys test/openssl/test_ssl: remove commented-out test case test/openssl/test_ssl: allow kRSA tests to fail ssl: avoid declarations after statements engine: revert OpenSSL::Engine.load changes for cloudhsm engine: remove really outdated static engines engine: do not check for ENGINE_load_builtin_engines() engine: fix guards for 'dynamic' and 'cryptodev' engines lib/openssl.rb: require openssl/version.rb x509: add error code and verify flags constants ssl: set verify error code in the case of verify_hostname failure .github/workflows: merge CI jobs into a single workflow .github/workflows: test against different OpenSSL versions .travis.yml: fully migrate to GitHub Actions ssl: suppress test failure with SSLContext#add_certificate_chain_file ssl: remove test case test_puts_meta from test_pair Revert "Use version.rb in gemspec" MSP-Greg (2): .travis.yml - remove 2.3/1.0.2, 2.5/1.1.1, head/1.0.2 Use version.rb in gemspec Samuel Williams (1): Restore compatibility with older versions of Ruby. Yusuke Endoh (1): Make OpenSSL::OSSL#test_memcmp_timing robust
Diffstat (limited to 'test/openssl/test_digest.rb')
-rw-r--r--test/openssl/test_digest.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/openssl/test_digest.rb b/test/openssl/test_digest.rb
index e47fc0a356..0bf66b826a 100644
--- a/test/openssl/test_digest.rb
+++ b/test/openssl/test_digest.rb
@@ -98,6 +98,18 @@ class OpenSSL::TestDigest < OpenSSL::TestCase
assert_equal(sha512_a, encode16(OpenSSL::Digest::SHA512.digest("a")))
end
+ def test_sha512_truncate
+ pend "SHA512_224 is not implemented" unless OpenSSL::Digest.const_defined?(:SHA512_224)
+ sha512_224_a = "d5cdb9ccc769a5121d4175f2bfdd13d6310e0d3d361ea75d82108327"
+ sha512_256_a = "455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8"
+
+ assert_equal(sha512_224_a, OpenSSL::Digest::SHA512_224.hexdigest("a"))
+ assert_equal(sha512_256_a, OpenSSL::Digest::SHA512_256.hexdigest("a"))
+
+ assert_equal(sha512_224_a, encode16(OpenSSL::Digest::SHA512_224.digest("a")))
+ assert_equal(sha512_256_a, encode16(OpenSSL::Digest::SHA512_256.digest("a")))
+ end
+
def test_sha3
pend "SHA3 is not implemented" unless OpenSSL::Digest.const_defined?(:SHA3_224)
s224 = '6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7'