Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/openssl/hmac.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ class HMAC
# Securely compare with another HMAC instance in constant time.
def ==(other)
return false unless HMAC === other
return false unless self.digest.bytesize == other.digest.bytesize

OpenSSL.fixed_length_secure_compare(self.digest, other.digest)
self_digest = digest
other_digest = other.digest
return false unless self_digest.bytesize == other_digest.bytesize

OpenSSL.fixed_length_secure_compare(self_digest, other_digest)
end

# :call-seq:
Expand Down