summaryrefslogtreecommitdiff
path: root/test/digest
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-15 03:03:31 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-15 03:03:31 +0000
commite56f2abe4b775dcee4690ef43cbac71bbce2a5af (patch)
treeb181d0c7c21cd434bfd6ad4f9cbb5186adf66923 /test/digest
parent0419cfc2ede2b62e38e6fd2baeee06a248477ccd (diff)
* ext/digest/sha2/sha2.c (SHA256_Update, SHA512_Update): avoid Bus
Error caused by unalignment access on Sparc-Solaris (and possibly on other similar environment.) This patch just do memcpy always instead of checking architecture. I see no perf drop on my 64bit env. For more details, see #4320. * test/digest/test_digest.rb: add test for unalignment access. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/digest')
-rwxr-xr-xtest/digest/test_digest.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/digest/test_digest.rb b/test/digest/test_digest.rb
index ac3db00..6611290 100755
--- a/test/digest/test_digest.rb
+++ b/test/digest/test_digest.rb
@@ -78,6 +78,15 @@ module TestDigest
}
end
+ def test_alignment
+ md = self.class::ALGO.new
+ assert_nothing_raised('#4320') {
+ md.update('a' * 97)
+ md.update('a' * 97)
+ md.hexdigest
+ }
+ end
+
class TestMD5 < Test::Unit::TestCase
include TestDigest
ALGO = Digest::MD5