return status;
}
+// Tests that the shared key and secret key buffers of crypto_key_exchange can overlap.
+static int p_key_exchange_overlap()
+{
+ int status = 0;
+ FOR (i, 0, 5) {
+ u8 buf[32];
+ RANDOM_INPUT(sk, 32);
+ RANDOM_INPUT(pk, 32);
+ crypto_key_exchange(buf, sk, pk);
+ crypto_key_exchange(sk, sk, pk);
+ status |= memcmp(buf, sk, 32);
+ }
+ printf("%s: key_exchange (overlaping i/o)\n", status != 0 ? "FAILED" : "OK");
+ return status;
+}
+
static int p_eddsa_roundtrip()
{
#define MESSAGE_SIZE 30
status |= p_hmac_sha512_overlap();
status |= p_argon2i_easy();
status |= p_argon2i_overlap();
+ status |= p_key_exchange_overlap();
status |= p_eddsa_roundtrip();
status |= p_eddsa_random();
status |= p_eddsa_overlap();