Skip to content

Commit

Permalink
No need to keep checking RUBY_ENGINE
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmfernandes committed Jan 17, 2024
1 parent eff2952 commit e12726e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/rack/session/encryptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,17 @@ def set_cipher_key(cipher, key)
cipher.key = key
end

def auth_tag_from(cipher)
if RUBY_ENGINE == 'jruby'
# JRuby's OpenSSL implementation doesn't currently support passing
# an argument to #auth_tag. Here we work around that.
if RUBY_ENGINE == 'jruby'
# JRuby's OpenSSL implementation doesn't currently support passing
# an argument to #auth_tag. Here we work around that.
def auth_tag_from(cipher)
tag = cipher.auth_tag
raise Error, 'the auth tag must be 16 bytes long' if tag.bytesize != 16

tag
else
end
else
def auth_tag_from(cipher)
cipher.auth_tag(16)
end
end
Expand Down

0 comments on commit e12726e

Please sign in to comment.