]>
Commit | Line | Data |
---|---|---|
5a212462 | 1 | /* |
33388b44 | 2 | * Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved. |
5a212462 | 3 | * |
48f4ad77 | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5a212462 NT |
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 | /* Internal EC functions for other submodules: not for application use */ | |
11 | ||
ae4186b0 DMSP |
12 | #ifndef OSSL_CRYPTO_EC_H |
13 | # define OSSL_CRYPTO_EC_H | |
5a212462 NT |
14 | # include <openssl/opensslconf.h> |
15 | ||
16 | # ifndef OPENSSL_NO_EC | |
0abae163 | 17 | # include <openssl/core.h> |
5a212462 NT |
18 | # include <openssl/ec.h> |
19 | ||
20 | /*- | |
21 | * Computes the multiplicative inverse of x in the range | |
22 | * [1,EC_GROUP::order), where EC_GROUP::order is the cardinality of the | |
23 | * subgroup generated by the generator G: | |
24 | * | |
25 | * res := x^(-1) (mod EC_GROUP::order). | |
26 | * | |
27 | * This function expects the following two conditions to hold: | |
28 | * - the EC_GROUP order is prime, and | |
29 | * - x is included in the range [1, EC_GROUP::order). | |
30 | * | |
31 | * This function returns 1 on success, 0 on error. | |
32 | * | |
33 | * If the EC_GROUP order is even, this function explicitly returns 0 as | |
34 | * an error. | |
35 | * In case any of the two conditions stated above is not satisfied, | |
36 | * the correctness of its output is not guaranteed, even if the return | |
37 | * value could still be 1 (as primality testing and a conditional modular | |
38 | * reduction round on the input can be omitted by the underlying | |
39 | * implementations for better SCA properties on regular input values). | |
40 | */ | |
41 | __owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, | |
42 | const BIGNUM *x, BN_CTX *ctx); | |
43 | ||
ffd89124 AS |
44 | /*- |
45 | * ECDH Key Derivation Function as defined in ANSI X9.63 | |
46 | */ | |
47 | int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, | |
48 | const unsigned char *Z, size_t Zlen, | |
49 | const unsigned char *sinfo, size_t sinfolen, | |
50 | const EVP_MD *md); | |
51 | ||
47c239c6 | 52 | int ec_generate_key(OPENSSL_CTX *libctx, EC_KEY *eckey, int pairwise_test); |
a173cc9c SL |
53 | int ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx); |
54 | int ec_key_private_check(const EC_KEY *eckey); | |
55 | int ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx); | |
56 | OPENSSL_CTX *ec_key_get_libctx(const EC_KEY *eckey); | |
1c725f46 SL |
57 | const char *ec_curve_nid2name(int nid); |
58 | int ec_curve_name2nid(const char *name); | |
edd3b7a3 | 59 | const unsigned char *ecdsa_algorithmidentifier_encoding(int md_nid, size_t *len); |
0abae163 RL |
60 | |
61 | /* Backend support */ | |
62 | int ec_key_fromdata(EC_KEY *ecx, const OSSL_PARAM params[], int include_private); | |
63 | int ec_key_domparams_fromdata(EC_KEY *ecx, const OSSL_PARAM params[]); | |
64 | int ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[]); | |
65 | int ec_set_param_ecdh_cofactor_mode(EC_KEY *ec, const OSSL_PARAM *p); | |
66 | ||
5a212462 NT |
67 | # endif /* OPENSSL_NO_EC */ |
68 | #endif |