From e5351b1b0ac93758d7f6e41a78b7117a907d382c Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Wed, 1 Mar 2023 20:48:22 +0100 Subject: [PATCH] Fix Ed25519 secret_key size All EdDSA and Ed25519 secret keys are 64 bytes of course. Fortunately this does not affect the generated code. Fixes #258 --- doc/crypto_ed25519_sign.3monocypher | 4 ++-- src/optional/monocypher-ed25519.c | 4 ++-- src/optional/monocypher-ed25519.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/crypto_ed25519_sign.3monocypher b/doc/crypto_ed25519_sign.3monocypher index db83fbf..6418c94 100644 --- a/doc/crypto_ed25519_sign.3monocypher +++ b/doc/crypto_ed25519_sign.3monocypher @@ -49,7 +49,7 @@ .\" with this software. If not, see .\" .\" -.Dd February 25, 2022 +.Dd March 01, 2022 .Dt CRYPTO_ED25519_SIGN 3MONOCYPHER .Os .Sh NAME @@ -84,7 +84,7 @@ .Ft void .Fo crypto_ed25519_ph_sign .Fa "uint8_t signature[64]" -.Fa "const uint8_t secret_key[32]" +.Fa "const uint8_t secret_key[64]" .Fa "const uint8_t message_hash[64]" .Fc .Ft int diff --git a/src/optional/monocypher-ed25519.c b/src/optional/monocypher-ed25519.c index b76503a..5e4dcdf 100644 --- a/src/optional/monocypher-ed25519.c +++ b/src/optional/monocypher-ed25519.c @@ -463,7 +463,7 @@ static void ed25519_dom_sign(u8 signature [64], const u8 secret_key[32], WIPE_BUFFER(r); } -void crypto_ed25519_sign(u8 signature [64], const u8 secret_key[32], +void crypto_ed25519_sign(u8 signature [64], const u8 secret_key[64], const u8 *message, size_t message_size) { ed25519_dom_sign(signature, secret_key, 0, 0, message, message_size); @@ -479,7 +479,7 @@ int crypto_ed25519_check(const u8 signature[64], const u8 public_key[32], static const u8 domain[34] = "SigEd25519 no Ed25519 collisions\1"; -void crypto_ed25519_ph_sign(uint8_t signature[64], const uint8_t secret_key[32], +void crypto_ed25519_ph_sign(uint8_t signature[64], const uint8_t secret_key[64], const uint8_t message_hash[64]) { ed25519_dom_sign(signature, secret_key, domain, sizeof(domain), diff --git a/src/optional/monocypher-ed25519.h b/src/optional/monocypher-ed25519.h index 9334a89..d7aa004 100644 --- a/src/optional/monocypher-ed25519.h +++ b/src/optional/monocypher-ed25519.h @@ -119,7 +119,7 @@ void crypto_ed25519_key_pair(uint8_t secret_key[64], uint8_t public_key[32], uint8_t seed[32]); void crypto_ed25519_sign(uint8_t signature [64], - const uint8_t secret_key[32], + const uint8_t secret_key[64], const uint8_t *message, size_t message_size); int crypto_ed25519_check(const uint8_t signature [64], const uint8_t public_key[32], @@ -127,7 +127,7 @@ int crypto_ed25519_check(const uint8_t signature [64], // Pre-hash variants void crypto_ed25519_ph_sign(uint8_t signature [64], - const uint8_t secret_key [32], + const uint8_t secret_key [64], const uint8_t message_hash[64]); int crypto_ed25519_ph_check(const uint8_t signature [64], const uint8_t public_key [32], -- 2.47.3