mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Update reference links for Curve25519 and Ed25519
This commit is contained in:
@@ -41,8 +41,8 @@ void printNumber(const char *name, const uint8_t *x)
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// Check the eval() function using the test vectors from:
|
||||
// https://tools.ietf.org/html/draft-turner-thecurve25519function-01
|
||||
// Check the eval() function using the test vectors from
|
||||
// section 6.1 of RFC 7748.
|
||||
void testEval()
|
||||
{
|
||||
static uint8_t alice_private[32] = {
|
||||
|
||||
@@ -41,7 +41,7 @@ struct TestVector
|
||||
};
|
||||
|
||||
// Test vectors for Ed25519 from:
|
||||
// https://tools.ietf.org/id/draft-josefsson-eddsa-ed25519-02.txt
|
||||
// https://tools.ietf.org/html/draft-irtf-cfrg-eddsa-05
|
||||
static TestVector const testVectorEd25519_1 PROGMEM = {
|
||||
.name = "Ed25519 #1",
|
||||
.privateKey = {0x9d, 0x61, 0xb1, 0x9d, 0xef, 0xfd, 0x5a, 0x60,
|
||||
@@ -162,64 +162,10 @@ void testFixedVectors(const struct TestVector *test)
|
||||
|
||||
void testFixedVectors()
|
||||
{
|
||||
//Serial.println("Fixed test vectors:");
|
||||
testFixedVectors(&testVectorEd25519_1);
|
||||
testFixedVectors(&testVectorEd25519_2);
|
||||
}
|
||||
|
||||
/*
|
||||
void testDH()
|
||||
{
|
||||
static uint8_t alice_k[32];
|
||||
static uint8_t alice_f[32];
|
||||
static uint8_t bob_k[32];
|
||||
static uint8_t bob_f[32];
|
||||
|
||||
Serial.println("Diffie-Hellman key exchange:");
|
||||
Serial.print("Generate random k/f for Alice ... ");
|
||||
Serial.flush();
|
||||
unsigned long start = micros();
|
||||
Curve25519::dh1(alice_k, alice_f);
|
||||
unsigned long elapsed = micros() - start;
|
||||
Serial.print("elapsed ");
|
||||
Serial.print(elapsed);
|
||||
Serial.println(" us");
|
||||
|
||||
Serial.print("Generate random k/f for Bob ... ");
|
||||
Serial.flush();
|
||||
start = micros();
|
||||
Curve25519::dh1(bob_k, bob_f);
|
||||
elapsed = micros() - start;
|
||||
Serial.print("elapsed ");
|
||||
Serial.print(elapsed);
|
||||
Serial.println(" us");
|
||||
|
||||
Serial.print("Generate shared secret for Alice ... ");
|
||||
Serial.flush();
|
||||
start = micros();
|
||||
Curve25519::dh2(bob_k, alice_f);
|
||||
elapsed = micros() - start;
|
||||
Serial.print("elapsed ");
|
||||
Serial.print(elapsed);
|
||||
Serial.println(" us");
|
||||
|
||||
Serial.print("Generate shared secret for Bob ... ");
|
||||
Serial.flush();
|
||||
start = micros();
|
||||
Curve25519::dh2(alice_k, bob_f);
|
||||
elapsed = micros() - start;
|
||||
Serial.print("elapsed ");
|
||||
Serial.print(elapsed);
|
||||
Serial.println(" us");
|
||||
|
||||
Serial.print("Check that the shared secrets match ... ");
|
||||
if (memcmp(alice_k, bob_k, 32) == 0)
|
||||
Serial.println("ok");
|
||||
else
|
||||
Serial.println("failed");
|
||||
}
|
||||
*/
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
@@ -232,8 +178,6 @@ void setup()
|
||||
// Perform the tests.
|
||||
testFixedVectors();
|
||||
Serial.println();
|
||||
//testDH();
|
||||
//Serial.println();
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
||||
Reference in New Issue
Block a user