From 0bfbd926a0ad688f0a1fa5218c057e8e34b8709e Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Tue, 11 Apr 2023 10:33:42 +0200 Subject: [PATCH] Add EdDSA pk gen to TIS-CI --- tests/tis-ci-gen-config.sh | 1 + tests/tis-ci-vectors.h | 5 ++ tests/tis-ci.c | 20 +++++++ tis.config | 120 +++++++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+) diff --git a/tests/tis-ci-gen-config.sh b/tests/tis-ci-gen-config.sh index 8ad1a59..3b7c318 100755 --- a/tests/tis-ci-gen-config.sh +++ b/tests/tis-ci-gen-config.sh @@ -70,6 +70,7 @@ for entry_point in \ "v_sha512_hkdf" \ "v_argon2" \ "v_edDSA" \ + "v_edDSA_pk" \ "v_ed_25519" \ "v_ed_25519_check" \ "v_elligator_dir" \ diff --git a/tests/tis-ci-vectors.h b/tests/tis-ci-vectors.h index 5e310f5..b3505d7 100644 --- a/tests/tis-ci-vectors.h +++ b/tests/tis-ci-vectors.h @@ -387,6 +387,11 @@ static const char *edDSA_vectors[]={ "0bfa8d629fe89bd9591f20575144f0445958fd3574179ec4a9b6ee85787c23d69b4f009d3ed3bd2bb62226638602b95bc4719a1d2c60afb07ed95c959628ff0c", }; static size_t nb_edDSA_vectors=4; +static const char *edDSA_pk_vectors[]={ + "e4e4c4054fe35a75d9c0f679ad8770d8227e68e4c1e68ce67ee88e6be251a207", + "61435d557c6bedda3b9d652b98982c227ffedb203fc2357cabe8075508f4e6f0", +}; +static size_t nb_edDSA_pk_vectors=2; static const char *ed_25519_vectors[]={ "50831c8cb43cd6822bf3f6fae0801cb6c843d8066b07346635365fb7d6ee54e5", "38bfc0b57ba86490aa2f41a3209e360ea4df055f22c07c7f54326d36780f42f6", diff --git a/tests/tis-ci.c b/tests/tis-ci.c index d1544a7..dda2c78 100644 --- a/tests/tis-ci.c +++ b/tests/tis-ci.c @@ -217,6 +217,23 @@ static void edDSA(vector_reader *reader) crypto_eddsa_sign(out.buf, fat_secret_key, msg.buf, msg.size); } +static void edDSA_pk(vector_reader *reader) +{ + vector in = next_input(reader); + vector out = next_output(reader); + u8 seed [32]; + u8 secret_key[64]; + u8 public_key[32]; + memcpy(seed, in.buf, 32); + crypto_eddsa_key_pair(secret_key, public_key, seed); + memcpy(out.buf, public_key, 32); + + u8 zeroes[32] = {0}; + ASSERT_EQUAL(seed , zeroes , 32); + ASSERT_EQUAL(secret_key , in.buf , 32); + ASSERT_EQUAL(secret_key + 32, public_key, 32); +} + static void ed_25519(vector_reader *reader) { vector secret_k = next_input(reader); @@ -402,6 +419,8 @@ TEST(x25519) //@ ensures \result == 0; TEST(edDSA) //@ ensures \result == 0; +TEST(edDSA_pk) +//@ ensures \result == 0; TEST(ed_25519) //@ ensures \result == 0; TEST(ed_25519_check) @@ -425,6 +444,7 @@ int main(void) { ASSERT(v_argon2 () == 0); ASSERT(v_x25519 () == 0); ASSERT(v_edDSA () == 0); + ASSERT(v_edDSA_pk () == 0); ASSERT(v_ed_25519 () == 0); ASSERT(v_ed_25519_check() == 0); ASSERT(v_elligator_dir () == 0); diff --git a/tis.config b/tis.config index 18c3b92..41ed57b 100644 --- a/tis.config +++ b/tis.config @@ -1440,6 +1440,126 @@ , "no-results" : true , "main" : "v_edDSA" }, +{ "name" : "v_edDSA_pk - sparc_32" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "sparc_32" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - x86_32" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "x86_32" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - x86_16" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "x86_16" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - x86_win64" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "x86_win64" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - armeb_eabi" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "armeb_eabi" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - arm_eabi" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "arm_eabi" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - aarch64" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "aarch64" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - rv64ifdq" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "rv64ifdq" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - mips_64" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "mips_64" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, +{ "name" : "v_edDSA_pk - ppc_64" +, "files" : + [ "src/monocypher.c" + , "src/optional/monocypher-ed25519.c" + , "tests/utils.c" + , "tests/tis-ci.c" + ] +, "cpp-extra-args": "-Isrc -Isrc/optional -Itests" +, "machdep" : "ppc_64" +, "no-results" : true +, "main" : "v_edDSA_pk" +}, { "name" : "v_ed_25519 - sparc_32" , "files" : [ "src/monocypher.c" -- 2.47.3