Skip to content

Commit

Permalink
[fi] Adapt crypto fi commands
Browse files Browse the repository at this point in the history
This commit renames the crypto_fi_* commands to crypto_* in order to be
consistent with the other (Ibex, OTBN) tests.

Signed-off-by: Pascal Nasahl <[email protected]>
  • Loading branch information
nasahlpa committed May 24, 2024
1 parent c35dd0a commit f1b1a62
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions fault_injection/configs/pen.global_fi.crypto.aes.cw310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ fiproject:
plot_y_axis: "glitch_width"
plot_y_axis_legend: "[cycles]"
test:
# which_test: "crypto_fi_aes_key"
# which_test: "crypto_fi_aes_plaintext"
which_test: "crypto_fi_aes_encrypt"
# which_test: "crypto_aes_key"
# which_test: "crypto_aes_plaintext"
which_test: "crypto_aes_encrypt"
# which_test: "crypto_fi_aes_ciphertext"
expected_result: '{"ciphertext":[141,145,88,155,234,129,16,92,221,12,69,21,69,208,99,12],"alerts":0,"err_status":0}'
# Set to true if the test should ignore alerts returned by the test. As the
Expand Down
6 changes: 3 additions & 3 deletions fault_injection/configs/pen.global_fi.crypto.kmac.cw310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ fiproject:
plot_y_axis: "glitch_width"
plot_y_axis_legend: "[cycles]"
test:
# which_test: "crypto_fi_kmac_key"
which_test: "crypto_fi_kmac_absorb"
# which_test: "crypto_fi_kmac_squeeze"
# which_test: "crypto_kmac_key"
which_test: "crypto_kmac_absorb"
# which_test: "crypto_kmac_squeeze"
expected_result: '{"ciphertext":[184,34,91,108,231,47,251,27],"alerts":0,"err_status":0}'
# Set to true if the test should ignore alerts returned by the test. As the
# alert handler on the device could sometime fire alerts that are not
Expand Down
32 changes: 16 additions & 16 deletions target/communication/fi_crypto_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OTFICrypto:
def __init__(self, target) -> None:
self.target = target

def _ujson_crypto_fi_cmd(self) -> None:
def _ujson_crypto_cmd(self) -> None:
time.sleep(0.01)
self.target.write(json.dumps("CryptoFi").encode("ascii"))
time.sleep(0.01)
Expand All @@ -25,18 +25,18 @@ def init(self) -> None:
The device ID of the device.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Init command.
time.sleep(0.01)
self.target.write(json.dumps("Init").encode("ascii"))
# Read back device ID from device.
return self.read_response(max_tries=30)

def crypto_fi_aes_key(self) -> None:
def crypto_aes_key(self) -> None:
""" Starts the crypto.fi.aes_key test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Aes command.
time.sleep(0.01)
self.target.write(json.dumps("Aes").encode("ascii"))
Expand All @@ -46,11 +46,11 @@ def crypto_fi_aes_key(self) -> None:
"encrypt_trigger": False, "ciphertext_trigger": False}
self.target.write(json.dumps(mode).encode("ascii"))

def crypto_fi_aes_plaintext(self) -> None:
def crypto_aes_plaintext(self) -> None:
""" Starts the crypto.fi.aes_plaintext test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Aes command.
time.sleep(0.01)
self.target.write(json.dumps("Aes").encode("ascii"))
Expand All @@ -60,11 +60,11 @@ def crypto_fi_aes_plaintext(self) -> None:
"encrypt_trigger": False, "ciphertext_trigger": False}
self.target.write(json.dumps(mode).encode("ascii"))

def crypto_fi_aes_encrypt(self) -> None:
def crypto_aes_encrypt(self) -> None:
""" Starts the crypto.fi.aes_encrypt test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Aes command.
time.sleep(0.01)
self.target.write(json.dumps("Aes").encode("ascii"))
Expand All @@ -74,11 +74,11 @@ def crypto_fi_aes_encrypt(self) -> None:
"encrypt_trigger": True, "ciphertext_trigger": False}
self.target.write(json.dumps(mode).encode("ascii"))

def crypto_fi_aes_ciphertext(self) -> None:
def crypto_aes_ciphertext(self) -> None:
""" Starts the crypto.fi.aes_ciphertext test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Aes command.
time.sleep(0.01)
self.target.write(json.dumps("Aes").encode("ascii"))
Expand All @@ -88,11 +88,11 @@ def crypto_fi_aes_ciphertext(self) -> None:
"encrypt_trigger": False, "ciphertext_trigger": True}
self.target.write(json.dumps(mode).encode("ascii"))

def crypto_fi_kmac_key(self) -> None:
def crypto_kmac_key(self) -> None:
""" Starts the crypto.fi.kmac_key test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Kmac command.
time.sleep(0.01)
self.target.write(json.dumps("Kmac").encode("ascii"))
Expand All @@ -102,11 +102,11 @@ def crypto_fi_kmac_key(self) -> None:
"squeeze_trigger": False}
self.target.write(json.dumps(mode).encode("ascii"))

def crypto_fi_kmac_absorb(self) -> None:
def crypto_kmac_absorb(self) -> None:
""" Starts the crypto.fi.kmac_absorb test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Kmac command.
time.sleep(0.01)
self.target.write(json.dumps("Kmac").encode("ascii"))
Expand All @@ -116,11 +116,11 @@ def crypto_fi_kmac_absorb(self) -> None:
"squeeze_trigger": False}
self.target.write(json.dumps(mode).encode("ascii"))

def crypto_fi_kmac_squeeze(self) -> None:
def crypto_kmac_squeeze(self) -> None:
""" Starts the crypto.fi.kmac_squeeze test.
"""
# CryptoFi command.
self._ujson_crypto_fi_cmd()
self._ujson_crypto_cmd()
# Kmac command.
time.sleep(0.01)
self.target.write(json.dumps("Kmac").encode("ascii"))
Expand Down

0 comments on commit f1b1a62

Please sign in to comment.