Commit 7fd85ef726 for openssl.org

commit 7fd85ef726fb6db6c70086025a2470e2e28d0428
Author: Matt Caswell <matt@openssl.org>
Date:   Thu Dec 11 15:54:54 2025 +0000

    Delete the ECX EVP_PKEY_METHOD

    It is no longer used so can be removed

    Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
    Reviewed-by: Paul Yang <paulyang.inf@gmail.com>
    (Merged from https://github.com/openssl/openssl/pull/29384)

diff --git a/crypto/ec/ecx_meth.c b/crypto/ec/ecx_meth.c
index 7642954187..52af1803f4 100644
--- a/crypto/ec/ecx_meth.c
+++ b/crypto/ec/ecx_meth.c
@@ -709,760 +709,3 @@ const EVP_PKEY_ASN1_METHOD ossl_ed448_asn1_meth = {

     ecx_priv_decode_ex
 };
-
-static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
-{
-    ECX_KEY *ecx = ossl_ecx_key_op(NULL, NULL, 0, ctx->pmeth->pkey_id,
-        KEY_OP_KEYGEN, NULL, NULL);
-
-    if (ecx != NULL) {
-        EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, ecx);
-        return 1;
-    }
-    return 0;
-}
-
-static int validate_ecx_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
-    size_t *keylen,
-    const unsigned char **privkey,
-    const unsigned char **pubkey)
-{
-    const ECX_KEY *ecxkey, *peerkey;
-
-    if (ctx->pkey == NULL || ctx->peerkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_KEYS_NOT_SET);
-        return 0;
-    }
-    ecxkey = evp_pkey_get_legacy(ctx->pkey);
-    peerkey = evp_pkey_get_legacy(ctx->peerkey);
-    if (ecxkey == NULL || ecxkey->privkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_PRIVATE_KEY);
-        return 0;
-    }
-    if (peerkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_PEER_KEY);
-        return 0;
-    }
-    *privkey = ecxkey->privkey;
-    *pubkey = peerkey->pubkey;
-
-    return 1;
-}
-
-static int pkey_ecx_derive25519(EVP_PKEY_CTX *ctx, unsigned char *key,
-    size_t *keylen)
-{
-    const unsigned char *privkey, *pubkey;
-
-    if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
-        || (key != NULL
-            && ossl_x25519(key, privkey, pubkey) == 0))
-        return 0;
-    *keylen = X25519_KEYLEN;
-    return 1;
-}
-
-static int pkey_ecx_derive448(EVP_PKEY_CTX *ctx, unsigned char *key,
-    size_t *keylen)
-{
-    const unsigned char *privkey, *pubkey;
-
-    if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
-        || (key != NULL
-            && ossl_x448(key, privkey, pubkey) == 0))
-        return 0;
-    *keylen = X448_KEYLEN;
-    return 1;
-}
-
-static int pkey_ecx_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
-{
-    /* Only need to handle peer key for derivation */
-    if (type == EVP_PKEY_CTRL_PEER_KEY)
-        return 1;
-    return -2;
-}
-
-static const EVP_PKEY_METHOD ecx25519_pkey_meth = {
-    EVP_PKEY_X25519,
-    0, 0, 0, 0, 0, 0, 0,
-    pkey_ecx_keygen,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    pkey_ecx_derive25519,
-    pkey_ecx_ctrl,
-    0
-};
-
-static const EVP_PKEY_METHOD ecx448_pkey_meth = {
-    EVP_PKEY_X448,
-    0, 0, 0, 0, 0, 0, 0,
-    pkey_ecx_keygen,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    pkey_ecx_derive448,
-    pkey_ecx_ctrl,
-    0
-};
-
-static int pkey_ecd_digestsign25519(EVP_MD_CTX *ctx, unsigned char *sig,
-    size_t *siglen, const unsigned char *tbs,
-    size_t tbslen)
-{
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (sig == NULL) {
-        *siglen = ED25519_SIGSIZE;
-        return 1;
-    }
-    if (*siglen < ED25519_SIGSIZE) {
-        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
-        return 0;
-    }
-
-    if (ossl_ed25519_sign(sig, tbs, tbslen, edkey->pubkey, edkey->privkey,
-            0, 0, 0,
-            NULL, 0,
-            NULL, NULL)
-        == 0)
-        return 0;
-    *siglen = ED25519_SIGSIZE;
-    return 1;
-}
-
-static int pkey_ecd_digestsign448(EVP_MD_CTX *ctx, unsigned char *sig,
-    size_t *siglen, const unsigned char *tbs,
-    size_t tbslen)
-{
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (sig == NULL) {
-        *siglen = ED448_SIGSIZE;
-        return 1;
-    }
-    if (*siglen < ED448_SIGSIZE) {
-        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
-        return 0;
-    }
-
-    if (ossl_ed448_sign(edkey->libctx, sig, tbs, tbslen, edkey->pubkey,
-            edkey->privkey, NULL, 0, 0, edkey->propq)
-        == 0)
-        return 0;
-    *siglen = ED448_SIGSIZE;
-    return 1;
-}
-
-static int pkey_ecd_digestverify25519(EVP_MD_CTX *ctx, const unsigned char *sig,
-    size_t siglen, const unsigned char *tbs,
-    size_t tbslen)
-{
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (siglen != ED25519_SIGSIZE)
-        return 0;
-
-    return ossl_ed25519_verify(tbs, tbslen, sig, edkey->pubkey,
-        0, 0, 0,
-        NULL, 0,
-        edkey->libctx, edkey->propq);
-}
-
-static int pkey_ecd_digestverify448(EVP_MD_CTX *ctx, const unsigned char *sig,
-    size_t siglen, const unsigned char *tbs,
-    size_t tbslen)
-{
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (siglen != ED448_SIGSIZE)
-        return 0;
-
-    return ossl_ed448_verify(edkey->libctx, tbs, tbslen, sig, edkey->pubkey,
-        NULL, 0, 0, edkey->propq);
-}
-
-static int pkey_ecd_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
-{
-    switch (type) {
-    case EVP_PKEY_CTRL_MD:
-        /* Only NULL allowed as digest */
-        if (p2 == NULL || (const EVP_MD *)p2 == EVP_md_null())
-            return 1;
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_DIGEST_TYPE);
-        return 0;
-
-    case EVP_PKEY_CTRL_DIGESTINIT:
-        return 1;
-    }
-    return -2;
-}
-
-static const EVP_PKEY_METHOD ed25519_pkey_meth = {
-    EVP_PKEY_ED25519, EVP_PKEY_FLAG_SIGCTX_CUSTOM,
-    0, 0, 0, 0, 0, 0,
-    pkey_ecx_keygen,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    pkey_ecd_ctrl,
-    0,
-    pkey_ecd_digestsign25519,
-    pkey_ecd_digestverify25519
-};
-
-static const EVP_PKEY_METHOD ed448_pkey_meth = {
-    EVP_PKEY_ED448, EVP_PKEY_FLAG_SIGCTX_CUSTOM,
-    0, 0, 0, 0, 0, 0,
-    pkey_ecx_keygen,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    pkey_ecd_ctrl,
-    0,
-    pkey_ecd_digestsign448,
-    pkey_ecd_digestverify448
-};
-
-#ifdef S390X_EC_ASM
-#include "s390x_arch.h"
-
-static int s390x_pkey_ecx_keygen25519(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
-{
-    static const unsigned char generator[] = {
-        0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-    ECX_KEY *key = ossl_ecx_key_new(ctx->libctx, ECX_KEY_TYPE_X25519, 1,
-        ctx->propquery);
-    unsigned char *privkey = NULL, *pubkey;
-
-    if (key == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    pubkey = key->pubkey;
-
-    privkey = ossl_ecx_key_allocate_privkey(key);
-    if (privkey == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    if (RAND_priv_bytes_ex(ctx->libctx, privkey, X25519_KEYLEN, 0) <= 0)
-        goto err;
-
-    privkey[0] &= 248;
-    privkey[31] &= 127;
-    privkey[31] |= 64;
-
-    if (s390x_x25519_mul(pubkey, generator, privkey) != 1)
-        goto err;
-
-    EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
-    return 1;
-err:
-    ossl_ecx_key_free(key);
-    return 0;
-}
-
-static int s390x_pkey_ecx_keygen448(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
-{
-    static const unsigned char generator[] = {
-        0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-    };
-    ECX_KEY *key = ossl_ecx_key_new(ctx->libctx, ECX_KEY_TYPE_X448, 1,
-        ctx->propquery);
-    unsigned char *privkey = NULL, *pubkey;
-
-    if (key == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    pubkey = key->pubkey;
-
-    privkey = ossl_ecx_key_allocate_privkey(key);
-    if (privkey == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    if (RAND_priv_bytes_ex(ctx->libctx, privkey, X448_KEYLEN, 0) <= 0)
-        goto err;
-
-    privkey[0] &= 252;
-    privkey[55] |= 128;
-
-    if (s390x_x448_mul(pubkey, generator, privkey) != 1)
-        goto err;
-
-    EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
-    return 1;
-err:
-    ossl_ecx_key_free(key);
-    return 0;
-}
-
-static int s390x_pkey_ecd_keygen25519(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
-{
-    static const unsigned char generator_x[] = {
-        0x1a, 0xd5, 0x25, 0x8f, 0x60, 0x2d, 0x56, 0xc9, 0xb2, 0xa7, 0x25, 0x95,
-        0x60, 0xc7, 0x2c, 0x69, 0x5c, 0xdc, 0xd6, 0xfd, 0x31, 0xe2, 0xa4, 0xc0,
-        0xfe, 0x53, 0x6e, 0xcd, 0xd3, 0x36, 0x69, 0x21
-    };
-    static const unsigned char generator_y[] = {
-        0x58,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-        0x66,
-    };
-    unsigned char x_dst[32], buff[SHA512_DIGEST_LENGTH];
-    ECX_KEY *key = ossl_ecx_key_new(ctx->libctx, ECX_KEY_TYPE_ED25519, 1,
-        ctx->propquery);
-    unsigned char *privkey = NULL, *pubkey;
-    unsigned int sz;
-    EVP_MD *md = NULL;
-    int rv;
-
-    if (key == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    pubkey = key->pubkey;
-
-    privkey = ossl_ecx_key_allocate_privkey(key);
-    if (privkey == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    if (RAND_priv_bytes_ex(ctx->libctx, privkey, ED25519_KEYLEN, 0) <= 0)
-        goto err;
-
-    md = EVP_MD_fetch(ctx->libctx, "SHA512", ctx->propquery);
-    if (md == NULL)
-        goto err;
-
-    rv = EVP_Digest(privkey, 32, buff, &sz, md, NULL);
-    EVP_MD_free(md);
-    if (!rv)
-        goto err;
-
-    buff[0] &= 248;
-    buff[31] &= 63;
-    buff[31] |= 64;
-
-    if (s390x_ed25519_mul(x_dst, pubkey,
-            generator_x, generator_y, buff)
-        != 1)
-        goto err;
-
-    pubkey[31] |= ((x_dst[0] & 0x01) << 7);
-
-    EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
-    return 1;
-err:
-    ossl_ecx_key_free(key);
-    return 0;
-}
-
-static int s390x_pkey_ecd_keygen448(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
-{
-    static const unsigned char generator_x[] = {
-        0x5e, 0xc0, 0x0c, 0xc7, 0x2b, 0xa8, 0x26, 0x26, 0x8e, 0x93, 0x00, 0x8b,
-        0xe1, 0x80, 0x3b, 0x43, 0x11, 0x65, 0xb6, 0x2a, 0xf7, 0x1a, 0xae, 0x12,
-        0x64, 0xa4, 0xd3, 0xa3, 0x24, 0xe3, 0x6d, 0xea, 0x67, 0x17, 0x0f, 0x47,
-        0x70, 0x65, 0x14, 0x9e, 0xda, 0x36, 0xbf, 0x22, 0xa6, 0x15, 0x1d, 0x22,
-        0xed, 0x0d, 0xed, 0x6b, 0xc6, 0x70, 0x19, 0x4f, 0x00
-    };
-    static const unsigned char generator_y[] = {
-        0x14, 0xfa, 0x30, 0xf2, 0x5b, 0x79, 0x08, 0x98, 0xad, 0xc8, 0xd7, 0x4e,
-        0x2c, 0x13, 0xbd, 0xfd, 0xc4, 0x39, 0x7c, 0xe6, 0x1c, 0xff, 0xd3, 0x3a,
-        0xd7, 0xc2, 0xa0, 0x05, 0x1e, 0x9c, 0x78, 0x87, 0x40, 0x98, 0xa3, 0x6c,
-        0x73, 0x73, 0xea, 0x4b, 0x62, 0xc7, 0xc9, 0x56, 0x37, 0x20, 0x76, 0x88,
-        0x24, 0xbc, 0xb6, 0x6e, 0x71, 0x46, 0x3f, 0x69, 0x00
-    };
-    unsigned char x_dst[57], buff[114];
-    ECX_KEY *key = ossl_ecx_key_new(ctx->libctx, ECX_KEY_TYPE_ED448, 1,
-        ctx->propquery);
-    unsigned char *privkey = NULL, *pubkey;
-    EVP_MD_CTX *hashctx = NULL;
-    EVP_MD *md = NULL;
-    int rv;
-
-    if (key == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    pubkey = key->pubkey;
-
-    privkey = ossl_ecx_key_allocate_privkey(key);
-    if (privkey == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB);
-        goto err;
-    }
-
-    if (RAND_priv_bytes_ex(ctx->libctx, privkey, ED448_KEYLEN, 0) <= 0)
-        goto err;
-
-    hashctx = EVP_MD_CTX_new();
-    if (hashctx == NULL)
-        goto err;
-
-    md = EVP_MD_fetch(ctx->libctx, "SHAKE256", ctx->propquery);
-    if (md == NULL)
-        goto err;
-
-    rv = EVP_DigestInit_ex(hashctx, md, NULL);
-    EVP_MD_free(md);
-    if (rv != 1)
-        goto err;
-
-    if (EVP_DigestUpdate(hashctx, privkey, 57) != 1)
-        goto err;
-    if (EVP_DigestFinalXOF(hashctx, buff, sizeof(buff)) != 1)
-        goto err;
-
-    buff[0] &= -4;
-    buff[55] |= 0x80;
-    buff[56] = 0;
-
-    if (s390x_ed448_mul(x_dst, pubkey,
-            generator_x, generator_y, buff)
-        != 1)
-        goto err;
-
-    pubkey[56] |= ((x_dst[0] & 0x01) << 7);
-
-    EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
-    EVP_MD_CTX_free(hashctx);
-    return 1;
-err:
-    ossl_ecx_key_free(key);
-    EVP_MD_CTX_free(hashctx);
-    return 0;
-}
-
-static int s390x_pkey_ecx_derive25519(EVP_PKEY_CTX *ctx, unsigned char *key,
-    size_t *keylen)
-{
-    const unsigned char *privkey, *pubkey;
-
-    if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
-        || (key != NULL
-            && s390x_x25519_mul(key, privkey, pubkey) == 0))
-        return 0;
-    *keylen = X25519_KEYLEN;
-    return 1;
-}
-
-static int s390x_pkey_ecx_derive448(EVP_PKEY_CTX *ctx, unsigned char *key,
-    size_t *keylen)
-{
-    const unsigned char *privkey, *pubkey;
-
-    if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
-        || (key != NULL
-            && s390x_x448_mul(key, pubkey, privkey) == 0))
-        return 0;
-    *keylen = X448_KEYLEN;
-    return 1;
-}
-
-static int s390x_pkey_ecd_digestsign25519(EVP_MD_CTX *ctx,
-    unsigned char *sig, size_t *siglen,
-    const unsigned char *tbs,
-    size_t tbslen)
-{
-    union {
-        struct {
-            unsigned char sig[64];
-            unsigned char priv[32];
-        } ed25519;
-        unsigned long long buff[512];
-    } param;
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-    int rc;
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (sig == NULL) {
-        *siglen = ED25519_SIGSIZE;
-        return 1;
-    }
-
-    if (*siglen < ED25519_SIGSIZE) {
-        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
-        return 0;
-    }
-
-    memset(&param, 0, sizeof(param));
-    memcpy(param.ed25519.priv, edkey->privkey, sizeof(param.ed25519.priv));
-
-    rc = s390x_kdsa(S390X_EDDSA_SIGN_ED25519, &param.ed25519, tbs, tbslen);
-    OPENSSL_cleanse(param.ed25519.priv, sizeof(param.ed25519.priv));
-    if (rc != 0)
-        return 0;
-
-    s390x_flip_endian32(sig, param.ed25519.sig);
-    s390x_flip_endian32(sig + 32, param.ed25519.sig + 32);
-
-    *siglen = ED25519_SIGSIZE;
-    return 1;
-}
-
-static int s390x_pkey_ecd_digestsign448(EVP_MD_CTX *ctx,
-    unsigned char *sig, size_t *siglen,
-    const unsigned char *tbs,
-    size_t tbslen)
-{
-    union {
-        struct {
-            unsigned char sig[128];
-            unsigned char priv[64];
-        } ed448;
-        unsigned long long buff[512];
-    } param;
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-    int rc;
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (sig == NULL) {
-        *siglen = ED448_SIGSIZE;
-        return 1;
-    }
-
-    if (*siglen < ED448_SIGSIZE) {
-        ERR_raise(ERR_LIB_EC, EC_R_BUFFER_TOO_SMALL);
-        return 0;
-    }
-
-    memset(&param, 0, sizeof(param));
-    memcpy(param.ed448.priv + 64 - 57, edkey->privkey, 57);
-
-    rc = s390x_kdsa(S390X_EDDSA_SIGN_ED448, &param.ed448, tbs, tbslen);
-    OPENSSL_cleanse(param.ed448.priv, sizeof(param.ed448.priv));
-    if (rc != 0)
-        return 0;
-
-    s390x_flip_endian64(param.ed448.sig, param.ed448.sig);
-    s390x_flip_endian64(param.ed448.sig + 64, param.ed448.sig + 64);
-    memcpy(sig, param.ed448.sig, 57);
-    memcpy(sig + 57, param.ed448.sig + 64, 57);
-
-    *siglen = ED448_SIGSIZE;
-    return 1;
-}
-
-static int s390x_pkey_ecd_digestverify25519(EVP_MD_CTX *ctx,
-    const unsigned char *sig,
-    size_t siglen,
-    const unsigned char *tbs,
-    size_t tbslen)
-{
-    union {
-        struct {
-            unsigned char sig[64];
-            unsigned char pub[32];
-        } ed25519;
-        unsigned long long buff[512];
-    } param;
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (siglen != ED25519_SIGSIZE)
-        return 0;
-
-    memset(&param, 0, sizeof(param));
-    s390x_flip_endian32(param.ed25519.sig, sig);
-    s390x_flip_endian32(param.ed25519.sig + 32, sig + 32);
-    s390x_flip_endian32(param.ed25519.pub, edkey->pubkey);
-
-    return s390x_kdsa(S390X_EDDSA_VERIFY_ED25519,
-               &param.ed25519, tbs, tbslen)
-            == 0
-        ? 1
-        : 0;
-}
-
-static int s390x_pkey_ecd_digestverify448(EVP_MD_CTX *ctx,
-    const unsigned char *sig,
-    size_t siglen,
-    const unsigned char *tbs,
-    size_t tbslen)
-{
-    union {
-        struct {
-            unsigned char sig[128];
-            unsigned char pub[64];
-        } ed448;
-        unsigned long long buff[512];
-    } param;
-    const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
-
-    if (edkey == NULL) {
-        ERR_raise(ERR_LIB_EC, EC_R_INVALID_KEY);
-        return 0;
-    }
-
-    if (siglen != ED448_SIGSIZE)
-        return 0;
-
-    memset(&param, 0, sizeof(param));
-    memcpy(param.ed448.sig, sig, 57);
-    s390x_flip_endian64(param.ed448.sig, param.ed448.sig);
-    memcpy(param.ed448.sig + 64, sig + 57, 57);
-    s390x_flip_endian64(param.ed448.sig + 64, param.ed448.sig + 64);
-    memcpy(param.ed448.pub, edkey->pubkey, 57);
-    s390x_flip_endian64(param.ed448.pub, param.ed448.pub);
-
-    return s390x_kdsa(S390X_EDDSA_VERIFY_ED448,
-               &param.ed448, tbs, tbslen)
-            == 0
-        ? 1
-        : 0;
-}
-
-static const EVP_PKEY_METHOD ecx25519_s390x_pkey_meth = {
-    EVP_PKEY_X25519,
-    0, 0, 0, 0, 0, 0, 0,
-    s390x_pkey_ecx_keygen25519,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    s390x_pkey_ecx_derive25519,
-    pkey_ecx_ctrl,
-    0
-};
-
-static const EVP_PKEY_METHOD ecx448_s390x_pkey_meth = {
-    EVP_PKEY_X448,
-    0, 0, 0, 0, 0, 0, 0,
-    s390x_pkey_ecx_keygen448,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    s390x_pkey_ecx_derive448,
-    pkey_ecx_ctrl,
-    0
-};
-static const EVP_PKEY_METHOD ed25519_s390x_pkey_meth = {
-    EVP_PKEY_ED25519, EVP_PKEY_FLAG_SIGCTX_CUSTOM,
-    0, 0, 0, 0, 0, 0,
-    s390x_pkey_ecd_keygen25519,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    pkey_ecd_ctrl,
-    0,
-    s390x_pkey_ecd_digestsign25519,
-    s390x_pkey_ecd_digestverify25519
-};
-
-static const EVP_PKEY_METHOD ed448_s390x_pkey_meth = {
-    EVP_PKEY_ED448, EVP_PKEY_FLAG_SIGCTX_CUSTOM,
-    0, 0, 0, 0, 0, 0,
-    s390x_pkey_ecd_keygen448,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    pkey_ecd_ctrl,
-    0,
-    s390x_pkey_ecd_digestsign448,
-    s390x_pkey_ecd_digestverify448
-};
-#endif
-
-const EVP_PKEY_METHOD *ossl_ecx25519_pkey_method(void)
-{
-#ifdef S390X_EC_ASM
-    if (OPENSSL_s390xcap_P.pcc[1] & S390X_CAPBIT(S390X_SCALAR_MULTIPLY_X25519))
-        return &ecx25519_s390x_pkey_meth;
-#endif
-    return &ecx25519_pkey_meth;
-}
-
-const EVP_PKEY_METHOD *ossl_ecx448_pkey_method(void)
-{
-#ifdef S390X_EC_ASM
-    if (OPENSSL_s390xcap_P.pcc[1] & S390X_CAPBIT(S390X_SCALAR_MULTIPLY_X448))
-        return &ecx448_s390x_pkey_meth;
-#endif
-    return &ecx448_pkey_meth;
-}
-
-const EVP_PKEY_METHOD *ossl_ed25519_pkey_method(void)
-{
-#ifdef S390X_EC_ASM
-    if (OPENSSL_s390xcap_P.pcc[1] & S390X_CAPBIT(S390X_SCALAR_MULTIPLY_ED25519)
-        && OPENSSL_s390xcap_P.kdsa[0] & S390X_CAPBIT(S390X_EDDSA_SIGN_ED25519)
-        && OPENSSL_s390xcap_P.kdsa[0]
-            & S390X_CAPBIT(S390X_EDDSA_VERIFY_ED25519))
-        return &ed25519_s390x_pkey_meth;
-#endif
-    return &ed25519_pkey_meth;
-}
-
-const EVP_PKEY_METHOD *ossl_ed448_pkey_method(void)
-{
-#ifdef S390X_EC_ASM
-    if (OPENSSL_s390xcap_P.pcc[1] & S390X_CAPBIT(S390X_SCALAR_MULTIPLY_ED448)
-        && OPENSSL_s390xcap_P.kdsa[0] & S390X_CAPBIT(S390X_EDDSA_SIGN_ED448)
-        && OPENSSL_s390xcap_P.kdsa[0] & S390X_CAPBIT(S390X_EDDSA_VERIFY_ED448))
-        return &ed448_s390x_pkey_meth;
-#endif
-    return &ed448_pkey_meth;
-}