1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

CTR block cipher mode

This commit is contained in:
Rhys Weatherley
2014-12-31 09:59:52 +10:00
parent 5e816c418b
commit 46fe4e52fd
6 changed files with 530 additions and 8 deletions

View File

@@ -36,9 +36,9 @@ struct TestVector
byte ciphertext[16];
};
// Define the test vectors from the FIPS specification.
// Define the ECB test vectors from the FIPS specification.
static TestVector const testVectorAES128 = {
.name = "AES-128",
.name = "AES-128-ECB",
.key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
.plaintext = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
@@ -47,7 +47,7 @@ static TestVector const testVectorAES128 = {
0xD8, 0xCD, 0xB7, 0x80, 0x70, 0xB4, 0xC5, 0x5A}
};
static TestVector const testVectorAES192 = {
.name = "AES-192",
.name = "AES-192-ECB",
.key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17},
@@ -57,7 +57,7 @@ static TestVector const testVectorAES192 = {
0x6E, 0xAF, 0x70, 0xA0, 0xEC, 0x0D, 0x71, 0x91}
};
static TestVector const testVectorAES256 = {
.name = "AES-256",
.name = "AES-256-ECB",
.key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -139,7 +139,8 @@ void perfCipher(BlockCipher *cipher, const struct TestVector *test)
Serial.println();
}
void setup() {
void setup()
{
Serial.begin(9600);
Serial.println();
@@ -157,5 +158,6 @@ void setup() {
perfCipher(&aes256, &testVectorAES256);
}
void loop() {
void loop()
{
}