blob: b028225e6172ef2c4b28104ea02970718dc91114 [file] [log] [blame]
Gabor Mezei9684d4d2023-01-16 16:50:11 +01001/**
2 * \file ecp_internal.h
3 *
4 * \brief Function declarations for internal functions of elliptic curve
5 * point arithmetic.
6 */
7/**
8 * Copyright The Mbed TLS Contributors
9 * SPDX-License-Identifier: Apache-2.0
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License"); you may
12 * not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
19 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
24#ifndef MBEDTLS_ECP_INTERNAL_H
25#define MBEDTLS_ECP_INTERNAL_H
26
27#include "common.h"
28#include "mbedtls/bignum.h"
29#include "bignum_mod.h"
30
Gabor Mezeic83f7922023-01-17 13:28:06 +010031/** Convert an MPI to its canonical representative.
32 *
33 * \note Currently handles the case when `N->int_rep` is
34 * MBEDTLS_MPI_MOD_REP_MONTGOMERY.
35 *
36 * \param[in,out] X The address of the MPI to be converted. Must have the
37 * same number of limbs as \p N.
38 * \param[in] N The address of the modulus.
39 *
40 * \return \c 0 if successful.
41 * \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p N is invalid.
42 */
Gabor Mezei9684d4d2023-01-16 16:50:11 +010043int mbedtls_ecp_quasi_reduction(mbedtls_mpi_uint *X,
44 const mbedtls_mpi_mod_modulus *N);
45
46#endif /* MBEDTLS_ECP_INTERNAL_H */