Helper routines for MPI. More...
#include "core/crypto.h"
Go to the source code of this file.
Functions | |
error_t | mpiMontgomeryMul (Mpi *r, const Mpi *a, const Mpi *b, uint_t k, const Mpi *p, Mpi *t) |
Montgomery multiplication. More... | |
error_t | mpiMontgomeryRed (Mpi *r, const Mpi *a, uint_t k, const Mpi *p, Mpi *t) |
Montgomery reduction. More... | |
void | mpiMulAccCore (mpi_word_t *r, const mpi_word_t *a, int_t m, const mpi_word_t b) |
Multiply-accumulate operation. More... | |
Detailed Description
Helper routines for MPI.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCRYPTO Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file mpi_misc.h.
Function Documentation
◆ mpiMontgomeryMul()
error_t mpiMontgomeryMul | ( | Mpi * | r, |
const Mpi * | a, | ||
const Mpi * | b, | ||
uint_t | k, | ||
const Mpi * | p, | ||
Mpi * | t | ||
) |
Montgomery multiplication.
- Parameters
-
[out] r Resulting integer R = A * B / 2^k mod P [in] a An integer A such as 0 <= A < 2^k [in] b An integer B such as 0 <= B < 2^k [in] k An integer k such as P < 2^k [in] p Modulus P [in] t An preallocated integer T (for internal operation)
- Returns
- Error code
Definition at line 55 of file mpi_misc.c.
◆ mpiMontgomeryRed()
Montgomery reduction.
- Parameters
-
[out] r Resulting integer R = A / 2^k mod P [in] a An integer A such as 0 <= A < 2^k [in] k An integer k such as P < 2^k [in] p Modulus P [in] t An preallocated integer T (for internal operation)
- Returns
- Error code
Definition at line 128 of file mpi_misc.c.
◆ mpiMulAccCore()
void mpiMulAccCore | ( | mpi_word_t * | r, |
const mpi_word_t * | a, | ||
int_t | m, | ||
const mpi_word_t | b | ||
) |
Multiply-accumulate operation.
- Parameters
-
[out] r Resulting integer [in] a First operand A [in] m Size of A in words [in] b Second operand B
Definition at line 159 of file mpi_misc.c.