Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tvla] Enable passing lists of selected rounds/bytes for byte-specific AES, add new CI job #289

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

vogelpi
Copy link
Collaborator

@vogelpi vogelpi commented Jan 12, 2024

This PR is related to #287 and contains two commits:

  1. Enable passing lists of selected rounds and bytes for the byte-specific AES TLVA
  2. Add a new CI job to exactly test this as well as other byte-specific TVLA functions

@vogelpi vogelpi removed the request for review from andreaskurth January 12, 2024 13:45
Copy link
Member

@nasahlpa nasahlpa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from some small nits, the PR looks good to me :-)

@@ -261,14 +261,14 @@ def run_tvla(ctx: typer.Context):
rnd_list = [0]
byte_list = [0]
else:
if cfg["round_select"] is None:
if not cfg["round_select"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for that change?

In a new PR (#294), I've made exactly the opposite change. If cfg["round_select"] could be None (i.e., the entry is not in the cfg dictionary), then I think the is None check should be better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline, this change is necessary because round_select is now a list instead of an int. To find out if the list is empty (no round_select) specified, we have to use not.

analysis/tvla.py Outdated
@@ -261,14 +261,14 @@ def run_tvla(ctx: typer.Context):
rnd_list = [0]
byte_list = [0]
else:
if cfg["round_select"] is None:
if not cfg["round_select"]:
rnd_list = list(range(11))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to your PR, but maybe we could have a define for this 11 and the 16 below? It would increase the readability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, that's now done!

@@ -261,14 +261,14 @@ def run_tvla(ctx: typer.Context):
rnd_list = [0]
byte_list = [0]
else:
if cfg["round_select"] is None:
if not cfg["round_select"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be best practice:

Suggested change
if not cfg["round_select"]:
if cfg.get("round_select") is not None:

if the key (i.e., round_select) does not exist, the get() returns None.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. As answered above, the not tells us if the list round_select is empty. Previously, we just needed to check if it was defined or not.

Previously, we could only:
- compute all rounds and all bytes
- select individual rounds but all bytes and vice versa
- select one round and one byte

This commit enables passing a list of bytes and rounds. All
combinations of the combined lists are then evaluated, e.g.
--round-select 0 --round-select 1 --byte-select 0 --byte-select 15
will evaluate Bytes 0 and 15 in both Round 0 and Round 1, i.e., there
will be for tests.

This is helps reducing the memory consumption and compute load if only
few rounds or bytes need to be analyzed as well as for CI.

Signed-off-by: Pirmin Vogel <[email protected]>
@vogelpi
Copy link
Collaborator Author

vogelpi commented Jan 16, 2024

Thanks for your review @nasahlpa . I'll merge this once CI passes.

@vogelpi vogelpi merged commit 9f9a3dc into lowRISC:master Jan 16, 2024
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants