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

TestSpeck.ino - Decryption fails for SpeckTiny with all key sizes #76

Open
alve89 opened this issue Mar 7, 2023 · 1 comment
Open

Comments

@alve89
Copy link

alve89 commented Mar 7, 2023

Hi!

I just tried to use your CryptoLW library on both my Arduino Nano and Arduino Uno. I only removed the performance tests, the rest is your origin code in TestSpeck.ino. Decryption fails on both boards for SpeckTiny.

This is the output of all testCipher() calls (identical for Uno and Nano):

State Sizes:
Speck ... 275
SpeckSmall ... 67
SpeckTiny ... 35

Speck Test Vectors:
Speck-128-ECB Encryption ... Passed
Speck-128-ECB Decryption ... Passed
Speck-192-ECB Encryption ... Passed
Speck-192-ECB Decryption ... Passed
Speck-256-ECB Encryption ... Passed
Speck-256-ECB Decryption ... Passed

SpeckSmall Test Vectors:
Speck-128-ECB Encryption ... Passed
Speck-128-ECB Decryption ... Passed
Speck-192-ECB Encryption ... Passed
Speck-192-ECB Decryption ... Passed
Speck-256-ECB Encryption ... Passed
Speck-256-ECB Decryption ... Passed

SpeckTiny Test Vectors:
Speck-128-ECB Encryption ... Passed
Speck-128-ECB Decryption ... Failed
Speck-192-ECB Encryption ... Passed
Speck-192-ECB Decryption ... Failed
Speck-256-ECB Encryption ... Passed
Speck-256-ECB Decryption ... Failed

I'm using the following Arduino IDE:
Version: 2.0.4
Date: 2023-02-27T16:14:28.576Z
CLI Version: 0.31.0

@rweather
Copy link
Owner

rweather commented Mar 7, 2023

That is actually expected. SpeckTiny only implements encryption to keep the memory size as tiny as possible. Use SpeckSmall if you also need decryption. Decryption is stubbed out in the code:

void SpeckTiny::decryptBlock(uint8_t *output, const uint8_t *input)
{
// Decryption is not supported by SpeckTiny. Use SpeckSmall instead.
}

It is weird though because the example should be disabling the decryption tests. I will try to figure out why it isn't.

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

No branches or pull requests

2 participants