diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-14 10:58:15 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-14 10:58:15 +0000 |
commit | e4f8f8907c8d04c54acf7791947295f8d9abf959 (patch) | |
tree | 8a0b7f6180edf0c4e7050a29754e316c3c0b13d0 /test/openssl/test_cipher.rb | |
parent | 04c7fa0f3b96ce7d94c85f2728a53d3984a66937 (diff) | |
download | ruby-e4f8f8907c8d04c54acf7791947295f8d9abf959.tar.gz |
* 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/trunk@43676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/openssl/test_cipher.rb')
-rw-r--r-- | test/openssl/test_cipher.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb index 088dbc140d..156fa2a9c9 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 |