Skip to content

Commit

Permalink
Change HMAC comparison which binds AK-EK to constant-time operation
Browse files Browse the repository at this point in the history
Signed-off-by: Jean Snyman <git@jsnyman.com>
  • Loading branch information
stringlytyped committed Jun 27, 2024
1 parent de282c4 commit a28078f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keylime/models/registrar/registrar_agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import base64
import hmac

import cryptography.x509
from cryptography.hazmat.primitives.asymmetric import ec, rsa
Expand Down Expand Up @@ -315,7 +316,7 @@ def produce_ak_challenge(self):
def verify_ak_response(self, response):
expected_response = crypto.do_hmac(self.key.encode(), self.agent_id)

result = response == expected_response
result = hmac.compare_digest(response, expected_response)

self.change("active", result)
return result
Expand Down

0 comments on commit a28078f

Please sign in to comment.