summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-12 07:05:47 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-12 07:05:47 +0000
commit1b056110be0ad56107f9e2daac88d71fc7a8fb58 (patch)
tree9ba0e98b4a50e2e5670c0a4302b684b8dde72912 /test
parent0c44d66162149f92b79610bda159e93557e460df (diff)
merge revision(s) 43676: [Backport #8439]
* test/openssl/test_cipher.rb (test_aes_gcm_wrong_tag): Don't use String#succ because it can make modified (wrong) auth_tag longer than 16 bytes. The longer auth_tag makes that EVP_CIPHER_CTX_ctrl (and internally aes_gcm_ctrl) fail. [ruby-core:55143] [Bug #8439] reported by Vit Ondruch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/openssl/test_cipher.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb
index 15cfb7b302..a883bb4d61 100644
--- a/test/openssl/test_cipher.rb
+++ b/test/openssl/test_cipher.rb
@@ -187,7 +187,8 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
tag = cipher.auth_tag
decipher = new_decryptor('aes-128-gcm', key, iv)
- decipher.auth_tag = tag[0..-2] << tag[-1].succ
+ tag.setbyte(-1, (tag.getbyte(-1) + 1) & 0xff)
+ decipher.auth_tag = tag
decipher.auth_data = "aad"
assert_raise OpenSSL::Cipher::CipherError do