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

Make the Crypto examples work for ESP8266

This commit is contained in:
Rhys Weatherley
2018-04-01 15:58:00 +10:00
parent 990ae0ea37
commit 511cd8f77c
15 changed files with 135 additions and 8 deletions

View File

@@ -30,7 +30,11 @@ This example runs tests on the GCM implementation to verify correct behaviour.
#include <SpeckTiny.h>
#include <GCM.h>
#include <string.h>
#if defined(ESP8266)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
// There isn't enough memory to test both AES and Speck on the Uno,
// so disable Speck testing on AVR platforms unless explicitly enabled.
@@ -270,6 +274,8 @@ bool testCipher_N(AuthenticatedCipher *cipher, const struct TestVector *test, si
size_t posn, len;
uint8_t tag[16];
crypto_feed_watchdog();
cipher->clear();
if (!cipher->setKey(test->key, cipher->keySize())) {
Serial.print("setKey ");
@@ -367,6 +373,8 @@ void perfCipherSetKey(AuthenticatedCipher *cipher, const struct TestVector *test
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(TestVector));
test = &testVector;
@@ -392,6 +400,8 @@ void perfCipherEncrypt(AuthenticatedCipher *cipher, const struct TestVector *tes
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(TestVector));
test = &testVector;
@@ -418,6 +428,8 @@ void perfCipherDecrypt(AuthenticatedCipher *cipher, const struct TestVector *tes
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(TestVector));
test = &testVector;
@@ -444,6 +456,8 @@ void perfCipherAddAuthData(AuthenticatedCipher *cipher, const struct TestVector
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(TestVector));
test = &testVector;
@@ -471,6 +485,8 @@ void perfCipherComputeTag(AuthenticatedCipher *cipher, const struct TestVector *
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(TestVector));
test = &testVector;