[WORKING] Encryption library with Acorn128, Ascon128, Speck

Please do not post requests
Post Reply
MoDu
Posts: 114
Joined: Mon Jul 16, 2018 1:51 pm

[WORKING] Encryption library with Acorn128, Ascon128, Speck

Post by MoDu » Tue Mar 05, 2019 2:29 pm

I was looking for lightweight implementation of a modern cypher for use in our STM32F1, and found a nice C implementation of ALL the modern cyphers being evaluated :)
Acorn128 and Ascon128 authenticated ciphers (finalists in the CAESAR AEAD competition in the light-weight category).
https://github.com/rweather/arduinolibs

The library seems to be working great, but needs some non-common setup for use with the Arduino library model. Simply put, extra folder "Crypto" and "CryptoLW" to libraries folder and you're set.

The competition in question: https://competitions.cr.yp.to/caesar-submissions.html

Performance Tests in Maple Mini @ 72MHz
Ascon128 #4 SetKey ... 49.13us per operation, 20356.23 per second
Ascon128 #4 Encrypt ... 3.41us per byte, 293615.69 bytes per second
Ascon128 #4 Decrypt ... 3.32us per byte, 301369.35 bytes per second
Ascon128 #4 AddAuthData ... 3.32us per byte, 301090.04 bytes per second
Ascon128 #4 ComputeTag ... 50.25us per operation, 19900.89 per second

Acorn128 #4 SetKey ... 167.18us per operation, 5981.47 per second
Acorn128 #4 Encrypt ... 0.75us per byte, 1337541.01 bytes per second
Acorn128 #4 Decrypt ... 0.70us per byte, 1421621.98 bytes per second
Acorn128 #4 AddAuthData ... 0.81us per byte, 1233140.66 bytes per second
Acorn128 #4 ComputeTag ... 120.44us per operation, 8302.54 per second

(SpeckSmall)
Speck-128-ECB Set Key ... 23.92us per operation, 41809.17 per second
Speck-128-ECB Encrypt ... 2.75us per byte, 363160.95 bytes per second
Speck-128-ECB Decrypt ... 2.38us per byte, 419619.30 bytes per second

Speck-192-ECB Set Key ... 24.95us per operation, 40085.78 per second
Speck-192-ECB Encrypt ... 2.84us per byte, 352357.71 bytes per second
Speck-192-ECB Decrypt ... 2.47us per byte, 404860.35 bytes per second

Speck-256-ECB Set Key ... 26.07us per operation, 38355.03 per second
Speck-256-ECB Encrypt ... 2.93us per byte, 341170.30 bytes per second
Speck-256-ECB Decrypt ... 2.56us per byte, 391041.25 bytes per second


MoDu
Posts: 114
Joined: Mon Jul 16, 2018 1:51 pm

Re: [WORKING] Encryption library with Acorn128, Ascon128, Speck

Post by MoDu » Wed Mar 06, 2019 11:11 am

Thanks for the links, as if my reading backlog isn't quite long enough.....

I've given up on AES on micros, it's just "too expensive" for the actual security it brings: key size doesn't scale well with security but it balloons with CPU time/memory, at least on my experience.
I also have some reservations about trying to adapt these monsters cyphers from IEEE, into usable micro controller code, you never know what kind of bugs you're introducing by doing that weird optimization...

Yes, I could use a crippled AES with a short key, but at that point the security is still at a 1990's level. That's why I'm interested in modern cyphers optimized for real world use, which can provide actual security without needing hardware acceleration for being practical.

My tests for (typical )8 byte packet shows it takes ~150 us to encrypt and MAC with Ascon128.

MoDu
Posts: 114
Joined: Mon Jul 16, 2018 1:51 pm

Re: [WORKING] Encryption library with Acorn128, Ascon128, Speck

Post by MoDu » Wed Mar 06, 2019 11:58 am

After further read, seems like the paper authors have the same concerns as I have, and address them quite thouroughly.
(...)we provide the fastest
bitsliced constant-time and masked implementations of AES-128-CTR to
protect against timing attacks, power analysis and other (first-order) sidechannel attacks.

Post Reply