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

Secure boot keys endianness improvements #46

Merged
merged 2 commits into from Oct 31, 2016

Conversation

baruchsiach
Copy link
Contributor

These two commits improve the usability of secure boot with regards to endianness of keys and IV.

Patches were tested on a SAMA5D2 Xplained board.

Secure boot tests on SAMA5D2 indicate that the KEYWRx and IVRx registers are
big-endian. This is documented in paragraph 57.4.1 (AES Register Endianness)
of the SAMA5D2 datasheet (rev. 11267E, 25-Jul-16). Switch endianness of the
values written to these registers. This allows expressing the .config key
values in natural hexadecimal writing, where the left most digit is the most
significant, and the right most is the least significant.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
@wenyouyang wenyouyang merged commit dbe9f0c into linux4sam:master Oct 31, 2016
@wenyouyang
Copy link

Thanks.

Copy link
Contributor

@CyrillePitchen CyrillePitchen left a comment

Choose a reason for hiding this comment

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

It looks good to me.
Just be carefull about the swab32() macro: it will work as expected as long as x is an unsigned int but may l faill with a signed int. Here, it works because both key[i] and iv[i] are unsigned int.

((x) & 0xff000000UL) >> 24 fails with a negative x.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants