1/*
2 * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License").  You may not use
5 * this file except in compliance with the License.  You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#define ISX448(id)      ((id) == EVP_PKEY_X448)
11#define IS25519(id)     ((id) == EVP_PKEY_X25519 || (id) == EVP_PKEY_ED25519)
12#define KEYLENID(id)    (IS25519(id) ? X25519_KEYLEN \
13                                     : ((id) == EVP_PKEY_X448 ? X448_KEYLEN \
14                                                              : ED448_KEYLEN))
15#define KEYNID2TYPE(id) \
16    (IS25519(id) ? ((id) == EVP_PKEY_X25519 ? ECX_KEY_TYPE_X25519 \
17                                            : ECX_KEY_TYPE_ED25519) \
18                 : ((id) == EVP_PKEY_X448 ? ECX_KEY_TYPE_X448 \
19                                          : ECX_KEY_TYPE_ED448))
20#define KEYLEN(p)       KEYLENID((p)->ameth->pkey_id)
21