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

Add a compilation flag to enable precomputed lookup tables #3

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

tiod4420
Copy link
Contributor

The PR adds a compilation flag to enable static const lookup tables for AES, which reduces the size of the .data segment.

@tiod4420 tiod4420 requested a review from juh0ng May 31, 2024 06:23
@tiod4420 tiod4420 linked an issue May 31, 2024 that may be closed by this pull request
Copy link
Contributor

@juh0ng juh0ng left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your work!

@@ -330,3 +342,5 @@ void aes_generic_gen_tables(void)
FT3[i] = ROTL8(FT2[i]);

Choose a reason for hiding this comment

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

Since FT1..3 can be trivially calculated from FT0 (it's just a rotate), maybe it's useful to define FT1..3 in terms of FT0 with a #define macro: that way, we save another 3KB from RAM/ROM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, indeed, that's possible, and was almost supported by the code with minor changes.
I added the feature with a compile flag to address this case, it can work in combination with the flag for enabling static const LUT.

@tiod4420 tiod4420 requested a review from juh0ng June 3, 2024 06:21
Copy link
Contributor

@juh0ng juh0ng left a comment

Choose a reason for hiding this comment

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

LGTM!

@tiod4420 tiod4420 merged commit 90005b1 into line:dev Jun 3, 2024
16 checks passed
@tiod4420 tiod4420 deleted the feature/rom_tables branch June 3, 2024 08:31
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.

C implementation uses a lot of memory (for use on a microcontroller)
3 participants