From: Matt Caswell Date: Tue, 28 Nov 2017 18:23:51 +0000 (+0000) Subject: Fix the ED448 key lengths X-Git-Tag: OpenSSL_1_1_1-pre2~98 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=22bcc9cb7fbd1433924bd9738cb34f9dfbb35c91;p=oweals%2Fopenssl.git Fix the ED448 key lengths Unlike X448 the key lengths for ED448 are 57 bytes (as opposed to 56) Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/5105) --- diff --git a/crypto/ec/curve448/curve448_lcl.h b/crypto/ec/curve448/curve448_lcl.h index 2228dc88d2..e1b0461a23 100644 --- a/crypto/ec/curve448/curve448_lcl.h +++ b/crypto/ec/curve448/curve448_lcl.h @@ -7,20 +7,20 @@ void X448_public_from_private(uint8_t out_public_value[56], const uint8_t private_key[56]); int ED448_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, - const uint8_t public_key[56], const uint8_t private_key[56], + const uint8_t public_key[57], const uint8_t private_key[57], const uint8_t *context, size_t context_len); int ED448_verify(const uint8_t *message, size_t message_len, - const uint8_t signature[112], const uint8_t public_key[56], + const uint8_t signature[114], const uint8_t public_key[57], const uint8_t *context, size_t context_len); int ED448ph_sign(uint8_t *out_sig, const uint8_t hash[64], - const uint8_t public_key[56], const uint8_t private_key[56], + const uint8_t public_key[57], const uint8_t private_key[57], const uint8_t *context, size_t context_len); -int ED448ph_verify(const uint8_t hash[64], const uint8_t signature[112], - const uint8_t public_key[56], const uint8_t *context, +int ED448ph_verify(const uint8_t hash[64], const uint8_t signature[114], + const uint8_t public_key[57], const uint8_t *context, size_t context_len); -int ED448_public_from_private(uint8_t out_public_key[56], - const uint8_t private_key[56]); +int ED448_public_from_private(uint8_t out_public_key[57], + const uint8_t private_key[57]); diff --git a/crypto/ec/curve448/eddsa.c b/crypto/ec/curve448/eddsa.c index 5aeec24e08..b627d510f8 100644 --- a/crypto/ec/curve448/eddsa.c +++ b/crypto/ec/curve448/eddsa.c @@ -364,7 +364,7 @@ decaf_error_t decaf_ed448_verify_prehash ( } int ED448_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, - const uint8_t public_key[56], const uint8_t private_key[56], + const uint8_t public_key[57], const uint8_t private_key[57], const uint8_t *context, size_t context_len) { @@ -375,7 +375,7 @@ int ED448_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, int ED448_verify(const uint8_t *message, size_t message_len, - const uint8_t signature[112], const uint8_t public_key[56], + const uint8_t signature[114], const uint8_t public_key[57], const uint8_t *context, size_t context_len) { return decaf_ed448_verify(signature, public_key, message, message_len, 0, @@ -383,7 +383,7 @@ int ED448_verify(const uint8_t *message, size_t message_len, } int ED448ph_sign(uint8_t *out_sig, const uint8_t hash[64], - const uint8_t public_key[56], const uint8_t private_key[56], + const uint8_t public_key[57], const uint8_t private_key[57], const uint8_t *context, size_t context_len) { return decaf_ed448_sign_prehash(out_sig, private_key, public_key, hash, @@ -391,16 +391,16 @@ int ED448ph_sign(uint8_t *out_sig, const uint8_t hash[64], } -int ED448ph_verify(const uint8_t hash[64], const uint8_t signature[112], - const uint8_t public_key[56], const uint8_t *context, +int ED448ph_verify(const uint8_t hash[64], const uint8_t signature[114], + const uint8_t public_key[57], const uint8_t *context, size_t context_len) { return decaf_ed448_verify_prehash(signature, public_key, hash, context, context_len) == DECAF_SUCCESS; } -int ED448_public_from_private(uint8_t out_public_key[56], - const uint8_t private_key[56]) +int ED448_public_from_private(uint8_t out_public_key[57], + const uint8_t private_key[57]) { return decaf_ed448_derive_public_key(out_public_key, private_key) == DECAF_SUCCESS;