diff options
-rw-r--r-- | crypto/err/openssl.txt | 2 | ||||
-rw-r--r-- | crypto/evp/signature.c | 21 | ||||
-rw-r--r-- | doc/man7/EVP_SIGNATURE-ED25519.pod | 28 | ||||
-rw-r--r-- | include/openssl/proverr.h | 2 | ||||
-rw-r--r-- | providers/common/provider_err.c | 168 | ||||
-rw-r--r-- | providers/defltprov.c | 3 | ||||
-rw-r--r-- | providers/fips/fipsprov.c | 9 | ||||
-rw-r--r-- | providers/implementations/include/prov/implementations.h | 3 | ||||
-rw-r--r-- | providers/implementations/include/prov/names.h | 6 | ||||
-rw-r--r-- | providers/implementations/signature/eddsa_sig.c | 527 | ||||
-rw-r--r-- | test/recipes/30-test_evp.t | 1 | ||||
-rw-r--r-- | test/recipes/30-test_evp_data/evppkey_ecx_sigalg.txt | 674 |
12 files changed, 1232 insertions, 212 deletions
diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt index 007db19b76..2aea0d2186 100644 --- a/crypto/err/openssl.txt +++ b/crypto/err/openssl.txt @@ -1084,6 +1084,7 @@ PROV_R_INVALID_MGF1_MD:167:invalid mgf1 md PROV_R_INVALID_MODE:125:invalid mode PROV_R_INVALID_OUTPUT_LENGTH:217:invalid output length PROV_R_INVALID_PADDING_MODE:168:invalid padding mode +PROV_R_INVALID_PREHASHED_DIGEST_LENGTH:241:invalid prehashed digest length PROV_R_INVALID_PUBINFO:198:invalid pubinfo PROV_R_INVALID_SALT_LENGTH:112:invalid salt length PROV_R_INVALID_SEED_LENGTH:154:invalid seed length @@ -1121,6 +1122,7 @@ PROV_R_NOT_INSTANTIATED:193:not instantiated PROV_R_NOT_PARAMETERS:226:not parameters PROV_R_NOT_SUPPORTED:136:not supported PROV_R_NOT_XOF_OR_INVALID_LENGTH:113:not xof or invalid length +PROV_R_NO_INSTANCE_ALLOWED:242:no instance allowed PROV_R_NO_KEY_SET:114:no key set PROV_R_NO_PARAMETERS_SET:177:no parameters set PROV_R_ONESHOT_CALL_OUT_OF_ORDER:239:oneshot call out of order diff --git a/crypto/evp/signature.c b/crypto/evp/signature.c index 33910e5bc3..7d619edfae 100644 --- a/crypto/evp/signature.c +++ b/crypto/evp/signature.c @@ -48,8 +48,6 @@ static void *evp_signature_from_algorithm(int name_id, int ctxfncnt = 0; /* Counts all init functions */ int initfncnt = 0; - /* Counts all performance functions (oneshot / update / final) */ - int fncnt = 0; /* Counts all parameter functions */ int gparamfncnt = 0, sparamfncnt = 0, gmdparamfncnt = 0, smdparamfncnt = 0; int valid = 0; @@ -82,7 +80,6 @@ static void *evp_signature_from_algorithm(int name_id, if (signature->sign != NULL) break; signature->sign = OSSL_FUNC_signature_sign(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_INIT: if (signature->sign_message_init != NULL) @@ -96,14 +93,12 @@ static void *evp_signature_from_algorithm(int name_id, break; signature->sign_message_update = OSSL_FUNC_signature_sign_message_update(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_FINAL: if (signature->sign_message_final != NULL) break; signature->sign_message_final = OSSL_FUNC_signature_sign_message_final(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_VERIFY_INIT: if (signature->verify_init != NULL) @@ -115,7 +110,6 @@ static void *evp_signature_from_algorithm(int name_id, if (signature->verify != NULL) break; signature->verify = OSSL_FUNC_signature_verify(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_INIT: if (signature->verify_message_init != NULL) @@ -129,14 +123,12 @@ static void *evp_signature_from_algorithm(int name_id, break; signature->verify_message_update = OSSL_FUNC_signature_verify_message_update(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_FINAL: if (signature->verify_message_final != NULL) break; signature->verify_message_final = OSSL_FUNC_signature_verify_message_final(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_VERIFY_RECOVER_INIT: if (signature->verify_recover_init != NULL) @@ -150,7 +142,6 @@ static void *evp_signature_from_algorithm(int name_id, break; signature->verify_recover = OSSL_FUNC_signature_verify_recover(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT: if (signature->digest_sign_init != NULL) @@ -164,21 +155,18 @@ static void *evp_signature_from_algorithm(int name_id, break; signature->digest_sign_update = OSSL_FUNC_signature_digest_sign_update(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_DIGEST_SIGN_FINAL: if (signature->digest_sign_final != NULL) break; signature->digest_sign_final = OSSL_FUNC_signature_digest_sign_final(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_DIGEST_SIGN: if (signature->digest_sign != NULL) break; signature->digest_sign = OSSL_FUNC_signature_digest_sign(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT: if (signature->digest_verify_init != NULL) @@ -192,21 +180,18 @@ static void *evp_signature_from_algorithm(int name_id, break; signature->digest_verify_update = OSSL_FUNC_signature_digest_verify_update(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_FINAL: if (signature->digest_verify_final != NULL) break; signature->digest_verify_final = OSSL_FUNC_signature_digest_verify_final(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_DIGEST_VERIFY: if (signature->digest_verify != NULL) break; signature->digest_verify = OSSL_FUNC_signature_digest_verify(fns); - fncnt++; break; case OSSL_FUNC_SIGNATURE_FREECTX: if (signature->freectx != NULL) @@ -308,10 +293,8 @@ static void *evp_signature_from_algorithm(int name_id, * associated gettable, etc */ valid = 0; - if (valid && (initfncnt == 0 || fncnt < initfncnt)) - /* - * No init functions, or fewer execution functions than init functions - */ + if (valid && initfncnt == 0) + /* No init functions */ valid = 0; /* Now we check for function combinations */ diff --git a/doc/man7/EVP_SIGNATURE-ED25519.pod b/doc/man7/EVP_SIGNATURE-ED25519.pod index aba56f3182..977470e225 100644 --- a/doc/man7/EVP_SIGNATURE-ED25519.pod +++ b/doc/man7/EVP_SIGNATURE-ED25519.pod @@ -12,7 +12,7 @@ Ed448 The B<Ed25519> and B<Ed448> EVP_PKEY implementation supports key generation, one-shot digest-sign and digest-verify using the EdDSA -signature scheme described in RFC 8032. It has associated private and +signature schemes described in RFC 8032. It has associated private and public key formats compatible with RFC 8410. =head2 EdDSA Instances @@ -36,6 +36,15 @@ B<context-string> as input to sign and verify operations (and for Ed25519ctx, the context-string must be nonempty). For the Ed25519 instance, a nonempty context-string is not permitted. +These instances can be specified as signature parameters when using +L<EVP_DigestSignInit(3)> and L<EVP_DigestVerifyInit(3)>, see +L</ED25519 and ED448 Signature Parameters> below. + +These instances are also explicitly fetchable as algorithms using +L<EVP_SIGNATURE_fetch(3)>, which can be used with +L<EVP_PKEY_sign_init_ex2(3)>, L<EVP_PKEY_verify_init_ex2(3)>, +L<EVP_PKEY_sign_message_init(3)> and L<EVP_PKEY_verify_message_init(3)>. + =head2 ED25519 and ED448 Signature Parameters Two parameters can be set during signing or verification: the EdDSA @@ -60,15 +69,22 @@ A string of octets with length at most 255. Both of these parameters are optional. -If the instance name is not specified, then the default "Ed25519" or -"Ed448" is used. - -If a context-string is not specified, then an empty context-string is -used. +When using L<EVP_DigestSignInit(3)> or L<EVP_DigestVerifyInit(3)>, the +signature algorithm is derived from the key type name. The key type name +("Ed25519" or "Ed448") is also the default for the instance, but this can be +changed with the "instance" parameter. Note that a message digest name must B<NOT> be specified when signing or verifying. +When using L<EVP_PKEY_sign_init_ex2(3)>, L<EVP_PKEY_verify_init_ex2(3)>, +L<EVP_PKEY_sign_message_init(3)> or L<EVP_PKEY_verify_message_init(3)>, the +instance is the explicit signature algorithm name, and may not be changed +(trying to give one with the "instance" parameter is therefore an error). + +If a context-string is not specified, then an empty context-string is +used. + See L<EVP_PKEY-X25519(7)> for information related to B<X25519> and B<X448> keys. The following signature parameters can be retrieved using diff --git a/include/openssl/proverr.h b/include/openssl/proverr.h index 4ba6149aca..20e9c39c8f 100644 --- a/include/openssl/proverr.h +++ b/include/openssl/proverr.h @@ -76,6 +76,7 @@ # define PROV_R_INVALID_MODE 125 # define PROV_R_INVALID_OUTPUT_LENGTH 217 # define PROV_R_INVALID_PADDING_MODE 168 +# define PROV_R_INVALID_PREHASHED_DIGEST_LENGTH 241 # define PROV_R_INVALID_PUBINFO 198 # define PROV_R_INVALID_SALT_LENGTH 112 # define PROV_R_INVALID_SEED_LENGTH 154 @@ -113,6 +114,7 @@ # define PROV_R_NOT_PARAMETERS 226 # define PROV_R_NOT_SUPPORTED 136 # define PROV_R_NOT_XOF_OR_INVALID_LENGTH 113 +# define PROV_R_NO_INSTANCE_ALLOWED 242 # define PROV_R_NO_KEY_SET 114 # define PROV_R_NO_PARAMETERS_SET 177 # define PROV_R_ONESHOT_CALL_OUT_OF_ORDER 239 diff --git a/providers/common/provider_err.c b/providers/common/provider_err.c index 13b024ed9f..dc72e1ae72 100644 --- a/providers/common/provider_err.c +++ b/providers/common/provider_err.c @@ -16,220 +16,224 @@ static const ERR_STRING_DATA PROV_str_reasons[] = { {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ADDITIONAL_INPUT_TOO_LONG), - "additional input too long"}, + "additional input too long"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ALGORITHM_MISMATCH), - "algorithm mismatch"}, + "algorithm mismatch"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ALREADY_INSTANTIATED), - "already instantiated"}, + "already instantiated"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_BAD_DECRYPT), "bad decrypt"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_BAD_ENCODING), "bad encoding"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_BAD_LENGTH), "bad length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_BAD_TLS_CLIENT_VERSION), - "bad tls client version"}, + "bad tls client version"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_BN_ERROR), "bn error"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_CIPHER_OPERATION_FAILED), - "cipher operation failed"}, + "cipher operation failed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_COFACTOR_REQUIRED), "cofactor required"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_DERIVATION_FUNCTION_INIT_FAILED), - "derivation function init failed"}, + "derivation function init failed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_DIGEST_NOT_ALLOWED), - "digest not allowed"}, + "digest not allowed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_EMS_NOT_ENABLED), "ems not enabled"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ENTROPY_SOURCE_STRENGTH_TOO_WEAK), - "entropy source strength too weak"}, + "entropy source strength too weak"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ERROR_INSTANTIATING_DRBG), - "error instantiating drbg"}, + "error instantiating drbg"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ERROR_RETRIEVING_ENTROPY), - "error retrieving entropy"}, + "error retrieving entropy"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ERROR_RETRIEVING_NONCE), - "error retrieving nonce"}, + "error retrieving nonce"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_DURING_DERIVATION), - "failed during derivation"}, + "failed during derivation"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_TO_CREATE_LOCK), - "failed to create lock"}, + "failed to create lock"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_TO_DECRYPT), "failed to decrypt"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_TO_GENERATE_KEY), - "failed to generate key"}, + "failed to generate key"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_TO_GET_PARAMETER), - "failed to get parameter"}, + "failed to get parameter"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_TO_SET_PARAMETER), - "failed to set parameter"}, + "failed to set parameter"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FAILED_TO_SIGN), "failed to sign"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FINAL_CALL_OUT_OF_ORDER), - "final call out of order"}, + "final call out of order"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FIPS_MODULE_CONDITIONAL_ERROR), - "fips module conditional error"}, + "fips module conditional error"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FIPS_MODULE_ENTERING_ERROR_STATE), - "fips module entering error state"}, + "fips module entering error state"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_FIPS_MODULE_IN_ERROR_STATE), - "fips module in error state"}, + "fips module in error state"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_GENERATE_ERROR), "generate error"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE), - "illegal or unsupported padding mode"}, + "illegal or unsupported padding mode"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INDICATOR_INTEGRITY_FAILURE), - "indicator integrity failure"}, + "indicator integrity failure"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INIT_CALL_OUT_OF_ORDER), - "init call out of order"}, + "init call out of order"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INSUFFICIENT_DRBG_STRENGTH), - "insufficient drbg strength"}, + "insufficient drbg strength"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_AAD), "invalid aad"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_AEAD), "invalid aead"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_CONFIG_DATA), - "invalid config data"}, + "invalid config data"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_CONSTANT_LENGTH), - "invalid constant length"}, + "invalid constant length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_CURVE), "invalid curve"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_CUSTOM_LENGTH), - "invalid custom length"}, + "invalid custom length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_DATA), "invalid data"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_DIGEST), "invalid digest"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_DIGEST_LENGTH), - "invalid digest length"}, + "invalid digest length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_DIGEST_SIZE), - "invalid digest size"}, + "invalid digest size"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_INPUT_LENGTH), - "invalid input length"}, + "invalid input length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_ITERATION_COUNT), - "invalid iteration count"}, + "invalid iteration count"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_IV_LENGTH), "invalid iv length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_KDF), "invalid kdf"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_KEY), "invalid key"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_KEY_LENGTH), - "invalid key length"}, + "invalid key length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_MAC), "invalid mac"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_MEMORY_SIZE), - "invalid memory size"}, + "invalid memory size"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_MGF1_MD), "invalid mgf1 md"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_MODE), "invalid mode"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_OUTPUT_LENGTH), - "invalid output length"}, + "invalid output length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_PADDING_MODE), - "invalid padding mode"}, + "invalid padding mode"}, + {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_PREHASHED_DIGEST_LENGTH), + "invalid prehashed digest length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_PUBINFO), "invalid pubinfo"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_SALT_LENGTH), - "invalid salt length"}, + "invalid salt length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_SEED_LENGTH), - "invalid seed length"}, + "invalid seed length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_SIGNATURE_SIZE), - "invalid signature size"}, + "invalid signature size"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_STATE), "invalid state"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_TAG), "invalid tag"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_TAG_LENGTH), - "invalid tag length"}, + "invalid tag length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_THREAD_POOL_SIZE), - "invalid thread pool size"}, + "invalid thread pool size"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_UKM_LENGTH), - "invalid ukm length"}, + "invalid ukm length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_INVALID_X931_DIGEST), - "invalid x931 digest"}, + "invalid x931 digest"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_IN_ERROR_STATE), "in error state"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_KEY_SETUP_FAILED), "key setup failed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_KEY_SIZE_TOO_SMALL), - "key size too small"}, + "key size too small"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_LENGTH_TOO_LARGE), "length too large"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISMATCHING_DOMAIN_PARAMETERS), - "mismatching domain parameters"}, + "mismatching domain parameters"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_CEK_ALG), "missing cek alg"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_CIPHER), "missing cipher"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_CONFIG_DATA), - "missing config data"}, + "missing config data"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_CONSTANT), "missing constant"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_KEY), "missing key"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_MAC), "missing mac"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_MESSAGE_DIGEST), - "missing message digest"}, + "missing message digest"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_OID), "missing OID"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_PASS), "missing pass"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_SALT), "missing salt"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_SECRET), "missing secret"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_SEED), "missing seed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_SESSION_ID), - "missing session id"}, + "missing session id"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_TYPE), "missing type"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MISSING_XCGHASH), "missing xcghash"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_MODULE_INTEGRITY_FAILURE), - "module integrity failure"}, + "module integrity failure"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_A_PRIVATE_KEY), "not a private key"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_A_PUBLIC_KEY), "not a public key"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_INSTANTIATED), "not instantiated"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_PARAMETERS), "not parameters"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_SUPPORTED), "not supported"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NOT_XOF_OR_INVALID_LENGTH), - "not xof or invalid length"}, + "not xof or invalid length"}, + {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NO_INSTANCE_ALLOWED), + "no instance allowed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NO_KEY_SET), "no key set"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_NO_PARAMETERS_SET), "no parameters set"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_ONESHOT_CALL_OUT_OF_ORDER), - "oneshot call out of order"}, + "oneshot call out of order"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE), - "operation not supported for this keytype"}, + "operation not supported for this keytype"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_OUTPUT_BUFFER_TOO_SMALL), - "output buffer too small"}, + "output buffer too small"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PARENT_CANNOT_GENERATE_RANDOM_NUMBERS), - "parent cannot generate random numbers"}, + "parent cannot generate random numbers"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PARENT_CANNOT_SUPPLY_ENTROPY_SEED), - "parent cannot supply entropy seed"}, + "parent cannot supply entropy seed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PARENT_LOCKING_NOT_ENABLED), - "parent locking not enabled"}, + "parent locking not enabled"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PARENT_STRENGTH_TOO_WEAK), - "parent strength too weak"}, + "parent strength too weak"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PATH_MUST_BE_ABSOLUTE), - "path must be absolute"}, + "path must be absolute"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PERSONALISATION_STRING_TOO_LONG), - "personalisation string too long"}, + "personalisation string too long"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_PSS_SALTLEN_TOO_SMALL), - "pss saltlen too small"}, + "pss saltlen too small"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_REQUEST_TOO_LARGE_FOR_DRBG), - "request too large for drbg"}, + "request too large for drbg"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_REQUIRE_CTR_MODE_CIPHER), - "require ctr mode cipher"}, + "require ctr mode cipher"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_RESEED_ERROR), "reseed error"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_SEARCH_ONLY_SUPPORTED_FOR_DIRECTORIES), - "search only supported for directories"}, + "search only supported for directories"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_SEED_SOURCES_MUST_NOT_HAVE_A_PARENT), - "seed sources must not have a parent"}, + "seed sources must not have a parent"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_SELF_TEST_KAT_FAILURE), - "self test kat failure"}, + "self test kat failure"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_SELF_TEST_POST_FAILURE), - "self test post failure"}, + "self test post failure"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_TAG_NOT_NEEDED), "tag not needed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_TAG_NOT_SET), "tag not set"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_TOO_MANY_RECORDS), "too many records"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_FIND_CIPHERS), - "unable to find ciphers"}, + "unable to find ciphers"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_GET_PARENT_STRENGTH), - "unable to get parent strength"}, + "unable to get parent strength"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_GET_PASSPHRASE), - "unable to get passphrase"}, + "unable to get passphrase"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_INITIALISE_CIPHERS), - "unable to initialise ciphers"}, + "unable to initialise ciphers"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_LOAD_SHA256), - "unable to load sha256"}, + "unable to load sha256"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_LOCK_PARENT), - "unable to lock parent"}, + "unable to lock parent"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNABLE_TO_RESEED), "unable to reseed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNSUPPORTED_CEK_ALG), - "unsupported cek alg"}, + "unsupported cek alg"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNSUPPORTED_KEY_SIZE), - "unsupported key size"}, + "unsupported key size"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNSUPPORTED_MAC_TYPE), - "unsupported mac type"}, + "unsupported mac type"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS), - "unsupported number of rounds"}, + "unsupported number of rounds"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_UPDATE_CALL_OUT_OF_ORDER), - "update call out of order"}, + "update call out of order"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_URI_AUTHORITY_UNSUPPORTED), - "uri authority unsupported"}, + "uri authority unsupported"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_VALUE_ERROR), "value error"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_WRONG_FINAL_BLOCK_LENGTH), - "wrong final block length"}, + "wrong final block length"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_WRONG_OUTPUT_BUFFER_SIZE), - "wrong output buffer size"}, + "wrong output buffer size"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_XOF_DIGESTS_NOT_ALLOWED), - "xof digests not allowed"}, + "xof digests not allowed"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE), - "xts data unit is too large"}, + "xts data unit is too large"}, {ERR_PACK(ERR_LIB_PROV, 0, PROV_R_XTS_DUPLICATED_KEYS), - "xts duplicated keys"}, + "xts duplicated keys"}, {0, NULL} }; diff --git a/providers/defltprov.c b/providers/defltprov.c index 93bbfe73d6..06c5ae50ff 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -419,7 +419,10 @@ static const OSSL_ALGORITHM deflt_signature[] = { #ifndef OPENSSL_NO_EC # ifndef OPENSSL_NO_ECX { PROV_NAMES_ED25519, "provider=default", ossl_ed25519_signature_functions }, + { PROV_NAMES_ED25519ph, "provider=default", ossl_ed25519ph_signature_functions }, + { PROV_NAMES_ED25519ctx, "provider=default", ossl_ed25519ctx_signature_functions }, { PROV_NAMES_ED448, "provider=default", ossl_ed448_signature_functions }, + { PROV_NAMES_ED448ph, "provider=default", ossl_ed448ph_signature_functions }, # endif { PROV_NAMES_ECDSA, "provider=default", ossl_ecdsa_signature_functions }, # ifndef OPENSSL_NO_SM2 diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c index 13df65faed..0c247c89ab 100644 --- a/providers/fips/fipsprov.c +++ b/providers/fips/fipsprov.c @@ -441,7 +441,14 @@ static const OSSL_ALGORITHM fips_signature[] = { # ifndef OPENSSL_NO_ECX { PROV_NAMES_ED25519, FIPS_DEFAULT_PROPERTIES, ossl_ed25519_signature_functions }, - { PROV_NAMES_ED448, FIPS_DEFAULT_PROPERTIES, ossl_ed448_signature_functions }, + { PROV_NAMES_ED25519ph, FIPS_DEFAULT_PROPERTIES, + ossl_ed25519ph_signature_functions }, + { PROV_NAMES_ED25519ctx, FIPS_DEFAULT_PROPERTIES, + ossl_ed25519ctx_signature_functions }, + { PROV_NAMES_ED448, FIPS_DEFAULT_PROPERTIES, + ossl_ed448_signature_functions }, + { PROV_NAMES_ED448ph, FIPS_DEFAULT_PROPERTIES, + ossl_ed448ph_signature_functions }, # endif { PROV_NAMES_ECDSA, FIPS_DEFAULT_PROPERTIES, ossl_ecdsa_signature_functions }, #endif diff --git a/providers/implementations/include/prov/implementations.h b/providers/implementations/include/prov/implementations.h index ed73ece0c3..fdf6cee749 100644 --- a/providers/implementations/include/prov/implementations.h +++ b/providers/implementations/include/prov/implementations.h @@ -354,7 +354,10 @@ extern const OSSL_DISPATCH ossl_rsa_sha3_512_signature_functions[]; extern const OSSL_DISPATCH ossl_rsa_sm3_signature_functions[]; #endif extern const OSSL_DISPATCH ossl_ed25519_signature_functions[]; +extern const OSSL_DISPATCH ossl_ed25519ph_signature_functions[]; +extern const OSSL_DISPATCH ossl_ed25519ctx_signature_functions[]; extern const OSSL_DISPATCH ossl_ed448_signature_functions[]; +extern const OSSL_DISPATCH ossl_ed448ph_signature_functions[]; extern const OSSL_DISPATCH ossl_ecdsa_signature_functions[]; extern const OSSL_DISPATCH ossl_mac_legacy_hmac_signature_functions[]; extern const OSSL_DISPATCH ossl_mac_legacy_siphash_signature_functions[]; diff --git a/providers/implementations/include/prov/names.h b/providers/implementations/include/prov/names.h index 36a9434652..a62100f63b 100644 --- a/providers/implementations/include/prov/names.h +++ b/providers/implementations/include/prov/names.h @@ -329,8 +329,14 @@ #define PROV_DESCS_X448 "OpenSSL X448 implementation" #define PROV_NAMES_ED25519 "ED25519:1.3.101.112" #define PROV_DESCS_ED25519 "OpenSSL ED25519 implementation" +#define PROV_NAMES_ED25519ph "ED25519ph" +#define PROV_DESCS_ED25519ph "OpenSSL ED25519ph implementation" +#define PROV_NAMES_ED25519ctx "ED25519ctx" +#define PROV_DESCS_ED25519ctx "OpenSSL ED25519ctx implementation" #define PROV_NAMES_ED448 "ED448:1.3.101.113" #define PROV_DESCS_ED448 "OpenSSL ED448 implementation" +#define PROV_NAMES_ED448ph "ED448ph" +#define PROV_DESCS_ED448ph "OpenSSL ED448ph implementation" #define PROV_NAMES_DH "DH:dhKeyAgreement:1.2.840.113549.1.3.1" #define PROV_DESCS_DH "OpenSSL PKCS#3 DH implementation" #define PROV_NAMES_DHX "DHX:X9.42 DH:dhpublicnumber:1.2.840.10046.2.1" diff --git a/providers/implementations/signature/eddsa_sig.c b/providers/implementations/signature/eddsa_sig.c index 29be3fcd3a..0d64146acf 100644 --- a/providers/implementations/signature/eddsa_sig.c +++ b/providers/implementations/signature/eddsa_sig.c @@ -63,17 +63,30 @@ enum ID_EdDSA_INSTANCE { #define EDDSA_PREHASH_OUTPUT_LEN 64 static OSSL_FUNC_signature_newctx_fn eddsa_newctx; -static OSSL_FUNC_signature_digest_sign_init_fn eddsa_digest_signverify_init; +static OSSL_FUNC_signature_sign_message_init_fn ed25519_signverify_message_init; +static OSSL_FUNC_signature_sign_message_init_fn ed25519ph_signverify_message_init; +static OSSL_FUNC_signature_sign_message_init_fn ed25519ctx_signverify_message_init; +static OSSL_FUNC_signature_sign_message_init_fn ed448_signverify_message_init; +static OSSL_FUNC_signature_sign_message_init_fn ed448ph_signverify_message_init; +static OSSL_FUNC_signature_sign_fn ed25519_sign; +static OSSL_FUNC_signature_sign_fn ed448_sign; +static OSSL_FUNC_signature_verify_fn ed25519_verify; +static OSSL_FUNC_signature_verify_fn ed448_verify; +static OSSL_FUNC_signature_digest_sign_init_fn ed25519_digest_signverify_init; +static OSSL_FUNC_signature_digest_sign_init_fn ed448_digest_signverify_init; static OSSL_FUNC_signature_digest_sign_fn ed25519_digest_sign; static OSSL_FUNC_signature_digest_sign_fn ed448_digest_sign; static OSSL_FUNC_signature_digest_verify_fn ed25519_digest_verify; static OSSL_FUNC_signature_digest_verify_fn ed448_digest_verify; static OSSL_FUNC_signature_freectx_fn eddsa_freectx; static OSSL_FUNC_signature_dupctx_fn eddsa_dupctx; +static OSSL_FUNC_signature_query_key_types_fn ed25519_sigalg_query_key_types; +static OSSL_FUNC_signature_query_key_types_fn ed448_sigalg_query_key_types; static OSSL_FUNC_signature_get_ctx_params_fn eddsa_get_ctx_params; static OSSL_FUNC_signature_gettable_ctx_params_fn eddsa_gettable_ctx_params; static OSSL_FUNC_signature_set_ctx_params_fn eddsa_set_ctx_params; static OSSL_FUNC_signature_settable_ctx_params_fn eddsa_settable_ctx_params; +static OSSL_FUNC_signature_settable_ctx_params_fn eddsa_settable_variant_ctx_params; /* there are five EdDSA instances: @@ -133,6 +146,10 @@ typedef struct { /* id indicating the EdDSA instance */ int instance_id; + /* indicates that instance_id and associated flags are preset / hardcoded */ + unsigned int instance_id_preset_flag : 1; + /* for ph instances, this indicates whether the caller is expected to prehash */ + unsigned int prehash_by_caller_flag : 1; unsigned int dom2_flag : 1; unsigned int prehash_flag : 1; @@ -161,9 +178,57 @@ static void *eddsa_newctx(void *provctx, const char *propq_unused) return peddsactx; } -static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname, - void *vedkey, - const OSSL_PARAM params[]) +static int eddsa_setup_instance(void *vpeddsactx, int instance_id, + unsigned int instance_id_preset, + unsigned int prehash_by_caller) +{ + PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; + + switch (instance_id) { + case ID_Ed25519: + if (peddsactx->key->type != ECX_KEY_TYPE_ED25519) + return 0; + peddsactx->dom2_flag = 0; + peddsactx->prehash_flag = 0; + peddsactx->context_string_flag = 0; + break; + case ID_Ed25519ctx: + if (peddsactx->key->type != ECX_KEY_TYPE_ED25519) + return 0; + peddsactx->dom2_flag = 1; + peddsactx->prehash_flag = 0; + peddsactx->context_string_flag = 1; + break; + case ID_Ed25519ph: + if (peddsactx->key->type != ECX_KEY_TYPE_ED25519) + return 0; + peddsactx->dom2_flag = 1; + peddsactx->prehash_flag = 1; + peddsactx->context_string_flag = 0; + break; + case ID_Ed448: + if (peddsactx->key->type != ECX_KEY_TYPE_ED448) + return 0; + peddsactx->prehash_flag = 0; + peddsactx->context_string_flag = 0; + break; + case ID_Ed448ph: + if (peddsactx->key->type != ECX_KEY_TYPE_ED448) + return 0; + peddsactx->prehash_flag = 1; + peddsactx->context_string_flag = 0; + break; + default: + /* we did not recognize the instance */ + return 0; + } + peddsactx->instance_id = instance_id; + peddsactx->instance_id_preset_flag = instance_id_preset; + peddsactx->prehash_by_caller_flag = prehash_by_caller; + return 1; +} + +static int eddsa_signverify_init(void *vpeddsactx, void *vedkey) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; ECX_KEY *edkey = (ECX_KEY *)vedkey; @@ -173,14 +238,7 @@ static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname, if (!ossl_prov_is_running()) return 0; - if (mdname != NULL && mdname[0] != '\0') { - ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST); - return 0; - } - if (edkey == NULL) { - if (peddsactx->key != NULL) - return eddsa_set_ctx_params(peddsactx, params); ERR_raise(ERR_LIB_PROV, PROV_R_NO_KEY_SET); return 0; } @@ -190,11 +248,14 @@ static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname, return 0; } + peddsactx->instance_id_preset_flag = 0; peddsactx->dom2_flag = 0; peddsactx->prehash_flag = 0; peddsactx->context_string_flag = 0; peddsactx->context_string_len = 0; + peddsactx->key = edkey; + /* * We do not care about DER writing errors. * All it really means is that for some reason, there's no @@ -207,16 +268,15 @@ static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname, switch (edkey->type) { case ECX_KEY_TYPE_ED25519: ret = ret && ossl_DER_w_algorithmIdentifier_ED25519(&pkt, -1, edkey); - peddsactx->instance_id = ID_Ed25519; break; case ECX_KEY_TYPE_ED448: ret = ret && ossl_DER_w_algorithmIdentifier_ED448(&pkt, -1, edkey); - peddsactx->instance_id = ID_Ed448; break; default: /* Should never happen */ ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR); ossl_ecx_key_free(edkey); + peddsactx->key = NULL; return 0; } if (ret && WPACKET_finish(&pkt)) { @@ -225,17 +285,72 @@ static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname, } WPACKET_cleanup(&pkt); - peddsactx->key = edkey; + return 1; +} - if (!eddsa_set_ctx_params(peddsactx, params)) - return 0; +static int ed25519_signverify_message_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed25519, 1, 0) + && eddsa_set_ctx_params(vpeddsactx, params); +} - return 1; +static int ed25519ph_signverify_message_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed25519ph, 1, 0) + && eddsa_set_ctx_params(vpeddsactx, params); } -static int ed25519_digest_sign(void *vpeddsactx, unsigned char *sigret, - size_t *siglen, size_t sigsize, - const unsigned char *tbs, size_t tbslen) +static int ed25519ph_signverify_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed25519ph, 1, 1) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +static int ed25519ctx_signverify_message_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed25519ctx, 1, 0) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +static int ed448_signverify_message_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed448, 1, 0) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +static int ed448ph_signverify_message_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed448ph, 1, 0) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +static int ed448ph_signverify_init(void *vpeddsactx, void *vedkey, + const OSSL_PARAM params[]) +{ + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed448ph, 1, 1) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +/* + * This is used directly for OSSL_FUNC_SIGNATURE_SIGN and indirectly + * for OSSL_FUNC_SIGNATURE_DIGEST_SIGN + */ +static int ed25519_sign(void *vpeddsactx, + unsigned char *sigret, size_t *siglen, size_t sigsize, + const unsigned char *tbs, size_t tbslen) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; const ECX_KEY *edkey = peddsactx->key; @@ -274,11 +389,19 @@ static int ed25519_digest_sign(void *vpeddsactx, unsigned char *sigret, #endif /* S390X_EC_ASM */ if (peddsactx->prehash_flag) { - if (!EVP_Q_digest(peddsactx->libctx, SN_sha512, NULL, tbs, tbslen, md, &mdlen) - || mdlen != EDDSA_PREHASH_OUTPUT_LEN) + if (!peddsactx->prehash_by_caller_flag) { + if (!EVP_Q_digest(peddsactx->libctx, SN_sha512, NULL, + tbs, tbslen, md, &mdlen) + || mdlen != EDDSA_PREHASH_OUTPUT_LEN) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PREHASHED_DIGEST_LENGTH); + return 0; + } + tbs = md; + tbslen = mdlen; + } else if (tbslen != EDDSA_PREHASH_OUTPUT_LEN) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH); return 0; - tbs = md; - tbslen = mdlen; + } } if (ossl_ed25519_sign(sigret, tbs, tbslen, edkey->pubkey, edkey->privkey, @@ -319,9 +442,13 @@ static int ed448_shake256(OSSL_LIB_CTX *libctx, return ret; } -static int ed448_digest_sign(void *vpeddsactx, unsigned char *sigret, - size_t *siglen, size_t sigsize, - const unsigned char *tbs, size_t tbslen) +/* + * This is used directly for OSSL_FUNC_SIGNATURE_SIGN and indirectly + * for OSSL_FUNC_SIGNATURE_DIGEST_SIGN + */ +static int ed448_sign(void *vpeddsactx, + unsigned char *sigret, size_t *siglen, size_t sigsize, + const unsigned char *tbs, size_t tbslen) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; const ECX_KEY *edkey = peddsactx->key; @@ -359,10 +486,15 @@ static int ed448_digest_sign(void *vpeddsactx, unsigned char *sigret, #endif /* S390X_EC_ASM */ if (peddsactx->prehash_flag) { - if (!ed448_shake256(peddsactx->libctx, NULL, tbs, tbslen, md, mdlen)) + if (!peddsactx->prehash_by_caller_flag) { + if (!ed448_shake256(peddsactx->libctx, NULL, tbs, tbslen, md, mdlen)) + return 0; + tbs = md; + tbslen = mdlen; + } else if (tbslen != EDDSA_PREHASH_OUTPUT_LEN) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH); return 0; - tbs = md; - tbslen = mdlen; + } } if (ossl_ed448_sign(peddsactx->libctx, sigret, tbs, tbslen, @@ -376,9 +508,13 @@ static int ed448_digest_sign(void *vpeddsactx, unsigned char *sigret, return 1; } -static int ed25519_digest_verify(void *vpeddsactx, const unsigned char *sig, - size_t siglen, const unsigned char *tbs, - size_t tbslen) +/* + * This is used directly for OSSL_FUNC_SIGNATURE_VERIFY and indirectly + * for OSSL_FUNC_SIGNATURE_DIGEST_VERIFY + */ +static int ed25519_verify(void *vpeddsactx, + const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; const ECX_KEY *edkey = peddsactx->key; @@ -400,11 +536,19 @@ static int ed25519_digest_verify(void *vpeddsactx, const unsigned char *sig, #endif /* S390X_EC_ASM */ if (peddsactx->prehash_flag) { - if (!EVP_Q_digest(peddsactx->libctx, SN_sha512, NULL, tbs, tbslen, md, &mdlen) - || mdlen != EDDSA_PREHASH_OUTPUT_LEN) + if (!peddsactx->prehash_by_caller_flag) { + if (!EVP_Q_digest(peddsactx->libctx, SN_sha512, NULL, + tbs, tbslen, md, &mdlen) + || mdlen != EDDSA_PREHASH_OUTPUT_LEN) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PREHASHED_DIGEST_LENGTH); + return 0; + } + tbs = md; + tbslen = mdlen; + } else if (tbslen != EDDSA_PREHASH_OUTPUT_LEN) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH); return 0; - tbs = md; - tbslen = mdlen; + } } return ossl_ed25519_verify(tbs, tbslen, sig, edkey->pubkey, @@ -413,9 +557,13 @@ static int ed25519_digest_verify(void *vpeddsactx, const unsigned char *sig, peddsactx->libctx, edkey->propq); } -static int ed448_digest_verify(void *vpeddsactx, const unsigned char *sig, - size_t siglen, const unsigned char *tbs, - size_t tbslen) +/* + * This is used directly for OSSL_FUNC_SIGNATURE_VERIFY and indirectly + * for OSSL_FUNC_SIGNATURE_DIGEST_VERIFY + */ +static int ed448_verify(void *vpeddsactx, + const unsigned char *sig, size_t siglen, + const unsigned char *tbs, size_t tbslen) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; const ECX_KEY *edkey = peddsactx->key; @@ -436,10 +584,15 @@ static int ed448_digest_verify(void *vpeddsactx, const unsigned char *sig, #endif /* S390X_EC_ASM */ if (peddsactx->prehash_flag) { - if (!ed448_shake256(peddsactx->libctx, NULL, tbs, tbslen, md, mdlen)) + if (!peddsactx->prehash_by_caller_flag) { + if (!ed448_shake256(peddsactx->libctx, NULL, tbs, tbslen, md, mdlen)) + return 0; + tbs = md; + tbslen = mdlen; + } else if (tbslen != EDDSA_PREHASH_OUTPUT_LEN) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST_LENGTH); return 0; - tbs = md; - tbslen = mdlen; + } } return ossl_ed448_verify(peddsactx->libctx, tbs, tbslen, sig, edkey->pubkey, @@ -447,6 +600,76 @@ static int ed448_digest_verify(void *vpeddsactx, const unsigned char *sig, peddsactx->prehash_flag, edkey->propq); } +/* All digest_{sign,verify} are simple wrappers around the functions above */ + +static int ed25519_digest_signverify_init(void *vpeddsactx, const char *mdname, + void *vedkey, + const OSSL_PARAM params[]) +{ + PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; + + if (mdname != NULL && mdname[0] != '\0') { + ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST, + "Explicit digest not allowed with EdDSA operations"); + return 0; + } + + if (vedkey == NULL && peddsactx->key != NULL) + return eddsa_set_ctx_params(peddsactx, params); + + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed25519, 0, 0) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +static int ed25519_digest_sign(void *vpeddsactx, + unsigned char *sigret, size_t *siglen, size_t sigsize, + const unsigned char *tbs, size_t tbslen) +{ + return ed25519_sign(vpeddsactx, sigret, siglen, sigsize, tbs, tbslen); +} + +static int ed25519_digest_verify(void *vpeddsactx, + const unsigned char *sigret, size_t siglen, + const unsigned char *tbs, size_t tbslen) +{ + return ed25519_verify(vpeddsactx, sigret, siglen, tbs, tbslen); +} + +static int ed448_digest_signverify_init(void *vpeddsactx, const char *mdname, + void *vedkey, + const OSSL_PARAM params[]) +{ + PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; + + if (mdname != NULL && mdname[0] != '\0') { + ERR_raise_data(ERR_LIB_PROV, PROV_R_INVALID_DIGEST, + "Explicit digest not allowed with EdDSA operations"); + return 0; + } + + if (vedkey == NULL && peddsactx->key != NULL) + return eddsa_set_ctx_params(peddsactx, params); + + return eddsa_signverify_init(vpeddsactx, vedkey) + && eddsa_setup_instance(vpeddsactx, ID_Ed448, 0, 0) + && eddsa_set_ctx_params(vpeddsactx, params); +} + +static int ed448_digest_sign(void *vpeddsactx, + unsigned char *sigret, size_t *siglen, size_t sigsize, + const unsigned char *tbs, size_t tbslen) +{ + return ed448_sign(vpeddsactx, sigret, siglen, sigsize, tbs, tbslen); +} + +static int ed448_digest_verify(void *vpeddsactx, + const unsigned char *sigret, size_t siglen, + const unsigned char *tbs, size_t tbslen) +{ + return ed448_verify(vpeddsactx, sigret, siglen, tbs, tbslen); +} + static void eddsa_freectx(void *vpeddsactx) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; @@ -483,6 +706,22 @@ static void *eddsa_dupctx(void *vpeddsactx) return NULL; } +static const char **ed25519_sigalg_query_key_types(void) +{ + static const char *keytypes[] = { "ED25519", NULL }; + + return keytypes; +} + +static const char **ed448_sigalg_query_key_types(void) +{ + static const char *keytypes[] = { "ED448", NULL }; + + return keytypes; +} + + + static int eddsa_get_ctx_params(void *vpeddsactx, OSSL_PARAM *params) { PROV_EDDSA_CTX *peddsactx = (PROV_EDDSA_CTX *)vpeddsactx; @@ -527,37 +766,27 @@ static int eddsa_set_ctx_params(void *vpeddsactx, const OSSL_PARAM params[]) char instance_name[OSSL_MAX_NAME_SIZE] = ""; char *pinstance_name = instance_name; + if (peddsactx->instance_id_preset_flag) { + /* When the instance is preset, the caller must no try to set it */ + ERR_raise_data(ERR_LIB_PROV, PROV_R_NO_INSTANCE_ALLOWED, + "the EdDSA instance is preset, you may not try to specify it", + NULL); + return 0; + } + if (!OSSL_PARAM_get_utf8_string(p, &pinstance_name, sizeof(instance_name))) return 0; if (OPENSSL_strcasecmp(pinstance_name, SN_Ed25519) == 0) { - peddsactx->instance_id = ID_Ed25519; - if (peddsactx->key->type != ECX_KEY_TYPE_ED25519) return 0; - peddsactx->dom2_flag = 0; - peddsactx->prehash_flag = 0; - peddsactx->context_string_flag = 0; + eddsa_setup_instance(peddsactx, ID_Ed25519, 0, 0); } else if (OPENSSL_strcasecmp(pinstance_name, SN_Ed25519ctx) == 0) { - peddsactx->instance_id = ID_Ed25519ctx; - if (peddsactx->key->type != ECX_KEY_TYPE_ED25519) return 0; - peddsactx->dom2_flag = 1; - peddsactx->prehash_flag = 0; - peddsactx->context_string_flag = 1; + eddsa_setup_instance(peddsactx, ID_Ed25519ctx, 0, 0); } else if (OPENSSL_strcasecmp(pinstance_name, SN_Ed25519ph) == 0) { - peddsactx->instance_id = ID_Ed25519ph; - if (peddsactx->key->type != ECX_KEY_TYPE_ED25519) return 0; - peddsactx->dom2_flag = 1; - peddsactx->prehash_flag = 1; - peddsactx->context_string_flag = 0; + eddsa_setup_instance(peddsactx, ID_Ed25519ph, 0, 0); } else if (OPENSSL_strcasecmp(pinstance_name, SN_Ed448) == 0) { - peddsactx->instance_id = ID_Ed448; - if (peddsactx->key->type != ECX_KEY_TYPE_ED448) return 0; - peddsactx->prehash_flag = 0; - peddsactx->context_string_flag = 0; + eddsa_setup_instance(peddsactx, ID_Ed448, 0, 0); } else if (OPENSSL_strcasecmp(pinstance_name, SN_Ed448ph) == 0) { - peddsactx->instance_id = ID_Ed448ph; - if (peddsactx->key->type != ECX_KEY_TYPE_ED448) return 0; - peddsactx->prehash_flag = 1; - peddsactx->context_string_flag = 0; + eddsa_setup_instance(peddsactx, ID_Ed448ph, 0, 0); } else { /* we did not recognize the instance */ return 0; @@ -590,47 +819,137 @@ static const OSSL_PARAM *eddsa_settable_ctx_params(ossl_unused void *vpeddsactx, return settable_ctx_params; } -const OSSL_DISPATCH ossl_ed25519_signature_functions[] = { - { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))eddsa_newctx }, - { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, - (void (*)(void))eddsa_digest_signverify_init }, - { OSSL_FUNC_SIGNATURE_DIGEST_SIGN, - (void (*)(void))ed25519_digest_sign }, - { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, - (void (*)(void))eddsa_digest_signverify_init }, - { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY, - (void (*)(void))ed25519_digest_verify }, - { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))eddsa_freectx }, - { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))eddsa_dupctx }, - { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, (void (*)(void))eddsa_get_ctx_params }, - { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, - (void (*)(void))eddsa_gettable_ctx_params }, - { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, (void (*)(void))eddsa_set_ctx_params }, - { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, - (void (*)(void))eddsa_settable_ctx_params }, - OSSL_DISPATCH_END +static const OSSL_PARAM settable_variant_ctx_params[] = { + OSSL_PARAM_octet_string(OSSL_SIGNATURE_PARAM_CONTEXT_STRING, NULL, 0), + OSSL_PARAM_END }; -const OSSL_DISPATCH ossl_ed448_signature_functions[] = { - { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))eddsa_newctx }, - { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, - (void (*)(void))eddsa_digest_signverify_init }, - { OSSL_FUNC_SIGNATURE_DIGEST_SIGN, - (void (*)(void))ed448_digest_sign }, - { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, - (void (*)(void))eddsa_digest_signverify_init }, - { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY, - (void (*)(void))ed448_digest_verify }, - { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))eddsa_freectx }, - { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))eddsa_dupctx }, - { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, (void (*)(void))eddsa_get_ctx_params }, - { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, - (void (*)(void))eddsa_gettable_ctx_params }, - { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, (void (*)(void))eddsa_set_ctx_params }, - { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, - (void (*)(void))eddsa_settable_ctx_params }, +static const OSSL_PARAM * +eddsa_settable_variant_ctx_params(ossl_unused void *vpeddsactx, + ossl_unused void *provctx) +{ + return settable_variant_ctx_params; +} + +/* + * Ed25519 can be used with: + * - EVP_PKEY_sign_message_init() + * - EVP_PKEY_verify_message_init() + * - EVP_DigestSignInit_ex() + * - EVP_DigestVerifyInit_ex() + * Ed25519ph can be used with: + * - EVP_PKEY_sign_init_ex2() [ prehash assumed done by caller ] + * - EVP_PKEY_verify_init_ex2() [ prehash assumed done by caller ] + * - EVP_PKEY_sign_message_init() + * - EVP_PKEY_verify_message_init() + * Ed25519ctx can be used with: + * - EVP_PKEY_sign_message_init() + * - EVP_PKEY_verify_message_init() + * Ed448 can be used with: + * - EVP_PKEY_sign_message_init() + * - EVP_PKEY_verify_message_init() + * - EVP_DigestSignInit_ex() + * - EVP_DigestVerifyInit_ex() + * Ed448ph can be used with: + * - EVP_PKEY_sign_init_ex2() [ prehash assumed done by caller ] + * - EVP_PKEY_verify_init_ex2() [ prehash assumed done by caller ] + * - EVP_PKEY_sign_message_init() + * - EVP_PKEY_verify_message_init() + */ + +#define ed25519_DISPATCH_END \ + { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, \ + (void (*)(void))ed25519_digest_signverify_init }, \ + { OSSL_FUNC_SIGNATURE_DIGEST_SIGN, \ + (void (*)(void))ed25519_digest_sign }, \ + { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, \ + (void (*)(void))ed25519_digest_signverify_init }, \ + { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY, \ + (void (*)(void))ed25519_digest_verify }, \ + { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, \ + (void (*)(void))eddsa_get_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, \ + (void (*)(void))eddsa_gettable_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, \ + (void (*)(void))eddsa_set_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, \ + (void (*)(void))eddsa_settable_ctx_params }, \ OSSL_DISPATCH_END -}; + +#define eddsa_variant_DISPATCH_END(v) \ + { OSSL_FUNC_SIGNATURE_SIGN_INIT, \ + (void (*)(void))v##_signverify_message_init }, \ + { OSSL_FUNC_SIGNATURE_VERIFY_INIT, \ + (void (*)(void))v##_signverify_message_init }, \ + { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, \ + (void (*)(void))eddsa_get_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, \ + (void (*)(void))eddsa_gettable_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, \ + (void (*)(void))eddsa_set_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, \ + (void (*)(void))eddsa_settable_variant_ctx_params }, \ + OSSL_DISPATCH_END + +#define ed25519ph_DISPATCH_END \ + { OSSL_FUNC_SIGNATURE_SIGN_INIT, \ + (void (*)(void))ed25519ph_signverify_init }, \ + { OSSL_FUNC_SIGNATURE_VERIFY_INIT, \ + (void (*)(void))ed25519ph_signverify_init }, \ + eddsa_variant_DISPATCH_END(ed25519ph) + +#define ed25519ctx_DISPATCH_END eddsa_variant_DISPATCH_END(ed25519ctx) + +#define ed448_DISPATCH_END \ + { OSSL_FUNC_SIGNATURE_DIGEST_SIGN_INIT, \ + (void (*)(void))ed448_digest_signverify_init }, \ + { OSSL_FUNC_SIGNATURE_DIGEST_SIGN, \ + (void (*)(void))ed448_digest_sign }, \ + { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY_INIT, \ + (void (*)(void))ed448_digest_signverify_init }, \ + { OSSL_FUNC_SIGNATURE_DIGEST_VERIFY, \ + (void (*)(void))ed448_digest_verify }, \ + { OSSL_FUNC_SIGNATURE_GET_CTX_PARAMS, \ + (void (*)(void))eddsa_get_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_GETTABLE_CTX_PARAMS, \ + (void (*)(void))eddsa_gettable_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_SET_CTX_PARAMS, \ + (void (*)(void))eddsa_set_ctx_params }, \ + { OSSL_FUNC_SIGNATURE_SETTABLE_CTX_PARAMS, \ + (void (*)(void))eddsa_settable_ctx_params }, \ + OSSL_DISPATCH_END + +#define ed448ph_DISPATCH_END \ + { OSSL_FUNC_SIGNATURE_SIGN_INIT, \ + (void (*)(void))ed448ph_signverify_init }, \ + { OSSL_FUNC_SIGNATURE_VERIFY_INIT, \ + (void (*)(void))ed448ph_signverify_init }, \ + eddsa_variant_DISPATCH_END(ed448ph) + +/* vn = variant name, bn = base name */ +#define IMPL_EDDSA_DISPATCH(vn,bn) \ + const OSSL_DISPATCH ossl_##vn##_signature_functions[] = { \ + { OSSL_FUNC_SIGNATURE_NEWCTX, (void (*)(void))eddsa_newctx }, \ + { OSSL_FUNC_SIGNATURE_SIGN_MESSAGE_INIT, \ + (void (*)(void))vn##_signverify_message_init }, \ + { OSSL_FUNC_SIGNATURE_SIGN, \ + (void (*)(void))bn##_sign }, \ + { OSSL_FUNC_SIGNATURE_VERIFY_MESSAGE_INIT, \ + (void (*)(void))vn##_signverify_message_init }, \ + { OSSL_FUNC_SIGNATURE_VERIFY, \ + (void (*)(void))bn##_verify }, \ + { OSSL_FUNC_SIGNATURE_FREECTX, (void (*)(void))eddsa_freectx }, \ + { OSSL_FUNC_SIGNATURE_DUPCTX, (void (*)(void))eddsa_dupctx }, \ + { OSSL_FUNC_SIGNATURE_QUERY_KEY_TYPES, \ + (void (*)(void))bn##_sigalg_query_key_types }, \ + vn##_DISPATCH_END \ + } + +IMPL_EDDSA_DISPATCH(ed25519,ed25519); +IMPL_EDDSA_DISPATCH(ed25519ph,ed25519); +IMPL_EDDSA_DISPATCH(ed25519ctx,ed25519); +IMPL_EDDSA_DISPATCH(ed448,ed448); +IMPL_EDDSA_DISPATCH(ed448ph,ed448); #ifdef S390X_EC_ASM diff --git a/test/recipes/30-test_evp.t b/test/recipes/30-test_evp.t index 9894c1762e..689dc5eb07 100644 --- a/test/recipes/30-test_evp.t +++ b/test/recipes/30-test_evp.t @@ -77,6 +77,7 @@ push @files, qw( push @files, qw(evppkey_dsa.txt) unless $no_dsa; push @files, qw( evppkey_ecx.txt + evppkey_ecx_sigalg.txt evppkey_mismatch_ecx.txt ) unless $no_ecx; push @files, qw( diff --git a/test/recipes/30-test_evp_data/evppkey_ecx_sigalg.txt b/test/recipes/30-test_evp_data/evppkey_ecx_sigalg.txt new file mode 100644 index 0000000000..e3197db2de --- /dev/null +++ b/test/recipes/30-test_evp_data/evppkey_ecx_sigalg.txt @@ -0,0 +1,674 @@ +# +# Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +# Tests start with one of these keywords +# Cipher Decrypt Derive Digest Encoding KDF MAC PBE +# PrivPubKeyPair Sign Verify VerifyRecover +# OneShotDigestSign +# and continue until a blank line. Lines starting with a pound sign are ignored. + + +Title = ED25519 tests from RFC8032 + +PrivateKey=ED25519-1 +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIJ1hsZ3v/VpguoRK9JLsLMREScVpezJpGXA7rAMcrn9g +-----END PRIVATE KEY----- + +PrivateKey=ED25519-2 +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIEzNCJso/5banbbDRuwRTg9bijGfNaumJNqM9u1PuKb7 +-----END PRIVATE KEY----- + +PrivateKey=ED25519-3 +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIMWqjfQ/n4N77bdELzHct7Fm04U1B28JS4XOOi4LRFj3 +-----END PRIVATE KEY----- + +PrivateKey=ED25519-4 +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIPXldnzxUzGVF2MPImh2uGyBYMxYO8ATdExr8lX1zA7l +-----END PRIVATE KEY----- + +PrivateKey=ED25519-5 +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIIM/5iQJI3udYux3WHUgkR6adZzsHRl1W32pAbltyj1C +-----END PRIVATE KEY----- + +PublicKey=ED25519-1-PUBLIC +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEA11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo= +-----END PUBLIC KEY----- + +PublicKey=ED25519-2-PUBLIC +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAPUAXw+hDiVqStwqnTRt+vJyYLM8uxJaMwM1V8Sr0Zgw= +-----END PUBLIC KEY----- + +PublicKey=ED25519-3-PUBLIC +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEA/FHNjmIYoaONpH7QAjDwWAgW7RO6MwOsXeuRFUiQgCU= +-----END PUBLIC KEY----- + +PublicKey=ED25519-4-PUBLIC +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAJ4EX/BRMcjQPZ9DyMW6Dhs7/vyskKMnFH+98WX8dQm4= +-----END PUBLIC KEY----- + +PublicKey=ED25519-5-PUBLIC +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEA7Bcrk61eVjv0kyxw4SRQNMNUZ+8u/U1k6/gZaDRn4r8= +-----END PUBLIC KEY----- + +#Raw versions of the ED25519-1 keys +PrivateKeyRaw=ED25519-1-Raw:ED25519:9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60 + +PublicKeyRaw=ED25519-1-PUBLIC-Raw:ED25519:d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a + +PrivPubKeyPair = ED25519-1:ED25519-1-PUBLIC + +PrivPubKeyPair = ED25519-1-Raw:ED25519-1-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:ED25519-1 +Input = "" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b + +PrivPubKeyPair = ED25519-2:ED25519-2-PUBLIC + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:ED25519-2 +Input = 72 +Output = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00 + +PrivPubKeyPair = ED25519-3:ED25519-3-PUBLIC + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:ED25519-3 +Input = af82 +Output = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a + +PrivPubKeyPair = ED25519-4:ED25519-4-PUBLIC + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:ED25519-4 +Input = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0 +Output = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03 + +PrivPubKeyPair = ED25519-5:ED25519-5-PUBLIC + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:ED25519-5 +Input = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f +Output = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704 + +# Verify test +FIPSversion = >=3.4.0 +Verify-Message = ED25519:ED25519-1-PUBLIC +Input = "" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b + +# Corrupted input +FIPSversion = >=3.4.0 +Verify-Message = ED25519:ED25519-1-PUBLIC +Input = "bad" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b +Result = VERIFY_ERROR + +# Corrupted signature +FIPSversion = >=3.4.0 +Verify-Message = ED25519:ED25519-1-PUBLIC +Input = "" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100c +Result = VERIFY_ERROR + +PrivPubKeyPair = ED25519-1:ED25519-2-PUBLIC +Result = KEYPAIR_MISMATCH + +# Raw tests + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:ED25519-1-Raw +Input = "" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b + +FIPSversion = >=3.4.0 +Verify-Message = ED25519:ED25519-1-PUBLIC-Raw +Input = "" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b + +#Signature maleability test. +#Same as the verify operation above but with the order added to s +FIPSversion = >=3.4.0 +Verify-Message = ED25519:ED25519-1-PUBLIC-Raw +Input = "" +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901554c8c7872aa064e049dbb3013fbf29380d25bf5f0595bbe24655141438e7a101b +Result = VERIFY_ERROR + +Title = ED448 tests from RFC8032 + +PrivateKey=ED448-1 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOWyCpWLLgI0Q1jK+ichRPr9skp803fqMn2PJlg7240ij +UoyKP8wvBE45o/xblEkvjwMudUmiAJj5Ww== +-----END PRIVATE KEY----- + +PrivateKey=ED448-2 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOcTqsF01cAfGMvPbtISJkk1VKwj+DDU6DUofAKzaLEY6 +++pnxejSh3xeO8OXplmUnvgCHpVOChInTg== +-----END PRIVATE KEY----- + +PrivateKey=ED448-3 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOc0j0k9xQnTnRDQyN7kykPUR9kJfmOZEWf8gPomFCD/9 +9gUAVTq8DgXNAhhL24nEzNZ+GHlRJn6zKA== +-----END PRIVATE KEY----- + +PrivateKey=ED448-4 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOSWM3UraMu2cn/VOY3Vq5YL7j6sqxyHyyOZ2pydoUT2T +n2Pd21VgkTPymt+G7Jkp3MtSwcX9L/fiGw== +-----END PRIVATE KEY----- + +PrivateKey=ED448-5 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOX706EVEI2dS+7VrjzGiOhDkKBT19VygN83MEcZMmjsp +ScG7YHADFGEXMqbC/qmO68AmahGpOXAQDg== +-----END PRIVATE KEY----- + +PrivateKey=ED448-6 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOdZd80GtE+AIVnaIuu3ajp3NwX3AJJdOpbQie2Uw4zm/ +8h+Z5oymlo88ym3+D7n0+rT6E11VQuo/AQ== +-----END PRIVATE KEY----- + +PrivateKey=ED448-7 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOS7F/jwXBFq9sTal5qkT4yq3WuaLU9L8FJt35QQTLTdW +m352a6dKGb1hYjQ6IchZCqnOvKkBTGNt9Q== +-----END PRIVATE KEY----- + +PrivateKey=ED448-8 +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOYctCTeA9dNzDffCEmZLN7ig8k9WgQ2qg4LNT6P3djTs +RNxU8cLtm+qG+vt2Mti+GZ6hZfWtVd2c6A== +-----END PRIVATE KEY----- + +PublicKey=ED448-1-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoAX9dEm1m0Yf0s54fsYWrUah2hNCSFpw4fig6nXYDpZ3jt8SR2 +m0bHBhvWeD3x5Q9s0foavq/oJWGA +-----END PUBLIC KEY----- + +PublicKey=ED448-2-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoAQ7oo9DDN/0Vq5TFUX37NCsg0pV2TWMA3K/oMbGeYwIZq6gHr +AHQoArhDjqTLghacI1FgYntMOpSA +-----END PUBLIC KEY----- + +PublicKey=ED448-3-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoA3OqeePNaG/NJmoMbELhskKrAHNhLZ6AQm1WjbpMoseNl/OFh +1xznExpUPqTLX36fHYsAaWRHABQA +-----END PUBLIC KEY----- + +PublicKey=ED448-4-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoAO6FtoMbyzB8wGHdAdW9eeY1rxfwBXXxjzJUQ7j/UStwk2Olo +tuRub5TRm5RTYXJr114UnvCYF/WA +-----END PUBLIC KEY----- + +PublicKey=ED448-5-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoAs9oHmwqkk6V3ICnwRnuuvuWoES2dOiJTI2HaKU97s4FcXcWe +F2tNnzgcoJOOE8bAexdL5l36V46A +-----END PUBLIC KEY----- + +PublicKey=ED448-6-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoA35cF9Y7bq4Asf4Njz+VWCrHGEywgqfHdFjSDom+KxTo51oCL +9KHfvSYbCZuwOz+1CQbLKL2KCB8A +-----END PUBLIC KEY----- + +PublicKey=ED448-7-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoAeXVvAU3P4gefXdnnGL5BceLvJIagjyUYb2v/Q6mTa5v+EkAr +CK5leYo9geIunsgOdpCGLvPU7ToA +-----END PUBLIC KEY----- + +PublicKey=ED448-8-PUBLIC +-----BEGIN PUBLIC KEY----- +MEMwBQYDK2VxAzoAqBsuinClrJT/28ybrfw/6wgB8lhXi7EUrUTs4ewOeZ2gjv+4 +HF1oXAxW9k7srvjN8RzDhzeDjPQA +-----END PUBLIC KEY----- + +#Raw versions of the ED448-1 keys +PrivateKeyRaw=ED448-1-Raw:ED448:6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b + +PublicKeyRaw=ED448-1-PUBLIC-Raw:ED448:5fd7449b59b461fd2ce787ec616ad46a1da1342485a70e1f8a0ea75d80e96778edf124769b46c7061bd6783df1e50f6cd1fa1abeafe8256180 + +PrivPubKeyPair = ED448-1:ED448-1-PUBLIC + +PrivPubKeyPair = ED448-2:ED448-2-PUBLIC + +PrivPubKeyPair = ED448-3:ED448-3-PUBLIC + +PrivPubKeyPair = ED448-4:ED448-4-PUBLIC + +PrivPubKeyPair = ED448-5:ED448-5-PUBLIC + +PrivPubKeyPair = ED448-6:ED448-6-PUBLIC + +PrivPubKeyPair = ED448-7:ED448-7-PUBLIC + +PrivPubKeyPair = ED448-8:ED448-8-PUBLIC + +PrivPubKeyPair = ED448-1-Raw:ED448-1-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-1 +Input = "" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-2 +Input = 03 +Output = 26b8f91727bd62897af15e41eb43c377efb9c610d48f2335cb0bd0087810f4352541b143c4b981b7e18f62de8ccdf633fc1bf037ab7cd779805e0dbcc0aae1cbcee1afb2e027df36bc04dcecbf154336c19f0af7e0a6472905e799f1953d2a0ff3348ab21aa4adafd1d234441cf807c03a00 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-3 +Input = 0c3e544074ec63b0265e0c +Output = 1f0a8888ce25e8d458a21130879b840a9089d999aaba039eaf3e3afa090a09d389dba82c4ff2ae8ac5cdfb7c55e94d5d961a29fe0109941e00b8dbdeea6d3b051068df7254c0cdc129cbe62db2dc957dbb47b51fd3f213fb8698f064774250a5028961c9bf8ffd973fe5d5c206492b140e00 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-4 +Input = 64a65f3cdedcdd66811e2915 +Output = 7eeeab7c4e50fb799b418ee5e3197ff6bf15d43a14c34389b59dd1a7b1b85b4ae90438aca634bea45e3a2695f1270f07fdcdf7c62b8efeaf00b45c2c96ba457eb1a8bf075a3db28e5c24f6b923ed4ad747c3c9e03c7079efb87cb110d3a99861e72003cbae6d6b8b827e4e6c143064ff3c00 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-5 +Input = 64a65f3cdedcdd66811e2915e7 +Output = 6a12066f55331b6c22acd5d5bfc5d71228fbda80ae8dec26bdd306743c5027cb4890810c162c027468675ecf645a83176c0d7323a2ccde2d80efe5a1268e8aca1d6fbc194d3f77c44986eb4ab4177919ad8bec33eb47bbb5fc6e28196fd1caf56b4e7e0ba5519234d047155ac727a1053100 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-6 +Input = bd0f6a3747cd561bdddf4640a332461a4a30a12a434cd0bf40d766d9c6d458e5512204a30c17d1f50b5079631f64eb3112182da3005835461113718d1a5ef944 +Output = 554bc2480860b49eab8532d2a533b7d578ef473eeb58c98bb2d0e1ce488a98b18dfde9b9b90775e67f47d4a1c3482058efc9f40d2ca033a0801b63d45b3b722ef552bad3b4ccb667da350192b61c508cf7b6b5adadc2c8d9a446ef003fb05cba5f30e88e36ec2703b349ca229c2670833900 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-7 +Input = 15777532b0bdd0d1389f636c5f6b9ba734c90af572877e2d272dd078aa1e567cfa80e12928bb542330e8409f3174504107ecd5efac61ae7504dabe2a602ede89e5cca6257a7c77e27a702b3ae39fc769fc54f2395ae6a1178cab4738e543072fc1c177fe71e92e25bf03e4ecb72f47b64d0465aaea4c7fad372536c8ba516a6039c3c2a39f0e4d832be432dfa9a706a6e5c7e19f397964ca4258002f7c0541b590316dbc5622b6b2a6fe7a4abffd96105eca76ea7b98816af0748c10df048ce012d901015a51f189f3888145c03650aa23ce894c3bd889e030d565071c59f409a9981b51878fd6fc110624dcbcde0bf7a69ccce38fabdf86f3bef6044819de11 +Output = c650ddbb0601c19ca11439e1640dd931f43c518ea5bea70d3dcde5f4191fe53f00cf966546b72bcc7d58be2b9badef28743954e3a44a23f880e8d4f1cfce2d7a61452d26da05896f0a50da66a239a8a188b6d825b3305ad77b73fbac0836ecc60987fd08527c1a8e80d5823e65cafe2a3d00 + +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-8 +Input = 6ddf802e1aae4986935f7f981ba3f0351d6273c0a0c22c9c0e8339168e675412a3debfaf435ed651558007db4384b650fcc07e3b586a27a4f7a00ac8a6fec2cd86ae4bf1570c41e6a40c931db27b2faa15a8cedd52cff7362c4e6e23daec0fbc3a79b6806e316efcc7b68119bf46bc76a26067a53f296dafdbdc11c77f7777e972660cf4b6a9b369a6665f02e0cc9b6edfad136b4fabe723d2813db3136cfde9b6d044322fee2947952e031b73ab5c603349b307bdc27bc6cb8b8bbd7bd323219b8033a581b59eadebb09b3c4f3d2277d4f0343624acc817804728b25ab797172b4c5c21a22f9c7839d64300232eb66e53f31c723fa37fe387c7d3e50bdf9813a30e5bb12cf4cd930c40cfb4e1fc622592a49588794494d56d24ea4b40c89fc0596cc9ebb961c8cb10adde976a5d602b1c3f85b9b9a001ed3c6a4d3b1437f52096cd1956d042a597d561a596ecd3d1735a8d570ea0ec27225a2c4aaff26306d1526c1af3ca6d9cf5a2c98f47e1c46db9a33234cfd4d81f2c98538a09ebe76998d0d8fd25997c7d255c6d66ece6fa56f11144950f027795e653008f4bd7ca2dee85d8e90f3dc315130ce2a00375a318c7c3d97be2c8ce5b6db41a6254ff264fa6155baee3b0773c0f497c573f19bb4f4240281f0b1f4f7be857a4e59d416c06b4c50fa09e1810ddc6b1467baeac5a3668d11b6ecaa901440016f389f80acc4db977025e7f5924388c7e340a732e554440e76570f8dd71b7d640b3450d1fd5f0410a18f9a3494f707c717b79b4bf75c98400b096b21653b5d217cf3565c9597456f70703497a078763829bc01bb1cbc8fa04eadc9a6e3f6699587a9e75c94e5bab0036e0b2e711392cff0047d0d6b05bd2a588bc109718954259f1d86678a579a3120f19cfb2963f177aeb70f2d4844826262e51b80271272068ef5b3856fa8535aa2a88b2d41f2a0e2fda7624c2850272ac4a2f561f8f2f7a318bfd5caf9696149e4ac824ad3460538fdc25421beec2cc6818162d06bbed0c40a387192349db67a118bada6cd5ab0140ee273204f628aad1c135f770279a651e24d8c14d75a6059d76b96a6fd857def5e0b354b27ab937a5815d16b5fae407ff18222c6d1ed263be68c95f32d908bd895cd76207ae726487567f9a67dad79abec316f683b17f2d02bf07e0ac8b5bc6162cf94697b3c27cd1fea49b27f23ba2901871962506520c392da8b6ad0d99f7013fbc06c2c17a569500c8a7696481c1cd33e9b14e40b82e79a5f5db82571ba97bae3ad3e0479515bb0e2b0f3bfcd1fd33034efc6245eddd7ee2086ddae2600d8ca73e214e8c2b0bdb2b047c6a464a562ed77b73d2d841c4b34973551257713b753632efba348169abc90a68f42611a40126d7cb21b58695568186f7e569d2ff0f9e745d0487dd2eb997cafc5abf9dd102e62ff66cba87 +Output = e301345a41a39a4d72fff8df69c98075a0cc082b802fc9b2b6bc503f926b65bddf7f4c8f1cb49f6396afc8a70abe6d8aef0db478d4c6b2970076c6a0484fe76d76b3a97625d79f1ce240e7c576750d295528286f719b413de9ada3e8eb78ed573603ce30d8bb761785dc30dbc320869e1a00 + +# Verify test +FIPSversion = >=3.4.0 +Verify-Message = ED448:ED448-1-PUBLIC +Input = "" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600 + +# Corrupted input +FIPSversion = >=3.4.0 +Verify-Message = ED448:ED448-1-PUBLIC +Input = "bad" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600 +Result = VERIFY_ERROR + +# Corrupted signature +FIPSversion = >=3.4.0 +Verify-Message = ED448:ED448-1-PUBLIC +Input = "" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652601 +Result = VERIFY_ERROR + +# Raw keys +FIPSversion = >=3.4.0 +Sign-Message = ED448:ED448-1-Raw +Input = "" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600 + +FIPSversion = >=3.4.0 +Verify-Message = ED448:ED448-1-PUBLIC-Raw +Input = "" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600 + +#Signature malelability test. +#Same as the verify operation above but with the order added to s +FIPSversion = >=3.4.0 +Verify-Message = ED448:ED448-1-PUBLIC-Raw +Input = "" +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980f25278d3667403c14bcec5f9cfde9955ebc8333c0ae78fc86e518317c5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e656600 +Result = VERIFY_ERROR + +######## RFC 8032 test vectors + +# Test Vector 1 +# Ed25519 +PrivateKeyRaw = EDDSA-TV-1-Raw:ED25519:9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60 + +PublicKeyRaw = EDDSA-TV-1-PUBLIC-Raw:ED25519:d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a + +PrivPubKeyPair = EDDSA-TV-1-Raw:EDDSA-TV-1-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:EDDSA-TV-1-Raw +Input = +Ctrl = hexcontext-string: +Output = e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b + +# Test Vector 2 +# Ed25519 +PrivateKeyRaw = EDDSA-TV-2-Raw:ED25519:4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb + +PublicKeyRaw = EDDSA-TV-2-PUBLIC-Raw:ED25519:3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c + +PrivPubKeyPair = EDDSA-TV-2-Raw:EDDSA-TV-2-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed25519:EDDSA-TV-2-Raw +Input = 72 +Ctrl = hexcontext-string: +Output = 92a009a9f0d4cab8720e820b5f642540a2b27b5416503f8fb3762223ebdb69da085ac1e43e15996e458f3613d0f11d8c387b2eaeb4302aeeb00d291612bb0c00 + +# Test Vector 3 +# Ed25519 +PrivateKeyRaw = EDDSA-TV-3-Raw:ED25519:c5aa8df43f9f837bedb7442f31dcb7b166d38535076f094b85ce3a2e0b4458f7 + +PublicKeyRaw = EDDSA-TV-3-PUBLIC-Raw:ED25519:fc51cd8e6218a1a38da47ed00230f0580816ed13ba3303ac5deb911548908025 + +PrivPubKeyPair = EDDSA-TV-3-Raw:EDDSA-TV-3-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed25519:EDDSA-TV-3-Raw +Input = af82 +Ctrl = hexcontext-string: +Output = 6291d657deec24024827e69c3abe01a30ce548a284743a445e3680d7db5ac3ac18ff9b538d16f290ae67f760984dc6594a7c15e9716ed28dc027beceea1ec40a + +# Test Vector 4 +# Ed25519 +PrivateKeyRaw = EDDSA-TV-4-Raw:ED25519:f5e5767cf153319517630f226876b86c8160cc583bc013744c6bf255f5cc0ee5 + +PublicKeyRaw = EDDSA-TV-4-PUBLIC-Raw:ED25519:278117fc144c72340f67d0f2316e8386ceffbf2b2428c9c51fef7c597f1d426e + +PrivPubKeyPair = EDDSA-TV-4-Raw:EDDSA-TV-4-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:EDDSA-TV-4-Raw +Input = 08b8b2b733424243760fe426a4b54908632110a66c2f6591eabd3345e3e4eb98fa6e264bf09efe12ee50f8f54e9f77b1e355f6c50544e23fb1433ddf73be84d879de7c0046dc4996d9e773f4bc9efe5738829adb26c81b37c93a1b270b20329d658675fc6ea534e0810a4432826bf58c941efb65d57a338bbd2e26640f89ffbc1a858efcb8550ee3a5e1998bd177e93a7363c344fe6b199ee5d02e82d522c4feba15452f80288a821a579116ec6dad2b3b310da903401aa62100ab5d1a36553e06203b33890cc9b832f79ef80560ccb9a39ce767967ed628c6ad573cb116dbefefd75499da96bd68a8a97b928a8bbc103b6621fcde2beca1231d206be6cd9ec7aff6f6c94fcd7204ed3455c68c83f4a41da4af2b74ef5c53f1d8ac70bdcb7ed185ce81bd84359d44254d95629e9855a94a7c1958d1f8ada5d0532ed8a5aa3fb2d17ba70eb6248e594e1a2297acbbb39d502f1a8c6eb6f1ce22b3de1a1f40cc24554119a831a9aad6079cad88425de6bde1a9187ebb6092cf67bf2b13fd65f27088d78b7e883c8759d2c4f5c65adb7553878ad575f9fad878e80a0c9ba63bcbcc2732e69485bbc9c90bfbd62481d9089beccf80cfe2df16a2cf65bd92dd597b0707e0917af48bbb75fed413d238f5555a7a569d80c3414a8d0859dc65a46128bab27af87a71314f318c782b23ebfe808b82b0ce26401d2e22f04d83d1255dc51addd3b75a2b1ae0784504df543af8969be3ea7082ff7fc9888c144da2af58429ec96031dbcad3dad9af0dcbaaaf268cb8fcffead94f3c7ca495e056a9b47acdb751fb73e666c6c655ade8297297d07ad1ba5e43f1bca32301651339e22904cc8c42f58c30c04aafdb038dda0847dd988dcda6f3bfd15c4b4c4525004aa06eeff8ca61783aacec57fb3d1f92b0fe2fd1a85f6724517b65e614ad6808d6f6ee34dff7310fdc82aebfd904b01e1dc54b2927094b2db68d6f903b68401adebf5a7e08d78ff4ef5d63653a65040cf9bfd4aca7984a74d37145986780fc0b16ac451649de6188a7dbdf191f64b5fc5e2ab47b57f7f7276cd419c17a3ca8e1b939ae49e488acba6b965610b5480109c8b17b80e1b7b750dfc7598d5d5011fd2dcc5600a32ef5b52a1ecc820e308aa342721aac0943bf6686b64b2579376504ccc493d97e6aed3fb0f9cd71a43dd497f01f17c0e2cb3797aa2a2f256656168e6c496afc5fb93246f6b1116398a346f1a641f3b041e989f7914f90cc2c7fff357876e506b50d334ba77c225bc307ba537152f3f1610e4eafe595f6d9d90d11faa933a15ef1369546868a7f3a45a96768d40fd9d03412c091c6315cf4fde7cb68606937380db2eaaa707b4c4185c32eddcdd306705e4dc1ffc872eeee475a64dfac86aba41c0618983f8741c5ef68d3a101e8a3b8cac60c905c15fc910840b94c00a0b9d0 +Ctrl = hexcontext-string: +Output = 0aab4c900501b3e24d7cdf4663326a3a87df5e4843b2cbdb67cbf6e460fec350aa5371b1508f9f4528ecea23c436d94b5e8fcd4f681e30a6ac00a9704a188a03 + +# Test Vector 5 +# Ed25519 +PrivateKeyRaw = EDDSA-TV-5-Raw:ED25519:833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42 + +PublicKeyRaw = EDDSA-TV-5-PUBLIC-Raw:ED25519:ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf + +PrivPubKeyPair = EDDSA-TV-5-Raw:EDDSA-TV-5-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = ED25519:EDDSA-TV-5-Raw +Input = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f +Ctrl = hexcontext-string: +Output = dc2a4459e7369633a52b1bf277839a00201009a3efbf3ecb69bea2186c26b58909351fc9ac90b3ecfdfbc7c66431e0303dca179c138ac17ad9bef1177331a704 + +# Test Vector 6 +# Ed25519ctx +PrivateKeyRaw = EDDSA-TV-6-Raw:ED25519:0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6 + +PublicKeyRaw = EDDSA-TV-6-PUBLIC-Raw:ED25519:dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292 + +PrivPubKeyPair = EDDSA-TV-6-Raw:EDDSA-TV-6-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = ED25519ctx:EDDSA-TV-6-Raw +Input = f726936d19c800494e3fdaff20b276a8 +Ctrl = hexcontext-string:666f6f +Output = 55a4cc2f70a54e04288c5f4cd1e45a7bb520b36292911876cada7323198dd87a8b36950b95130022907a7fb7c4e9b2d5f6cca685a587b4b21f4b888e4e7edb0d + +# Test Vector 7 +# Ed25519ctx +PrivateKeyRaw = EDDSA-TV-7-Raw:ED25519:0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6 + +PublicKeyRaw = EDDSA-TV-7-PUBLIC-Raw:ED25519:dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292 + +PrivPubKeyPair = EDDSA-TV-7-Raw:EDDSA-TV-7-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed25519ctx:EDDSA-TV-7-Raw +Input = f726936d19c800494e3fdaff20b276a8 +Ctrl = hexcontext-string:626172 +Output = fc60d5872fc46b3aa69f8b5b4351d5808f92bcc044606db097abab6dbcb1aee3216c48e8b3b66431b5b186d1d28f8ee15a5ca2df6668346291c2043d4eb3e90d + +# Test Vector 8 +# Ed25519ctx +PrivateKeyRaw = EDDSA-TV-8-Raw:ED25519:0305334e381af78f141cb666f6199f57bc3495335a256a95bd2a55bf546663f6 + +PublicKeyRaw = EDDSA-TV-8-PUBLIC-Raw:ED25519:dfc9425e4f968f7f0c29f0259cf5f9aed6851c2bb4ad8bfb860cfee0ab248292 + +PrivPubKeyPair = EDDSA-TV-8-Raw:EDDSA-TV-8-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed25519ctx:EDDSA-TV-8-Raw +Input = 508e9e6882b979fea900f62adceaca35 +Ctrl = hexcontext-string:666f6f +Output = 8b70c1cc8310e1de20ac53ce28ae6e7207f33c3295e03bb5c0732a1d20dc64908922a8b052cf99b7c4fe107a5abb5b2c4085ae75890d02df26269d8945f84b0b + +# Test Vector 9 +# Ed25519ctx +PrivateKeyRaw = EDDSA-TV-9-Raw:ED25519:ab9c2853ce297ddab85c993b3ae14bcad39b2c682beabc27d6d4eb20711d6560 + +PublicKeyRaw = EDDSA-TV-9-PUBLIC-Raw:ED25519:0f1d1274943b91415889152e893d80e93275a1fc0b65fd71b4b0dda10ad7d772 + +PrivPubKeyPair = EDDSA-TV-9-Raw:EDDSA-TV-9-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed25519ctx:EDDSA-TV-9-Raw +Input = f726936d19c800494e3fdaff20b276a8 +Ctrl = hexcontext-string:666f6f +Output = 21655b5f1aa965996b3f97b3c849eafba922a0a62992f73b3d1b73106a84ad85e9b86a7b6005ea868337ff2d20a7f5fbd4cd10b0be49a68da2b2e0dc0ad8960f + +# Test Vector 10 +# Ed25519ph +PrivateKeyRaw = EDDSA-TV-10-Raw:ED25519:833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42 + +PublicKeyRaw = EDDSA-TV-10-PUBLIC-Raw:ED25519:ec172b93ad5e563bf4932c70e1245034c35467ef2efd4d64ebf819683467e2bf + +PrivPubKeyPair = EDDSA-TV-10-Raw:EDDSA-TV-10-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed25519ph:EDDSA-TV-10-Raw +Input = 616263 +Ctrl = hexcontext-string: +Output = 98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406 + +# Same as the Sign-Message above, but with a pre-hashed input. Input was +# generated with: +# echo 616263 | xxd -r -p | openssl sha512 -binary | xxd -p -c 0 +FIPSversion = >=3.4.0 +Sign = Ed25519ph:EDDSA-TV-10-Raw +Input = ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f +Ctrl = hexcontext-string: +Output = 98a70222f0b8121aa9d30f813d683f809e462b469c7ff87639499bb94e6dae4131f85042463c2a355a2003d062adf5aaa10b8c61e636062aaad11c2a26083406 + +# Test Vector 11 +# Ed448 +PrivateKeyRaw = EDDSA-TV-11-Raw:ED448:6c82a562cb808d10d632be89c8513ebf6c929f34ddfa8c9f63c9960ef6e348a3528c8a3fcc2f044e39a3fc5b94492f8f032e7549a20098f95b + +PublicKeyRaw = EDDSA-TV-11-PUBLIC-Raw:ED448:5fd7449b59b461fd2ce787ec616ad46a1da1342485a70e1f8a0ea75d80e96778edf124769b46c7061bd6783df1e50f6cd1fa1abeafe8256180 + +PrivPubKeyPair = EDDSA-TV-11-Raw:EDDSA-TV-11-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-11-Raw +Input = +Ctrl = hexcontext-string: +Output = 533a37f6bbe457251f023c0d88f976ae2dfb504a843e34d2074fd823d41a591f2b233f034f628281f2fd7a22ddd47d7828c59bd0a21bfd3980ff0d2028d4b18a9df63e006c5d1c2d345b925d8dc00b4104852db99ac5c7cdda8530a113a0f4dbb61149f05a7363268c71d95808ff2e652600 + +# Test Vector 12 +# Ed448 +PrivateKeyRaw = EDDSA-TV-12-Raw:ED448:c4eab05d357007c632f3dbb48489924d552b08fe0c353a0d4a1f00acda2c463afbea67c5e8d2877c5e3bc397a659949ef8021e954e0a12274e + +PublicKeyRaw = EDDSA-TV-12-PUBLIC-Raw:ED448:43ba28f430cdff456ae531545f7ecd0ac834a55d9358c0372bfa0c6c6798c0866aea01eb00742802b8438ea4cb82169c235160627b4c3a9480 + +PrivPubKeyPair = EDDSA-TV-12-Raw:EDDSA-TV-12-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-12-Raw +Input = 03 +Ctrl = hexcontext-string: +Output = 26b8f91727bd62897af15e41eb43c377efb9c610d48f2335cb0bd0087810f4352541b143c4b981b7e18f62de8ccdf633fc1bf037ab7cd779805e0dbcc0aae1cbcee1afb2e027df36bc04dcecbf154336c19f0af7e0a6472905e799f1953d2a0ff3348ab21aa4adafd1d234441cf807c03a00 + +# Test Vector 13 +# Ed448 +PrivateKeyRaw = EDDSA-TV-13-Raw:ED448:c4eab05d357007c632f3dbb48489924d552b08fe0c353a0d4a1f00acda2c463afbea67c5e8d2877c5e3bc397a659949ef8021e954e0a12274e + +PublicKeyRaw = EDDSA-TV-13-PUBLIC-Raw:ED448:43ba28f430cdff456ae531545f7ecd0ac834a55d9358c0372bfa0c6c6798c0866aea01eb00742802b8438ea4cb82169c235160627b4c3a9480 + +PrivPubKeyPair = EDDSA-TV-13-Raw:EDDSA-TV-13-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-13-Raw +Input = 03 +Ctrl = hexcontext-string:666f6f +Output = d4f8f6131770dd46f40867d6fd5d5055de43541f8c5e35abbcd001b32a89f7d2151f7647f11d8ca2ae279fb842d607217fce6e042f6815ea000c85741de5c8da1144a6a1aba7f96de42505d7a7298524fda538fccbbb754f578c1cad10d54d0d5428407e85dcbc98a49155c13764e66c3c00 + +# Test Vector 14 +# Ed448 +PrivateKeyRaw = EDDSA-TV-14-Raw:ED448:cd23d24f714274e744343237b93290f511f6425f98e64459ff203e8985083ffdf60500553abc0e05cd02184bdb89c4ccd67e187951267eb328 + +PublicKeyRaw = EDDSA-TV-14-PUBLIC-Raw:ED448:dcea9e78f35a1bf3499a831b10b86c90aac01cd84b67a0109b55a36e9328b1e365fce161d71ce7131a543ea4cb5f7e9f1d8b00696447001400 + +PrivPubKeyPair = EDDSA-TV-14-Raw:EDDSA-TV-14-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-14-Raw +Input = 0c3e544074ec63b0265e0c +Ctrl = hexcontext-string: +Output = 1f0a8888ce25e8d458a21130879b840a9089d999aaba039eaf3e3afa090a09d389dba82c4ff2ae8ac5cdfb7c55e94d5d961a29fe0109941e00b8dbdeea6d3b051068df7254c0cdc129cbe62db2dc957dbb47b51fd3f213fb8698f064774250a5028961c9bf8ffd973fe5d5c206492b140e00 + +# Test Vector 15 +# Ed448 +PrivateKeyRaw = EDDSA-TV-15-Raw:ED448:258cdd4ada32ed9c9ff54e63756ae582fb8fab2ac721f2c8e676a72768513d939f63dddb55609133f29adf86ec9929dccb52c1c5fd2ff7e21b + +PublicKeyRaw = EDDSA-TV-15-PUBLIC-Raw:ED448:3ba16da0c6f2cc1f30187740756f5e798d6bc5fc015d7c63cc9510ee3fd44adc24d8e968b6e46e6f94d19b945361726bd75e149ef09817f580 + +PrivPubKeyPair = EDDSA-TV-15-Raw:EDDSA-TV-15-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-15-Raw +Input = 64a65f3cdedcdd66811e2915 +Ctrl = hexcontext-string: +Output = 7eeeab7c4e50fb799b418ee5e3197ff6bf15d43a14c34389b59dd1a7b1b85b4ae90438aca634bea45e3a2695f1270f07fdcdf7c62b8efeaf00b45c2c96ba457eb1a8bf075a3db28e5c24f6b923ed4ad747c3c9e03c7079efb87cb110d3a99861e72003cbae6d6b8b827e4e6c143064ff3c00 + +# Test Vector 16 +# Ed448 +PrivateKeyRaw = EDDSA-TV-16-Raw:ED448:7ef4e84544236752fbb56b8f31a23a10e42814f5f55ca037cdcc11c64c9a3b2949c1bb60700314611732a6c2fea98eebc0266a11a93970100e + +PublicKeyRaw = EDDSA-TV-16-PUBLIC-Raw:ED448:b3da079b0aa493a5772029f0467baebee5a8112d9d3a22532361da294f7bb3815c5dc59e176b4d9f381ca0938e13c6c07b174be65dfa578e80 + +PrivPubKeyPair = EDDSA-TV-16-Raw:EDDSA-TV-16-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-16-Raw +Input = 64a65f3cdedcdd66811e2915e7 +Ctrl = hexcontext-string: +Output = 6a12066f55331b6c22acd5d5bfc5d71228fbda80ae8dec26bdd306743c5027cb4890810c162c027468675ecf645a83176c0d7323a2ccde2d80efe5a1268e8aca1d6fbc194d3f77c44986eb4ab4177919ad8bec33eb47bbb5fc6e28196fd1caf56b4e7e0ba5519234d047155ac727a1053100 + +# Test Vector 17 +# Ed448 +PrivateKeyRaw = EDDSA-TV-17-Raw:ED448:d65df341ad13e008567688baedda8e9dcdc17dc024974ea5b4227b6530e339bff21f99e68ca6968f3cca6dfe0fb9f4fab4fa135d5542ea3f01 + +PublicKeyRaw = EDDSA-TV-17-PUBLIC-Raw:ED448:df9705f58edbab802c7f8363cfe5560ab1c6132c20a9f1dd163483a26f8ac53a39d6808bf4a1dfbd261b099bb03b3fb50906cb28bd8a081f00 + +PrivPubKeyPair = EDDSA-TV-17-Raw:EDDSA-TV-17-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-17-Raw +Input = bd0f6a3747cd561bdddf4640a332461a4a30a12a434cd0bf40d766d9c6d458e5512204a30c17d1f50b5079631f64eb3112182da3005835461113718d1a5ef944 +Ctrl = hexcontext-string: +Output = 554bc2480860b49eab8532d2a533b7d578ef473eeb58c98bb2d0e1ce488a98b18dfde9b9b90775e67f47d4a1c3482058efc9f40d2ca033a0801b63d45b3b722ef552bad3b4ccb667da350192b61c508cf7b6b5adadc2c8d9a446ef003fb05cba5f30e88e36ec2703b349ca229c2670833900 + +# Test Vector 18 +# Ed448 +PrivateKeyRaw = EDDSA-TV-18-Raw:ED448:2ec5fe3c17045abdb136a5e6a913e32ab75ae68b53d2fc149b77e504132d37569b7e766ba74a19bd6162343a21c8590aa9cebca9014c636df5 + +PublicKeyRaw = EDDSA-TV-18-PUBLIC-Raw:ED448:79756f014dcfe2079f5dd9e718be4171e2ef2486a08f25186f6bff43a9936b9bfe12402b08ae65798a3d81e22e9ec80e7690862ef3d4ed3a00 + +PrivPubKeyPair = EDDSA-TV-18-Raw:EDDSA-TV-18-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-18-Raw +Input = 15777532b0bdd0d1389f636c5f6b9ba734c90af572877e2d272dd078aa1e567cfa80e12928bb542330e8409f3174504107ecd5efac61ae7504dabe2a602ede89e5cca6257a7c77e27a702b3ae39fc769fc54f2395ae6a1178cab4738e543072fc1c177fe71e92e25bf03e4ecb72f47b64d0465aaea4c7fad372536c8ba516a6039c3c2a39f0e4d832be432dfa9a706a6e5c7e19f397964ca4258002f7c0541b590316dbc5622b6b2a6fe7a4abffd96105eca76ea7b98816af0748c10df048ce012d901015a51f189f3888145c03650aa23ce894c3bd889e030d565071c59f409a9981b51878fd6fc110624dcbcde0bf7a69ccce38fabdf86f3bef6044819de11 +Ctrl = hexcontext-string: +Output = c650ddbb0601c19ca11439e1640dd931f43c518ea5bea70d3dcde5f4191fe53f00cf966546b72bcc7d58be2b9badef28743954e3a44a23f880e8d4f1cfce2d7a61452d26da05896f0a50da66a239a8a188b6d825b3305ad77b73fbac0836ecc60987fd08527c1a8e80d5823e65cafe2a3d00 + +# Test Vector 19 +# Ed448 +PrivateKeyRaw = EDDSA-TV-19-Raw:ED448:872d093780f5d3730df7c212664b37b8a0f24f56810daa8382cd4fa3f77634ec44dc54f1c2ed9bea86fafb7632d8be199ea165f5ad55dd9ce8 + +PublicKeyRaw = EDDSA-TV-19-PUBLIC-Raw:ED448:a81b2e8a70a5ac94ffdbcc9badfc3feb0801f258578bb114ad44ece1ec0e799da08effb81c5d685c0c56f64eecaef8cdf11cc38737838cf400 + +PrivPubKeyPair = EDDSA-TV-19-Raw:EDDSA-TV-19-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448:EDDSA-TV-19-Raw +Input = 6ddf802e1aae4986935f7f981ba3f0351d6273c0a0c22c9c0e8339168e675412a3debfaf435ed651558007db4384b650fcc07e3b586a27a4f7a00ac8a6fec2cd86ae4bf1570c41e6a40c931db27b2faa15a8cedd52cff7362c4e6e23daec0fbc3a79b6806e316efcc7b68119bf46bc76a26067a53f296dafdbdc11c77f7777e972660cf4b6a9b369a6665f02e0cc9b6edfad136b4fabe723d2813db3136cfde9b6d044322fee2947952e031b73ab5c603349b307bdc27bc6cb8b8bbd7bd323219b8033a581b59eadebb09b3c4f3d2277d4f0343624acc817804728b25ab797172b4c5c21a22f9c7839d64300232eb66e53f31c723fa37fe387c7d3e50bdf9813a30e5bb12cf4cd930c40cfb4e1fc622592a49588794494d56d24ea4b40c89fc0596cc9ebb961c8cb10adde976a5d602b1c3f85b9b9a001ed3c6a4d3b1437f52096cd1956d042a597d561a596ecd3d1735a8d570ea0ec27225a2c4aaff26306d1526c1af3ca6d9cf5a2c98f47e1c46db9a33234cfd4d81f2c98538a09ebe76998d0d8fd25997c7d255c6d66ece6fa56f11144950f027795e653008f4bd7ca2dee85d8e90f3dc315130ce2a00375a318c7c3d97be2c8ce5b6db41a6254ff264fa6155baee3b0773c0f497c573f19bb4f4240281f0b1f4f7be857a4e59d416c06b4c50fa09e1810ddc6b1467baeac5a3668d11b6ecaa901440016f389f80acc4db977025e7f5924388c7e340a732e554440e76570f8dd71b7d640b3450d1fd5f0410a18f9a3494f707c717b79b4bf75c98400b096b21653b5d217cf3565c9597456f70703497a078763829bc01bb1cbc8fa04eadc9a6e3f6699587a9e75c94e5bab0036e0b2e711392cff0047d0d6b05bd2a588bc109718954259f1d86678a579a3120f19cfb2963f177aeb70f2d4844826262e51b80271272068ef5b3856fa8535aa2a88b2d41f2a0e2fda7624c2850272ac4a2f561f8f2f7a318bfd5caf9696149e4ac824ad3460538fdc25421beec2cc6818162d06bbed0c40a387192349db67a118bada6cd5ab0140ee273204f628aad1c135f770279a651e24d8c14d75a6059d76b96a6fd857def5e0b354b27ab937a5815d16b5fae407ff18222c6d1ed263be68c95f32d908bd895cd76207ae726487567f9a67dad79abec316f683b17f2d02bf07e0ac8b5bc6162cf94697b3c27cd1fea49b27f23ba2901871962506520c392da8b6ad0d99f7013fbc06c2c17a569500c8a7696481c1cd33e9b14e40b82e79a5f5db82571ba97bae3ad3e0479515bb0e2b0f3bfcd1fd33034efc6245eddd7ee2086ddae2600d8ca73e214e8c2b0bdb2b047c6a464a562ed77b73d2d841c4b34973551257713b753632efba348169abc90a68f42611a40126d7cb21b58695568186f7e569d2ff0f9e745d0487dd2eb997cafc5abf9dd102e62ff66cba87 +Ctrl = hexcontext-string: +Output = e301345a41a39a4d72fff8df69c98075a0cc082b802fc9b2b6bc503f926b65bddf7f4c8f1cb49f6396afc8a70abe6d8aef0db478d4c6b2970076c6a0484fe76d76b3a97625d79f1ce240e7c576750d295528286f719b413de9ada3e8eb78ed573603ce30d8bb761785dc30dbc320869e1a00 + +# Test Vector 20 +# Ed448ph +PrivateKeyRaw = EDDSA-TV-20-Raw:ED448:833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42ef7822e0d5104127dc05d6dbefde69e3ab2cec7c867c6e2c49 + +PublicKeyRaw = EDDSA-TV-20-PUBLIC-Raw:ED448:259b71c19f83ef77a7abd26524cbdb3161b590a48f7d17de3ee0ba9c52beb743c09428a131d6b1b57303d90d8132c276d5ed3d5d01c0f53880 + +PrivPubKeyPair = EDDSA-TV-20-Raw:EDDSA-TV-20-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448ph:EDDSA-TV-20-Raw +Input = 616263 +Ctrl = hexcontext-string: +Output = 822f6901f7480f3d5f562c592994d9693602875614483256505600bbc281ae381f54d6bce2ea911574932f52a4e6cadd78769375ec3ffd1b801a0d9b3f4030cd433964b6457ea39476511214f97469b57dd32dbc560a9a94d00bff07620464a3ad203df7dc7ce360c3cd3696d9d9fab90f00 + +# Same as the Sign-Message above, but with a pre-hashed input. Input was +# generated with: +# echo 616263 | xxd -r -p | openssl shake256 -binary -xoflen | xxd -p -c 0 +FIPSversion = >=3.4.0 +Sign = Ed448ph:EDDSA-TV-20-Raw +Input = 483366601360a8771c6863080cc4114d8db44530f8f1e1ee4f94ea37e78b5739d5a15bef186a5386c75744c0527e1faa9f8726e462a12a4feb06bd8801e751e4 +Ctrl = hexcontext-string: +Output = 822f6901f7480f3d5f562c592994d9693602875614483256505600bbc281ae381f54d6bce2ea911574932f52a4e6cadd78769375ec3ffd1b801a0d9b3f4030cd433964b6457ea39476511214f97469b57dd32dbc560a9a94d00bff07620464a3ad203df7dc7ce360c3cd3696d9d9fab90f00 + +# Test Vector 21 +# Ed448ph +PrivateKeyRaw = EDDSA-TV-21-Raw:ED448:833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42ef7822e0d5104127dc05d6dbefde69e3ab2cec7c867c6e2c49 + +PublicKeyRaw = EDDSA-TV-21-PUBLIC-Raw:ED448:259b71c19f83ef77a7abd26524cbdb3161b590a48f7d17de3ee0ba9c52beb743c09428a131d6b1b57303d90d8132c276d5ed3d5d01c0f53880 + +PrivPubKeyPair = EDDSA-TV-21-Raw:EDDSA-TV-21-PUBLIC-Raw + +FIPSversion = >=3.4.0 +Sign-Message = Ed448ph:EDDSA-TV-21-Raw +Input = 616263 +Ctrl = hexcontext-string:666f6f +Output = c32299d46ec8ff02b54540982814dce9a05812f81962b649d528095916a2aa481065b1580423ef927ecf0af5888f90da0f6a9a85ad5dc3f280d91224ba9911a3653d00e484e2ce232521481c8658df304bb7745a73514cdb9bf3e15784ab71284f8d0704a608c54a6b62d97beb511d132100 + +# Same as the Sign-Message above, but with a pre-hashed input. Input was +# generated with: +# echo 616263 | xxd -r -p | openssl shake256 -binary -xoflen 64 | xxd -p -c 0 +FIPSversion = >=3.4.0 +Sign = Ed448ph:EDDSA-TV-21-Raw +Input = 483366601360a8771c6863080cc4114d8db44530f8f1e1ee4f94ea37e78b5739d5a15bef186a5386c75744c0527e1faa9f8726e462a12a4feb06bd8801e751e4 +Ctrl = hexcontext-string:666f6f +Output = c32299d46ec8ff02b54540982814dce9a05812f81962b649d528095916a2aa481065b1580423ef927ecf0af5888f90da0f6a9a85ad5dc3f280d91224ba9911a3653d00e484e2ce232521481c8658df304bb7745a73514cdb9bf3e15784ab71284f8d0704a608c54a6b62d97beb511d132100 |