XenevaOS
Loading...
Searching...
No Matches
Functions
bignum_internal.h File Reference

Internal-only bignum public-key cryptosystem API. More...

Go to the source code of this file.

Functions

int mbedtls_mpi_exp_mod_unsafe (mbedtls_mpi *X, const mbedtls_mpi *A, const mbedtls_mpi *E, const mbedtls_mpi *N, mbedtls_mpi *prec_RR)
 Perform a modular exponentiation: X = A^E mod N.
 

Detailed Description

Internal-only bignum public-key cryptosystem API.

This file declares bignum-related functions that are to be used only from within the Mbed TLS library itself.

Function Documentation

◆ mbedtls_mpi_exp_mod_unsafe()

int mbedtls_mpi_exp_mod_unsafe ( mbedtls_mpi *  X,
const mbedtls_mpi *  A,
const mbedtls_mpi *  E,
const mbedtls_mpi *  N,
mbedtls_mpi *  prec_RR 
)

Perform a modular exponentiation: X = A^E mod N.

Warning
This function is not constant time with respect to E (the exponent).
Parameters
XThe destination MPI. This must point to an initialized MPI. This must not alias E or N.
AThe base of the exponentiation. This must point to an initialized MPI.
EThe exponent MPI. This must point to an initialized MPI.
NThe base for the modular reduction. This must point to an initialized MPI.
prec_RRA helper MPI depending solely on N which can be used to speed-up multiple modular exponentiations for the same value of N. This may be NULL. If it is not NULL, it must point to an initialized MPI. If it hasn't been used after the call to mbedtls_mpi_init(), this function will compute the helper value and store it in prec_RR for reuse on subsequent calls to this function. Otherwise, the function will assume that prec_RR holds the helper value set by a previous call to mbedtls_mpi_exp_mod(), and reuse it.
Returns
0 if successful.
MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
MBEDTLS_ERR_MPI_BAD_INPUT_DATA if N is negative or even, or if E is negative.
Another negative error code on different kinds of failures.