mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Merge pull request #6776 from gabor-mezei-arm/6222_bignum_mod_mul
Bignum: Implement fixed width modular multiplication
This commit is contained in:
@ -31,6 +31,26 @@ class BignumModTarget(test_data_generation.BaseTarget):
|
||||
|
||||
# BEGIN MERGE SLOT 2
|
||||
|
||||
class BignumModMul(bignum_common.ModOperationCommon,
|
||||
BignumModTarget):
|
||||
# pylint:disable=duplicate-code
|
||||
"""Test cases for bignum mpi_mod_mul()."""
|
||||
symbol = "*"
|
||||
test_function = "mpi_mod_mul"
|
||||
test_name = "mbedtls_mpi_mod_mul"
|
||||
input_style = "arch_split"
|
||||
arity = 2
|
||||
|
||||
def arguments(self) -> List[str]:
|
||||
return [self.format_result(self.to_montgomery(self.int_a)),
|
||||
self.format_result(self.to_montgomery(self.int_b)),
|
||||
bignum_common.quote_str(self.arg_n)
|
||||
] + self.result()
|
||||
|
||||
def result(self) -> List[str]:
|
||||
result = (self.int_a * self.int_b) % self.int_n
|
||||
return [self.format_result(self.to_montgomery(result))]
|
||||
|
||||
# END MERGE SLOT 2
|
||||
|
||||
# BEGIN MERGE SLOT 3
|
||||
|
Reference in New Issue
Block a user