Skip to content
Snippets Groups Projects
Unverified Commit 879e0cb1 authored by Koen Zandberg's avatar Koen Zandberg Committed by GitHub
Browse files

Merge pull request #10406 from jcarrano/aes-t-table

sys/crypto: optimize AES footprint (resurrected)
parents 836fe3db 3393dafe
No related branches found
No related tags found
No related merge requests found
...@@ -127,4 +127,9 @@ PSEUDOMODULES += skald_eddystone ...@@ -127,4 +127,9 @@ PSEUDOMODULES += skald_eddystone
# define optimized read function of DS18 driver as a pseudo module # define optimized read function of DS18 driver as a pseudo module
PSEUDOMODULES += ds18_optimized PSEUDOMODULES += ds18_optimized
# By using this pseudomodule, T tables will be precalculated.
PSEUDOMODULES += crypto_aes_precalculated
# This pseudomodule causes a loop in AES to be unrolled (more flash, less CPU)
PSEUDOMODULES += crypto_aes_unroll
# Packages may also add modules to PSEUDOMODULES in their `Makefile.include`. # Packages may also add modules to PSEUDOMODULES in their `Makefile.include`.
This diff is collapsed.
...@@ -47,6 +47,13 @@ ...@@ -47,6 +47,13 @@
* *
* @endcode * @endcode
* *
* Some aspects of the AES implementation can be fine tuned by pseudo-modules:
* * crypto_aes_precalculated: Use pre-calculated T-tables. This improved
* speed at the expense of increased program size. The default is to
* calculate most tables on the fly.
* * crypto_aes_unroll: enable manually-unrolled loops. The default is to not
* have them unrolled.
*
* If you need to encrypt data of arbitrary size take a look at the different * If you need to encrypt data of arbitrary size take a look at the different
* operation modes like: CBC, CTR or CCM. * operation modes like: CBC, CTR or CCM.
* *
......
...@@ -37,9 +37,6 @@ typedef uint32_t u32; ...@@ -37,9 +37,6 @@ typedef uint32_t u32;
typedef uint16_t u16; typedef uint16_t u16;
typedef uint8_t u8; typedef uint8_t u8;
/* This controls loop-unrolling in aes_core.c */
#undef FULL_UNROLL
# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \ # define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \
((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); \ # define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment