From: "akr (Akira Tanaka)" Date: 2013-11-07T01:20:04+09:00 Subject: [ruby-core:58204] [ruby-trunk - Bug #8439] test_aes_gcm_wrong_tag(OpenSSL::TestCipher) fails randomly Issue #8439 has been updated by akr (Akira Tanaka). I tracked down the random failure. It seems that the failure occur when tag[-1].succ is 2byte. I.e. it fails when tag[-1] is "9", "Z", "z" or "\xFF". I modified test_aes_gcm_wrong_tag as follows: Index: test_cipher.rb =================================================================== --- test_cipher.rb (revision 43555) +++ test_cipher.rb (working copy) @@ -187,6 +187,7 @@ class OpenSSL::TestCipher < Test::Unit:: tag = cipher.auth_tag decipher = new_decryptor('aes-128-gcm', key, iv) + p [tag[-1], tag[-1].succ] decipher.auth_tag = tag[0..-2] << tag[-1].succ decipher.auth_data = "aad" When the test fails, ["9", "10"], ["Z", "AA"], ["z", "aa"] or ["\xFF", "\x01\x00"] are shown. Assuming tag[-1] is a random byte, I guess the test fails once per 64 times on average because 4/256=1/64. I'm not sure the intent of tag[-1].succ, though. ---------------------------------------- Bug #8439: test_aes_gcm_wrong_tag(OpenSSL::TestCipher) fails randomly https://bugs.ruby-lang.org/issues/8439#change-42785 Author: vo.x (Vit Ondruch) Status: Assigned Priority: Normal Assignee: MartinBosslet (Martin Bosslet) Category: ext Target version: current: 2.1.0 ruby -v: ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN =begin 7) Error: test_aes_gcm_wrong_tag(OpenSSL::TestCipher): OpenSSL::Cipher::CipherError: unable to set GCM tag /builddir/build/BUILD/ruby-2.0.0-p195/test/openssl/test_cipher.rb:190:in `auth_tag=' /builddir/build/BUILD/ruby-2.0.0-p195/test/openssl/test_cipher.rb:190:in `test_aes_gcm_wrong_tag' I am building ruby against openssl-1.0.1e-8.el7.x86_64 =end -- http://bugs.ruby-lang.org/