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

@@ -31,7 +31,11 @@ This example runs tests on the XTS implementation to verify correct behaviour.
#include <SpeckTiny.h>
#include <XTS.h>
#include <string.h>
#if defined(ESP8266)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
#define MAX_SECTOR_SIZE 64
@@ -207,6 +211,8 @@ void _printProgMem(const char *str)
void testXTS(XTSCommon *cipher, const struct TestVector *test)
{
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(testVector));
Serial.print(testVector.name);
@@ -261,6 +267,8 @@ void perfEncrypt(const char *name, XTSCommon *cipher, const struct TestVector *t
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(testVector));
Serial.print(name);
@@ -288,6 +296,8 @@ void perfDecrypt(const char *name, XTSCommon *cipher, const struct TestVector *t
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(testVector));
Serial.print(name);
@@ -314,6 +324,8 @@ void perfSetKey(const char *name, XTSCommon *cipher, const struct TestVector *te
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(testVector));
Serial.print(name);
@@ -337,6 +349,8 @@ void perfSetTweak(const char *name, XTSCommon *cipher, const struct TestVector *
unsigned long elapsed;
int count;
crypto_feed_watchdog();
memcpy_P(&testVector, test, sizeof(testVector));
Serial.print(name);