mirror of
https://github.com/yuzu-mirror/mbedtls.git
synced 2026-04-20 22:05:15 +00:00
Add new, constant time mpi comparison
This commit is contained in:
parent
c87a54683b
commit
e0187b95f0
2 changed files with 105 additions and 0 deletions
|
|
@ -484,6 +484,25 @@ int mbedtls_mpi_cmp_abs( const mbedtls_mpi *X, const mbedtls_mpi *Y );
|
|||
*/
|
||||
int mbedtls_mpi_cmp_mpi( const mbedtls_mpi *X, const mbedtls_mpi *Y );
|
||||
|
||||
/**
|
||||
* \brief Compare two MPIs in constant time.
|
||||
*
|
||||
* \param X The left-hand MPI. This must point to an initialized MPI
|
||||
* with the same allocated length as Y.
|
||||
* \param Y The right-hand MPI. This must point to an initialized MPI
|
||||
* with the same allocated length as X.
|
||||
* \param ret The result of the comparison:
|
||||
* \c 1 if \p X is greater than \p Y.
|
||||
* \c -1 if \p X is lesser than \p Y.
|
||||
* \c 0 if \p X is equal to \p Y.
|
||||
*
|
||||
* \return 0 on success.
|
||||
* \return MBEDTLS_ERR_MPI_BAD_INPUT_DATA if the allocated length of
|
||||
* the two input MPIs is not the same.
|
||||
*/
|
||||
int mbedtls_mpi_cmp_mpi_ct( const mbedtls_mpi *X, const mbedtls_mpi *Y,
|
||||
int *ret );
|
||||
|
||||
/**
|
||||
* \brief Compare signed values
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue