blob: 3d4afedff629bcae1eb9720bcc6fa9d964593552 [file] [log] [blame]
Gabor Mezei9684d4d2023-01-16 16:50:11 +01001/**
Gabor Mezeiaaa1d2a2023-01-23 16:13:43 +01002 * \file bignum_mod_raw_invasive.h
Gabor Mezei9684d4d2023-01-16 16:50:11 +01003 *
Gabor Mezeiaaa1d2a2023-01-23 16:13:43 +01004 * \brief Function declarations for invasive functions of Low-level
5 * modular bignum.
Gabor Mezei9684d4d2023-01-16 16:50:11 +01006 */
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
Gabor Mezeiaaa1d2a2023-01-23 16:13:43 +010024#ifndef MBEDTLS_BIGNUM_MOD_RAW_INVASIVE_H
25#define MBEDTLS_BIGNUM_MOD_RAW_INVASIVE_H
Gabor Mezei9684d4d2023-01-16 16:50:11 +010026
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 Mezeiaaa1d2a2023-01-23 16:13:43 +010043MBEDTLS_STATIC_TESTABLE
44int mbedtls_mpi_mod_raw_fix_quasi_reduction(mbedtls_mpi_uint *X,
45 const mbedtls_mpi_mod_modulus *N);
Gabor Mezei9684d4d2023-01-16 16:50:11 +010046
Gabor Mezeiaaa1d2a2023-01-23 16:13:43 +010047#endif /* MBEDTLS_BIGNUM_MOD_RAW_INVASIVE_H */