088549
From e4f8f8907c8d04c54acf7791947295f8d9abf959 Mon Sep 17 00:00:00 2001
088549
From: akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
088549
Date: Thu, 14 Nov 2013 10:58:15 +0000
088549
Subject: [PATCH] * test/openssl/test_cipher.rb (test_aes_gcm_wrong_tag): Don't
088549
 use   String#succ because it can make modified (wrong) auth_tag longer   than
088549
 16 bytes.  The longer auth_tag makes that   EVP_CIPHER_CTX_ctrl (and
088549
 internally aes_gcm_ctrl) fail.   [ruby-core:55143] [Bug #8439] reported by
088549
 Vit Ondruch.
088549
088549
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
088549
---
088549
 ChangeLog                   | 8 ++++++++
088549
 test/openssl/test_cipher.rb | 3 ++-
088549
 2 files changed, 10 insertions(+), 1 deletion(-)
088549
088549
diff --git a/ChangeLog b/ChangeLog
088549
index 04f7867..c6beb5a 100644
088549
--- a/ChangeLog
088549
+++ b/ChangeLog
088549
@@ -24,6 +24,14 @@
088549
 	  time to invocation of signal handler from 0.01 sec to 0.2 sec.
088549
 	  RubyCI report error on mswin. reported by @unak
088549
 
088549
+Thu Nov 14 19:53:00 2013  Tanaka Akira  <akr@fsij.org>
088549
+
088549
+	* test/openssl/test_cipher.rb (test_aes_gcm_wrong_tag): Don't use
088549
+	  String#succ because it can make modified (wrong) auth_tag longer
088549
+	  than 16 bytes.  The longer auth_tag makes that
088549
+	  EVP_CIPHER_CTX_ctrl (and internally aes_gcm_ctrl) fail.
088549
+	  [ruby-core:55143] [Bug #8439] reported by Vit Ondruch.
088549
+
088549
 Wed Nov 13 11:57:01 2013  CHIKANAGA Tomoyuki  <nagachika@ruby-lang.org>
088549
 
088549
 	* lib/rubygems: Update to RubyGems 2.0.14. [ruby-core:58300]
088549
diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb
088549
index 088dbc1..156fa2a 100644
088549
--- a/test/openssl/test_cipher.rb
088549
+++ b/test/openssl/test_cipher.rb
088549
@@ -187,7 +187,8 @@ def test_aes_gcm_wrong_tag
088549
       tag = cipher.auth_tag
088549
 
088549
       decipher = new_decryptor('aes-128-gcm', key, iv)
088549
-      decipher.auth_tag = tag[0..-2] << tag[-1].succ
088549
+      tag.setbyte(-1, (tag.getbyte(-1) + 1) & 0xff)
088549
+      decipher.auth_tag = tag
088549
       decipher.auth_data = "aad"
088549
 
088549
       assert_raise OpenSSL::Cipher::CipherError do
088549
-- 
088549
1.8.5.1
088549