Blame include/crypto/ec.h

Packit c4476c
/*
Packit c4476c
 * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
 *
Packit c4476c
 * Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
 * this file except in compliance with the License.  You can obtain a copy
Packit c4476c
 * in the file LICENSE in the source distribution or at
Packit c4476c
 * https://www.openssl.org/source/license.html
Packit c4476c
 */
Packit c4476c
Packit c4476c
/* Internal EC functions for other submodules: not for application use */
Packit c4476c
Packit c4476c
#ifndef OSSL_CRYPTO_EC_H
Packit c4476c
# define OSSL_CRYPTO_EC_H
Packit c4476c
# include <openssl/opensslconf.h>
Packit c4476c
Packit c4476c
# ifndef OPENSSL_NO_EC
Packit c4476c
Packit c4476c
#  include <openssl/ec.h>
Packit c4476c
Packit c4476c
/*-
Packit c4476c
 * Computes the multiplicative inverse of x in the range
Packit c4476c
 * [1,EC_GROUP::order), where EC_GROUP::order is the cardinality of the
Packit c4476c
 * subgroup generated by the generator G:
Packit c4476c
 *
Packit c4476c
 *         res := x^(-1) (mod EC_GROUP::order).
Packit c4476c
 *
Packit c4476c
 * This function expects the following two conditions to hold:
Packit c4476c
 *  - the EC_GROUP order is prime, and
Packit c4476c
 *  - x is included in the range [1, EC_GROUP::order).
Packit c4476c
 *
Packit c4476c
 * This function returns 1 on success, 0 on error.
Packit c4476c
 *
Packit c4476c
 * If the EC_GROUP order is even, this function explicitly returns 0 as
Packit c4476c
 * an error.
Packit c4476c
 * In case any of the two conditions stated above is not satisfied,
Packit c4476c
 * the correctness of its output is not guaranteed, even if the return
Packit c4476c
 * value could still be 1 (as primality testing and a conditional modular
Packit c4476c
 * reduction round on the input can be omitted by the underlying
Packit c4476c
 * implementations for better SCA properties on regular input values).
Packit c4476c
 */
Packit c4476c
__owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
Packit c4476c
                                   const BIGNUM *x, BN_CTX *ctx);
Packit c4476c
Packit c4476c
/*-
Packit c4476c
 * ECDH Key Derivation Function as defined in ANSI X9.63
Packit c4476c
 */
Packit c4476c
int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
Packit c4476c
                   const unsigned char *Z, size_t Zlen,
Packit c4476c
                   const unsigned char *sinfo, size_t sinfolen,
Packit c4476c
                   const EVP_MD *md);
Packit c4476c
Packit c4476c
# endif /* OPENSSL_NO_EC */
Packit c4476c
#endif