blob: 8677dcf1f01feab63c5919f0ebe2b9ec8700d206 [file] [log] [blame]
Hanno Beckeraef9cc42022-04-11 06:36:29 +01001/**
2 * Internal bignum functions
3 *
4 * Copyright The Mbed TLS Contributors
5 * SPDX-License-Identifier: Apache-2.0
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20#ifndef MBEDTLS_BIGNUM_INTERNAL_H
21#define MBEDTLS_BIGNUM_INTERNAL_H
22
23#include "common.h"
24
25#if defined(MBEDTLS_BIGNUM_C)
26#include "mbedtls/bignum.h"
27#endif
28
Hanno Beckerdfcb2d02022-04-11 13:44:15 +010029/** Perform a known-size multiply accumulate operation
Hanno Beckeraef9cc42022-04-11 06:36:29 +010030 *
31 * Add \p b * \p s to \p d.
32 *
Hanno Beckerdfcb2d02022-04-11 13:44:15 +010033 * \param[in,out] d The pointer to the (little-endian) array
34 * representing the bignum to accumulate onto.
Hanno Beckeraef9cc42022-04-11 06:36:29 +010035 * \param d_len The number of limbs of \p d. This must be
36 * at least \p s_len.
Hanno Beckerdfcb2d02022-04-11 13:44:15 +010037 * \param[in] s The pointer to the (little-endian) array
38 * representing the bignum to multiply with.
39 * This may be the same as \p d. Otherwise,
40 * it must be disjoint from \p d.
Hanno Beckeraef9cc42022-04-11 06:36:29 +010041 * \param s_len The number of limbs of \p s.
Hanno Beckerdfcb2d02022-04-11 13:44:15 +010042 * \param b A scalar to multiply with.
Hanno Beckeraef9cc42022-04-11 06:36:29 +010043 *
44 * \return c The carry at the end of the operation.
45 */
46mbedtls_mpi_uint mbedtls_mpi_core_mla( mbedtls_mpi_uint *d, size_t d_len ,
47 const mbedtls_mpi_uint *s, size_t s_len,
48 mbedtls_mpi_uint b );
49
50#endif /* MBEDTLS_BIGNUM_INTERNAL_H */