diff --git a/doc/crypto.dox b/doc/crypto.dox
index d4214d14..97da849f 100644
--- a/doc/crypto.dox
+++ b/doc/crypto.dox
@@ -71,9 +71,9 @@ Ardunino Mega 2560 running at 16 MHz are similar:
Encryption Algorithm | Encryption (per byte) | Decryption (per byte) | Key Setup | State Size (bytes) |
-AES128 (ECB mode) | 36.90us | 66.48us | 160.00us | 213 |
-AES192 (ECB mode) | 44.20us | 80.35us | 166.54us | 245 |
-AES256 (ECB mode) | 51.50us | 94.22us | 227.97us | 277 |
+AES128 (ECB mode) | 33.28us | 63.18us | 160.00us | 181 |
+AES192 (ECB mode) | 39.94us | 76.48us | 166.54us | 213 |
+AES256 (ECB mode) | 46.61us | 89.78us | 227.97us | 245 |
ChaCha (20 rounds) | 14.87us | 14.88us | 43.74us | 132 |
ChaCha (12 rounds) | 10.38us | 10.38us | 43.74us | 132 |
ChaCha (8 rounds) | 8.13us | 8.14us | 43.74us | 132 |
@@ -86,10 +86,10 @@ Ardunino Mega 2560 running at 16 MHz are similar:
|
AEAD Algorithm | Encryption (per byte) | Decryption (per byte) | Key Setup | State Size (bytes) |
ChaChaPoly | 41.23us | 41.23us | 902.55us | 255 |
-GCM<AES128> | 186.47us | 186.42us | 1388.43us | 316 |
-GCM<AES192> | 194.17us | 193.72us | 1628.67us | 348 |
-GCM<AES256> | 201.47us | 201.02us | 1923.78us | 380 |
-EAX<AES128> | 78.37us | 78.37us | 1445.15us | 300 |
+GCM<AES128> | 183.25us | 182.80us | 1272.73us | 284 |
+GCM<AES192> | 189.92us | 189.47us | 1492.60us | 316 |
+GCM<AES256> | 196.59us | 196.13us | 1767.33us | 348 |
+EAX<AES128> | 71.14us | 71.14us | 1329.44us | 268 |
EAX<Speck> (128-bit key) | 26.01us | 26.01us | 735.46us | 362 |
EAX<SpeckLowMemory> (128-bit key) | 75.08us | 75.07us | 1243.66us | 122 |
|
@@ -128,9 +128,9 @@ All figures are for the Arduino Due running at 84 MHz:
Encryption Algorithm | Encryption (per byte) | Decryption (per byte) | Key Setup | State Size (bytes) |
-AES128 (ECB mode) | 6.65us | 11.00us | 35.15us | 220 |
-AES192 (ECB mode) | 8.02us | 13.31us | 36.59us | 252 |
-AES256 (ECB mode) | 9.39us | 15.63 | 50.19us | 284 |
+AES128 (ECB mode) | 5.71us | 10.41us | 34.73us | 188 |
+AES192 (ECB mode) | 6.87us | 12.57us | 36.51us | 220 |
+AES256 (ECB mode) | 8.04us | 14.72 | 49.96us | 252 |
ChaCha (20 rounds) | 0.87us | 0.88us | 4.96us | 136 |
ChaCha (12 rounds) | 0.70us | 0.71us | 4.96us | 136 |
ChaCha (8 rounds) | 0.62us | 0.62us | 4.96us | 136 |
@@ -143,12 +143,12 @@ All figures are for the Arduino Due running at 84 MHz:
|
AEAD Algorithm | Encryption (per byte) | Decryption (per byte) | Key Setup | State Size (bytes) |
ChaChaPoly | 1.66us | 1.66us | 45.02us | 280 |
-GCM<AES128> | 11.01us | 10.92us | 247.90us | 344 |
-GCM<AES192> | 12.40us | 12.31us | 294.07us | 376 |
-GCM<AES256> | 13.73us | 13.64us | 347.40us | 408 |
-EAX<AES128> | 14.17us | 14.17us | 266.56us | 312 |
-EAX<Speck> (128-bit key) | 2.65us | 2.65us | 79.38us | 384 |
-EAX<SpeckLowMemory> (128-bit key) | 6.40us | 6.39us | 108.25us | 122 |
+GCM<AES128> | 10.29us | 10.29us | 223.82us | 312 |
+GCM<AES192> | 11.50us | 11.51us | 265.62us | 344 |
+GCM<AES256> | 12.67us | 12.67us | 313.06us | 376 |
+EAX<AES128> | 12.29us | 12.29us | 236.47us | 280 |
+EAX<Speck> (128-bit key) | 2.65us | 2.65us | 79.46us | 384 |
+EAX<SpeckLowMemory> (128-bit key) | 6.29us | 6.29us | 106.60us | 144 |
|
Hash Algorithm | Hashing (per byte) | Finalization | | State Size (bytes) |
SHA1 | 0.94us | 62.55us | | 112 |
diff --git a/libraries/Crypto/AES.h b/libraries/Crypto/AES.h
index b46b2117..9db65897 100644
--- a/libraries/Crypto/AES.h
+++ b/libraries/Crypto/AES.h
@@ -47,10 +47,6 @@ protected:
void keyScheduleCore(uint8_t *output, const uint8_t *input, uint8_t iteration);
void applySbox(uint8_t *output, const uint8_t *input);
/** @endcond */
-
-private:
- uint8_t state1[16];
- uint8_t state2[16];
};
class AES128 : public AESCommon
diff --git a/libraries/Crypto/AESCommon.cpp b/libraries/Crypto/AESCommon.cpp
index 02a946ba..98fe0511 100644
--- a/libraries/Crypto/AESCommon.cpp
+++ b/libraries/Crypto/AESCommon.cpp
@@ -133,8 +133,6 @@ AESCommon::AESCommon()
*/
AESCommon::~AESCommon()
{
- clean(state1);
- clean(state2);
}
/**
@@ -268,6 +266,8 @@ void AESCommon::encryptBlock(uint8_t *output, const uint8_t *input)
const uint8_t *roundKey = schedule;
uint8_t posn;
uint8_t round;
+ uint8_t state1[16];
+ uint8_t state2[16];
// Copy the input into the state and XOR with the first round key.
for (posn = 0; posn < 16; ++posn)
@@ -297,6 +297,8 @@ void AESCommon::decryptBlock(uint8_t *output, const uint8_t *input)
const uint8_t *roundKey = schedule + rounds * 16;
uint8_t round;
uint8_t posn;
+ uint8_t state1[16];
+ uint8_t state2[16];
// Copy the input into the state and reverse the final round.
for (posn = 0; posn < 16; ++posn)
@@ -324,8 +326,6 @@ void AESCommon::decryptBlock(uint8_t *output, const uint8_t *input)
void AESCommon::clear()
{
clean(schedule, (rounds + 1) * 16);
- clean(state1);
- clean(state2);
}
/** @cond */