Hanno Becker | aef9cc4 | 2022-04-11 06:36:29 +0100 | [diff] [blame] | 1 | /** |
| 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 Becker | dfcb2d0 | 2022-04-11 13:44:15 +0100 | [diff] [blame] | 29 | /** Perform a known-size multiply accumulate operation |
Hanno Becker | aef9cc4 | 2022-04-11 06:36:29 +0100 | [diff] [blame] | 30 | * |
| 31 | * Add \p b * \p s to \p d. |
| 32 | * |
Hanno Becker | dfcb2d0 | 2022-04-11 13:44:15 +0100 | [diff] [blame] | 33 | * \param[in,out] d The pointer to the (little-endian) array |
| 34 | * representing the bignum to accumulate onto. |
Hanno Becker | aef9cc4 | 2022-04-11 06:36:29 +0100 | [diff] [blame] | 35 | * \param d_len The number of limbs of \p d. This must be |
| 36 | * at least \p s_len. |
Hanno Becker | dfcb2d0 | 2022-04-11 13:44:15 +0100 | [diff] [blame] | 37 | * \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 Becker | aef9cc4 | 2022-04-11 06:36:29 +0100 | [diff] [blame] | 41 | * \param s_len The number of limbs of \p s. |
Hanno Becker | dfcb2d0 | 2022-04-11 13:44:15 +0100 | [diff] [blame] | 42 | * \param b A scalar to multiply with. |
Hanno Becker | aef9cc4 | 2022-04-11 06:36:29 +0100 | [diff] [blame] | 43 | * |
| 44 | * \return c The carry at the end of the operation. |
| 45 | */ |
| 46 | mbedtls_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 */ |