summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2024-01-16 17:09:16 +0100
committerMichael Brown2024-01-16 17:09:16 +0100
commit26d3ef062b33e43e076b7ecef20c4ec3f9441860 (patch)
treeb53db24a8a2190088c816f899aeb9508097f2d78 /src/include
parent[libc] Replace linker_assert() with build_assert() (diff)
downloadipxe-26d3ef062b33e43e076b7ecef20c4ec3f9441860.tar.gz
ipxe-26d3ef062b33e43e076b7ecef20c4ec3f9441860.tar.xz
ipxe-26d3ef062b33e43e076b7ecef20c4ec3f9441860.zip
[crypto] Allow multiplicand and multiplier to differ in size
Big integer multiplication is currently used only as part of modular exponentiation, where both multiplicand and multiplier will be the same size. Relax this requirement to allow for the use of big integer multiplication in other contexts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/bigint.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/include/ipxe/bigint.h b/src/include/ipxe/bigint.h
index 2f99f844..36138dd6 100644
--- a/src/include/ipxe/bigint.h
+++ b/src/include/ipxe/bigint.h
@@ -184,10 +184,11 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* @v result Big integer to hold result
*/
#define bigint_multiply( multiplicand, multiplier, result ) do { \
- unsigned int size = bigint_size (multiplicand); \
+ unsigned int multiplicand_size = bigint_size (multiplicand); \
+ unsigned int multiplier_size = bigint_size (multiplier); \
bigint_multiply_raw ( (multiplicand)->element, \
- (multiplier)->element, (result)->element, \
- size ); \
+ multiplicand_size, (multiplier)->element, \
+ multiplier_size, (result)->element ); \
} while ( 0 )
/**
@@ -283,9 +284,10 @@ void bigint_shrink_raw ( const bigint_element_t *source0,
unsigned int source_size, bigint_element_t *dest0,
unsigned int dest_size );
void bigint_multiply_raw ( const bigint_element_t *multiplicand0,
+ unsigned int multiplicand_size,
const bigint_element_t *multiplier0,
- bigint_element_t *result0,
- unsigned int size );
+ unsigned int multiplier_size,
+ bigint_element_t *result0 );
void bigint_mod_multiply_raw ( const bigint_element_t *multiplicand0,
const bigint_element_t *multiplier0,
const bigint_element_t *modulus0,