mpi_core_exp_mod: add generated tests
Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
parent
3321b5842c
commit
05867cb036
2 changed files with 23 additions and 2 deletions
|
@ -755,6 +755,27 @@ def mpi_modmul_case_generate() -> None:
|
|||
|
||||
# BEGIN MERGE SLOT 1
|
||||
|
||||
class BignumCoreExpMod(BignumCoreTarget, bignum_common.ModOperationCommon):
|
||||
"""Test cases for bignum core exponentiation."""
|
||||
symbol = "^"
|
||||
test_function = "mpi_core_exp_mod"
|
||||
test_name = "Core modular exponentiation"
|
||||
input_style = "fixed"
|
||||
|
||||
def result(self) -> List[str]:
|
||||
result = pow(self.int_a, self.int_b, self.int_n)
|
||||
return [self.format_result(result)]
|
||||
|
||||
@property
|
||||
def is_valid(self) -> bool:
|
||||
# The base needs to be canonical, but the exponent can be larger than
|
||||
# the modulus (see for example exponent blinding)
|
||||
if self.int_a < self.int_n:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# END MERGE SLOT 1
|
||||
|
||||
# BEGIN MERGE SLOT 2
|
||||
|
|
|
@ -1042,8 +1042,8 @@ exit:
|
|||
/* BEGIN MERGE SLOT 1 */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void mpi_core_exp_mod( char * input_A, char * input_E,
|
||||
char * input_N, char * input_X )
|
||||
void mpi_core_exp_mod( char * input_N, char * input_A,
|
||||
char * input_E, char * input_X )
|
||||
{
|
||||
mbedtls_mpi_uint *A = NULL;
|
||||
size_t A_limbs;
|
||||
|
|
Loading…
Reference in a new issue