mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-29 04:20:12 +00:00
Follow parameter naming convention
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
This commit is contained in:
parent
8b05e3b148
commit
e5b8585f1e
@ -170,8 +170,8 @@ void mbedtls_mpi_core_cond_assign( mbedtls_mpi_uint *X,
|
|||||||
mbedtls_ct_mpi_uint_cond_assign( limbs, X, A, assign );
|
mbedtls_ct_mpi_uint_cond_assign( limbs, X, A, assign );
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_mpi_core_cond_swap( mbedtls_mpi_uint *A,
|
void mbedtls_mpi_core_cond_swap( mbedtls_mpi_uint *X,
|
||||||
mbedtls_mpi_uint *B,
|
mbedtls_mpi_uint *Y,
|
||||||
size_t limbs,
|
size_t limbs,
|
||||||
unsigned char swap )
|
unsigned char swap )
|
||||||
{
|
{
|
||||||
@ -180,9 +180,9 @@ void mbedtls_mpi_core_cond_swap( mbedtls_mpi_uint *A,
|
|||||||
|
|
||||||
for( size_t i = 0; i < limbs; i++ )
|
for( size_t i = 0; i < limbs; i++ )
|
||||||
{
|
{
|
||||||
mbedtls_mpi_uint tmp = A[i];
|
mbedtls_mpi_uint tmp = X[i];
|
||||||
A[i] = ( A[i] & ~limb_mask ) | ( B[i] & limb_mask );
|
X[i] = ( X[i] & ~limb_mask ) | ( Y[i] & limb_mask );
|
||||||
B[i] = ( B[i] & ~limb_mask ) | ( tmp & limb_mask );
|
Y[i] = ( Y[i] & ~limb_mask ) | ( tmp & limb_mask );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,25 +103,25 @@ void mbedtls_mpi_core_cond_assign( mbedtls_mpi_uint *X,
|
|||||||
* \brief Perform a safe conditional swap of MPI which doesn't reveal whether
|
* \brief Perform a safe conditional swap of MPI which doesn't reveal whether
|
||||||
* the condition was true or not.
|
* the condition was true or not.
|
||||||
*
|
*
|
||||||
* \param[IN,OUT] A The address of the first MPI.
|
* \param[IN,OUT] X The address of the first MPI.
|
||||||
* This must be initialized.
|
* This must be initialized.
|
||||||
* \param[IN,OUT] B The address of the second MPI.
|
* \param[IN,OUT] Y The address of the second MPI.
|
||||||
* This must be initialized.
|
* This must be initialized.
|
||||||
* \param limbs The number of limbs of \p A and \p B.
|
* \param limbs The number of limbs of \p X and \p Y.
|
||||||
* \param swap The condition deciding whether to perform
|
* \param swap The condition deciding whether to perform
|
||||||
* the swap or not. Must be either 0 or 1:
|
* the swap or not. Must be either 0 or 1:
|
||||||
* * \c 1: Swap the values of \p A and \p B.
|
* * \c 1: Swap the values of \p X and \p Y.
|
||||||
* * \c 0: Keep the original values of \p A and \p B.
|
* * \c 0: Keep the original values of \p X and \p Y.
|
||||||
*
|
*
|
||||||
* \note This function avoids leaking any information about whether
|
* \note This function avoids leaking any information about whether
|
||||||
* the swap was done or not.
|
* the swap was done or not.
|
||||||
*
|
*
|
||||||
* \warning If \p swap is neither 0 nor 1, the result of this function
|
* \warning If \p swap is neither 0 nor 1, the result of this function
|
||||||
* is indeterminate, and both \p A and \p B might end up with
|
* is indeterminate, and both \p X and \p Y might end up with
|
||||||
* values different to either of the original ones.
|
* values different to either of the original ones.
|
||||||
*/
|
*/
|
||||||
void mbedtls_mpi_core_cond_swap( mbedtls_mpi_uint *A,
|
void mbedtls_mpi_core_cond_swap( mbedtls_mpi_uint *X,
|
||||||
mbedtls_mpi_uint *B,
|
mbedtls_mpi_uint *Y,
|
||||||
size_t limbs,
|
size_t limbs,
|
||||||
unsigned char swap );
|
unsigned char swap );
|
||||||
|
|
||||||
|
@ -43,18 +43,18 @@
|
|||||||
|
|
||||||
void mbedtls_mpi_mod_raw_cond_assign( mbedtls_mpi_uint *X,
|
void mbedtls_mpi_mod_raw_cond_assign( mbedtls_mpi_uint *X,
|
||||||
const mbedtls_mpi_uint *A,
|
const mbedtls_mpi_uint *A,
|
||||||
const mbedtls_mpi_mod_modulus *m,
|
const mbedtls_mpi_mod_modulus *N,
|
||||||
unsigned char assign )
|
unsigned char assign )
|
||||||
{
|
{
|
||||||
mbedtls_mpi_core_cond_assign( X, A, m->limbs, assign );
|
mbedtls_mpi_core_cond_assign( X, A, N->limbs, assign );
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbedtls_mpi_mod_raw_cond_swap( mbedtls_mpi_uint *A,
|
void mbedtls_mpi_mod_raw_cond_swap( mbedtls_mpi_uint *X,
|
||||||
mbedtls_mpi_uint *B,
|
mbedtls_mpi_uint *Y,
|
||||||
const mbedtls_mpi_mod_modulus *m,
|
const mbedtls_mpi_mod_modulus *N,
|
||||||
unsigned char swap )
|
unsigned char swap )
|
||||||
{
|
{
|
||||||
mbedtls_mpi_core_cond_swap( A, B, m->limbs, swap );
|
mbedtls_mpi_core_cond_swap( X, Y, N->limbs, swap );
|
||||||
}
|
}
|
||||||
|
|
||||||
int mbedtls_mpi_mod_raw_read( mbedtls_mpi_uint *X,
|
int mbedtls_mpi_mod_raw_read( mbedtls_mpi_uint *X,
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
*
|
*
|
||||||
* \param[OUT] X The address of the first MPI. This must be initialized.
|
* \param[OUT] X The address of the first MPI. This must be initialized.
|
||||||
* \param[IN] A The address of the second MPI. This must be initialized.
|
* \param[IN] A The address of the second MPI. This must be initialized.
|
||||||
* \param[IN] m The address of the modulus related to \p X and \p A.
|
* \param[IN] N The address of the modulus related to \p X and \p A.
|
||||||
* \param assign The condition deciding whether to perform the
|
* \param assign The condition deciding whether to perform the
|
||||||
* assignment or not. Must be either 0 or 1:
|
* assignment or not. Must be either 0 or 1:
|
||||||
* * \c 1: Perform the assignment `X = A`.
|
* * \c 1: Perform the assignment `X = A`.
|
||||||
@ -54,31 +54,31 @@
|
|||||||
*/
|
*/
|
||||||
void mbedtls_mpi_mod_raw_cond_assign( mbedtls_mpi_uint *X,
|
void mbedtls_mpi_mod_raw_cond_assign( mbedtls_mpi_uint *X,
|
||||||
const mbedtls_mpi_uint *A,
|
const mbedtls_mpi_uint *A,
|
||||||
const mbedtls_mpi_mod_modulus *m,
|
const mbedtls_mpi_mod_modulus *N,
|
||||||
unsigned char assign );
|
unsigned char assign );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Perform a safe conditional swap of MPI which doesn't reveal whether
|
* \brief Perform a safe conditional swap of MPI which doesn't reveal whether
|
||||||
* the condition was true or not.
|
* the condition was true or not.
|
||||||
*
|
*
|
||||||
* \param[IN,OUT] A The address of the first MPI. This must be initialized.
|
* \param[IN,OUT] X The address of the first MPI. This must be initialized.
|
||||||
* \param[IN,OUT] B The address of the second MPI. This must be initialized.
|
* \param[IN,OUT] Y The address of the second MPI. This must be initialized.
|
||||||
* \param[IN] m The address of the modulus related to \p A and \p B.
|
* \param[IN] N The address of the modulus related to \p X and \p Y.
|
||||||
* \param swap The condition deciding whether to perform
|
* \param swap The condition deciding whether to perform
|
||||||
* the swap or not. Must be either 0 or 1:
|
* the swap or not. Must be either 0 or 1:
|
||||||
* * \c 1: Swap the values of \p A and \p B.
|
* * \c 1: Swap the values of \p X and \p Y.
|
||||||
* * \c 0: Keep the original values of \p A and \p B.
|
* * \c 0: Keep the original values of \p X and \p Y.
|
||||||
*
|
*
|
||||||
* \note This function avoids leaking any information about whether
|
* \note This function avoids leaking any information about whether
|
||||||
* the swap was done or not.
|
* the swap was done or not.
|
||||||
*
|
*
|
||||||
* \warning If \p swap is neither 0 nor 1, the result of this function
|
* \warning If \p swap is neither 0 nor 1, the result of this function
|
||||||
* is indeterminate, and both \p A and \p B might end up with
|
* is indeterminate, and both \p X and \p Y might end up with
|
||||||
* values different to either of the original ones.
|
* values different to either of the original ones.
|
||||||
*/
|
*/
|
||||||
void mbedtls_mpi_mod_raw_cond_swap( mbedtls_mpi_uint *A,
|
void mbedtls_mpi_mod_raw_cond_swap( mbedtls_mpi_uint *X,
|
||||||
mbedtls_mpi_uint *B,
|
mbedtls_mpi_uint *Y,
|
||||||
const mbedtls_mpi_mod_modulus *m,
|
const mbedtls_mpi_mod_modulus *N,
|
||||||
unsigned char swap );
|
unsigned char swap );
|
||||||
|
|
||||||
/** Import X from unsigned binary data.
|
/** Import X from unsigned binary data.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user