diff --git a/libraries/Crypto/Curve25519.cpp b/libraries/Crypto/Curve25519.cpp
index a81989ed..424df38c 100644
--- a/libraries/Crypto/Curve25519.cpp
+++ b/libraries/Crypto/Curve25519.cpp
@@ -35,8 +35,8 @@
* stack space to store intermediate results while the curve function is
* being evaluated. About 1k of free stack space is recommended for safety.
*
- * References: http://cr.yp.to/ecdh.html
- * https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
+ * References: http://cr.yp.to/ecdh.html,
+ * RFC 7748
*
* \sa Ed25519
*/
@@ -72,7 +72,7 @@
* \return Returns true if the function was evaluated; false if \a x is
* not a proper member of the field modulo (2^255 - 19).
*
- * Reference: https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
+ * Reference: RFC 7748
*
* \sa dh1(), dh2()
*/
@@ -237,7 +237,7 @@ bool Curve25519::eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[3
* ...
* \endcode
*
- * Reference: https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
+ * Reference: RFC 7748
*
* \sa dh2()
*/
@@ -275,7 +275,7 @@ void Curve25519::dh1(uint8_t k[32], uint8_t f[32])
* \return Returns true if the key exchange was successful, or false if
* the \a k value is invalid.
*
- * Reference: https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
+ * Reference: RFC 7748
*
* \sa dh1()
*/
@@ -1319,7 +1319,7 @@ void Curve25519::cswap(limb_t select, limb_t *x, limb_t *y)
--sel;
// Swap the two values based on "select". Algorithm from:
- // https://tools.ietf.org/html/draft-irtf-cfrg-curves-02
+ // http://tools.ietf.org/html/rfc7748
for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
dummy = sel & (x[posn] ^ y[posn]);
x[posn] ^= dummy;
@@ -1577,8 +1577,7 @@ bool Curve25519::sqrt(limb_t *result, const limb_t *x)
};
limb_t y[NUM_LIMBS_256BIT];
- // Algorithm from:
- // https://tools.ietf.org/id/draft-josefsson-eddsa-ed25519-02.txt
+ // Algorithm from: http://tools.ietf.org/html/rfc7748
// Compute a candidate root: result = x^((p + 3) / 8) mod p.
// (p + 3) / 8 = (2^252 - 2) which is 251 one bits followed by a zero:
diff --git a/libraries/Crypto/Ed25519.cpp b/libraries/Crypto/Ed25519.cpp
index a62a3e08..5732e73b 100644
--- a/libraries/Crypto/Ed25519.cpp
+++ b/libraries/Crypto/Ed25519.cpp
@@ -68,7 +68,7 @@
* stack space to store intermediate results while the curve function is
* being evaluated. About 1.5k of free stack space is recommended for safety.
*
- * References: https://tools.ietf.org/id/draft-josefsson-eddsa-ed25519-02.txt
+ * References: https://tools.ietf.org/html/draft-irtf-cfrg-eddsa-05
*
* \sa Curve25519
*/
diff --git a/libraries/Crypto/examples/TestCurve25519/TestCurve25519.ino b/libraries/Crypto/examples/TestCurve25519/TestCurve25519.ino
index 5ebc97e7..51ca1798 100644
--- a/libraries/Crypto/examples/TestCurve25519/TestCurve25519.ino
+++ b/libraries/Crypto/examples/TestCurve25519/TestCurve25519.ino
@@ -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] = {
diff --git a/libraries/Crypto/examples/TestEd25519/TestEd25519.ino b/libraries/Crypto/examples/TestEd25519/TestEd25519.ino
index 30e219d7..ec08bcb1 100644
--- a/libraries/Crypto/examples/TestEd25519/TestEd25519.ino
+++ b/libraries/Crypto/examples/TestEd25519/TestEd25519.ino
@@ -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()