mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-20 12:40:47 +00:00
mpi_core_ct_uint_table_lookup: style and docs
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
ef67d38bc0
commit
8904a2db29
@ -541,16 +541,15 @@ cleanup:
|
||||
}
|
||||
|
||||
void mbedtls_mpi_core_ct_uint_table_lookup( mbedtls_mpi_uint *dest,
|
||||
const mbedtls_mpi_uint *table,
|
||||
size_t limbs,
|
||||
size_t count,
|
||||
size_t index )
|
||||
const mbedtls_mpi_uint *table,
|
||||
size_t limbs,
|
||||
size_t count,
|
||||
size_t index )
|
||||
{
|
||||
for( size_t i = 0; i < count; i++ )
|
||||
for( size_t i = 0; i < count; i++, table += limbs )
|
||||
{
|
||||
unsigned char assign = mbedtls_ct_size_bool_eq( i, index );
|
||||
const mbedtls_mpi_uint *current = table + i * limbs;
|
||||
mbedtls_mpi_core_cond_assign( dest, current, limbs, assign );
|
||||
mbedtls_mpi_core_cond_assign( dest, table, limbs, assign );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,17 +453,16 @@ int mbedtls_mpi_core_get_mont_r2_unsafe( mbedtls_mpi *X,
|
||||
const mbedtls_mpi *N );
|
||||
|
||||
/**
|
||||
* Select an MPI from a table without leaking the index.
|
||||
* Copy an MPI from a table without leaking the index.
|
||||
*
|
||||
* \param dest The destination buffer. This must point to a writable
|
||||
* buffer of at least \p limbs limbs.
|
||||
* \param table The address of the table. This must point to a readable
|
||||
* array of \p count elements of
|
||||
* \p limbs limbs each each.
|
||||
* \param limbs The length of a table entry in limbs.
|
||||
* \param count The number of elements in \p table.
|
||||
* \param index The secret table index to look up. This must be in the
|
||||
* range `0,..,count-1`.
|
||||
* array of \p count elements of \p limbs limbs each.
|
||||
* \param limbs The number of limbs in each table entry.
|
||||
* \param count The number of entries in \p table.
|
||||
* \param index The (secret) table index to look up. This must be in the
|
||||
* range `0 .. count-1`.
|
||||
*/
|
||||
void mbedtls_mpi_core_ct_uint_table_lookup( mbedtls_mpi_uint *dest,
|
||||
const mbedtls_mpi_uint *table,
|
||||
|
@ -71,7 +71,6 @@ class BignumCoreShiftR(BignumCoreTarget, metaclass=ABCMeta):
|
||||
|
||||
class BignumCoreCTLookup(BignumCoreTarget, metaclass=ABCMeta):
|
||||
"""Test cases for mbedtls_mpi_core_ct_uint_table_lookup()."""
|
||||
count = 0
|
||||
test_function = "mpi_core_ct_uint_table_lookup"
|
||||
test_name = "Constant time MPI table lookup"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user