[crypto] Remove obsolete bigint_mod_multiply()

There is no further need for a standalone modular multiplication
primitive, since the only consumer is modular exponentiation (which
now uses Montgomery multiplication instead).

Remove the now obsolete bigint_mod_multiply().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
diff --git a/src/crypto/bigint.c b/src/crypto/bigint.c
index 39e1a25..b357ea2 100644
--- a/src/crypto/bigint.c
+++ b/src/crypto/bigint.c
@@ -38,10 +38,6 @@
 static struct profiler bigint_mod_profiler __profiler =
 	{ .name = "bigint_mod" };
 
-/** Modular multiplication overall profiler */
-static struct profiler bigint_mod_multiply_profiler __profiler =
-	{ .name = "bigint_mod_multiply" };
-
 /**
  * Conditionally swap big integers (in constant time)
  *
@@ -432,55 +428,6 @@
 }
 
 /**
- * Perform modular multiplication of big integers
- *
- * @v multiplicand0	Element 0 of big integer to be multiplied
- * @v multiplier0	Element 0 of big integer to be multiplied
- * @v modulus0		Element 0 of big integer modulus
- * @v result0		Element 0 of big integer to hold result
- * @v size		Number of elements in base, modulus, and result
- * @v tmp		Temporary working space
- */
-void bigint_mod_multiply_raw ( const bigint_element_t *multiplicand0,
-			       const bigint_element_t *multiplier0,
-			       const bigint_element_t *modulus0,
-			       bigint_element_t *result0,
-			       unsigned int size, void *tmp ) {
-	const bigint_t ( size ) __attribute__ (( may_alias )) *multiplicand =
-		( ( const void * ) multiplicand0 );
-	const bigint_t ( size ) __attribute__ (( may_alias )) *multiplier =
-		( ( const void * ) multiplier0 );
-	const bigint_t ( size ) __attribute__ (( may_alias )) *modulus =
-		( ( const void * ) modulus0 );
-	bigint_t ( size ) __attribute__ (( may_alias )) *result =
-		( ( void * ) result0 );
-	struct {
-		bigint_t ( size * 2 ) result;
-		bigint_t ( size * 2 ) modulus;
-	} *temp = tmp;
-
-	/* Start profiling */
-	profile_start ( &bigint_mod_multiply_profiler );
-
-	/* Sanity check */
-	assert ( sizeof ( *temp ) == bigint_mod_multiply_tmp_len ( modulus ) );
-
-	/* Perform multiplication */
-	bigint_multiply ( multiplicand, multiplier, &temp->result );
-
-	/* Reduce result */
-	bigint_grow ( modulus, &temp->modulus );
-	bigint_reduce ( &temp->modulus, &temp->result );
-	bigint_shrink ( &temp->result, result );
-
-	/* Sanity check */
-	assert ( ! bigint_is_geq ( result, modulus ) );
-
-	/* Stop profiling */
-	profile_stop ( &bigint_mod_multiply_profiler );
-}
-
-/**
  * Perform modular exponentiation of big integers
  *
  * @v base0		Element 0 of big integer base
diff --git a/src/include/ipxe/bigint.h b/src/include/ipxe/bigint.h
index 3ca8719..3058547 100644
--- a/src/include/ipxe/bigint.h
+++ b/src/include/ipxe/bigint.h
@@ -271,37 +271,6 @@
 	} while ( 0 )
 
 /**
- * Perform modular multiplication of big integers
- *
- * @v multiplicand	Big integer to be multiplied
- * @v multiplier	Big integer to be multiplied
- * @v modulus		Big integer modulus
- * @v result		Big integer to hold result
- * @v tmp		Temporary working space
- */
-#define bigint_mod_multiply( multiplicand, multiplier, modulus,		\
-			     result, tmp ) do {				\
-	unsigned int size = bigint_size (multiplicand);			\
-	bigint_mod_multiply_raw ( (multiplicand)->element,		\
-				  (multiplier)->element,		\
-				  (modulus)->element,			\
-				  (result)->element, size, tmp );	\
-	} while ( 0 )
-
-/**
- * Calculate temporary working space required for moduluar multiplication
- *
- * @v modulus		Big integer modulus
- * @ret len		Length of temporary working space
- */
-#define bigint_mod_multiply_tmp_len( modulus ) ( {			\
-	unsigned int size = bigint_size (modulus);			\
-	sizeof ( struct {						\
-		bigint_t ( size * 2 ) temp_result;			\
-		bigint_t ( size * 2 ) temp_modulus;			\
-	} ); } )
-
-/**
  * Perform modular exponentiation of big integers
  *
  * @v base		Big integer base
@@ -411,11 +380,6 @@
 			     const bigint_element_t *modinv0,
 			     bigint_element_t *mont0,
 			     bigint_element_t *result0, unsigned int size );
-void bigint_mod_multiply_raw ( const bigint_element_t *multiplicand0,
-			       const bigint_element_t *multiplier0,
-			       const bigint_element_t *modulus0,
-			       bigint_element_t *result0,
-			       unsigned int size, void *tmp );
 void bigint_mod_exp_raw ( const bigint_element_t *base0,
 			  const bigint_element_t *modulus0,
 			  const bigint_element_t *exponent0,
diff --git a/src/tests/bigint_test.c b/src/tests/bigint_test.c
index f3291f6..dc74740 100644
--- a/src/tests/bigint_test.c
+++ b/src/tests/bigint_test.c
@@ -223,24 +223,6 @@
 	bigint_montgomery ( modulus, modinv, mont, result );
 }
 
-void bigint_mod_multiply_sample ( const bigint_element_t *multiplicand0,
-				  const bigint_element_t *multiplier0,
-				  const bigint_element_t *modulus0,
-				  bigint_element_t *result0,
-				  unsigned int size,
-				  void *tmp ) {
-	const bigint_t ( size ) *multiplicand __attribute__ (( may_alias ))
-		= ( ( const void * ) multiplicand0 );
-	const bigint_t ( size ) *multiplier __attribute__ (( may_alias ))
-		= ( ( const void * ) multiplier0 );
-	const bigint_t ( size ) *modulus __attribute__ (( may_alias ))
-		= ( ( const void * ) modulus0 );
-	bigint_t ( size ) *result __attribute__ (( may_alias ))
-		= ( ( void * ) result0 );
-
-	bigint_mod_multiply ( multiplicand, multiplier, modulus, result, tmp );
-}
-
 void bigint_mod_exp_sample ( const bigint_element_t *base0,
 			     const bigint_element_t *modulus0,
 			     const bigint_element_t *exponent0,
@@ -675,56 +657,6 @@
 	} while ( 0 )
 
 /**
- * Report result of big integer modular multiplication test
- *
- * @v multiplicand	Big integer to be multiplied
- * @v multiplier	Big integer to be multiplied
- * @v modulus		Big integer modulus
- * @v expected		Big integer expected result
- */
-#define bigint_mod_multiply_ok( multiplicand, multiplier, modulus,	\
-				expected ) do {				\
-	static const uint8_t multiplicand_raw[] = multiplicand;		\
-	static const uint8_t multiplier_raw[] = multiplier;		\
-	static const uint8_t modulus_raw[] = modulus;			\
-	static const uint8_t expected_raw[] = expected;			\
-	uint8_t result_raw[ sizeof ( expected_raw ) ];			\
-	unsigned int size =						\
-		bigint_required_size ( sizeof ( multiplicand_raw ) );	\
-	bigint_t ( size ) multiplicand_temp;				\
-	bigint_t ( size ) multiplier_temp;				\
-	bigint_t ( size ) modulus_temp;					\
-	bigint_t ( size ) result_temp;					\
-	size_t tmp_len = bigint_mod_multiply_tmp_len ( &modulus_temp ); \
-	uint8_t tmp[tmp_len];						\
-	{} /* Fix emacs alignment */					\
-									\
-	assert ( bigint_size ( &multiplier_temp ) ==			\
-		 bigint_size ( &multiplicand_temp ) );			\
-	assert ( bigint_size ( &multiplier_temp ) ==			\
-		 bigint_size ( &modulus_temp ) );			\
-	assert ( bigint_size ( &multiplier_temp ) ==			\
-		 bigint_size ( &result_temp ) );			\
-	bigint_init ( &multiplicand_temp, multiplicand_raw,		\
-		      sizeof ( multiplicand_raw ) );			\
-	bigint_init ( &multiplier_temp, multiplier_raw,			\
-		      sizeof ( multiplier_raw ) );			\
-	bigint_init ( &modulus_temp, modulus_raw,			\
-		      sizeof ( modulus_raw ) );				\
-	DBG ( "Modular multiply:\n" );					\
-	DBG_HDA ( 0, &multiplicand_temp, sizeof ( multiplicand_temp ) );\
-	DBG_HDA ( 0, &multiplier_temp, sizeof ( multiplier_temp ) );	\
-	DBG_HDA ( 0, &modulus_temp, sizeof ( modulus_temp ) );		\
-	bigint_mod_multiply ( &multiplicand_temp, &multiplier_temp,	\
-			      &modulus_temp, &result_temp, tmp );	\
-	DBG_HDA ( 0, &result_temp, sizeof ( result_temp ) );		\
-	bigint_done ( &result_temp, result_raw, sizeof ( result_raw ) );\
-									\
-	ok ( memcmp ( result_raw, expected_raw,				\
-		      sizeof ( result_raw ) ) == 0 );			\
-	} while ( 0 )
-
-/**
  * Report result of big integer modular exponentiation test
  *
  * @v base		Big integer base
@@ -1933,126 +1865,6 @@
 			       BIGINT ( 0x03, 0x38, 0xfb, 0xb6, 0xf3, 0x80,
 					0x91, 0xb2, 0x68, 0x2f, 0x81, 0x44,
 					0xbf, 0x43, 0x0a, 0x4e ) );
-	bigint_mod_multiply_ok ( BIGINT ( 0x37 ),
-				 BIGINT ( 0x67 ),
-				 BIGINT ( 0x3f ),
-				 BIGINT ( 0x3a ) );
-	bigint_mod_multiply_ok ( BIGINT ( 0x45, 0x94 ),
-				 BIGINT ( 0xbd, 0xd2 ),
-				 BIGINT ( 0xca, 0xc7 ),
-				 BIGINT ( 0xac, 0xc1 ) );
-	bigint_mod_multiply_ok ( BIGINT ( 0x8e, 0xcd, 0x74 ),
-				 BIGINT ( 0xe2, 0xf1, 0xea ),
-				 BIGINT ( 0x59, 0x51, 0x53 ),
-				 BIGINT ( 0x22, 0xdd, 0x1c ) );
-	bigint_mod_multiply_ok ( BIGINT ( 0xc2, 0xa8, 0x40, 0x6f ),
-				 BIGINT ( 0x29, 0xd7, 0xf4, 0x77 ),
-				 BIGINT ( 0xbb, 0xbd, 0xdb, 0x3d ),
-				 BIGINT ( 0x8f, 0x39, 0xd0, 0x47 ) );
-	bigint_mod_multiply_ok ( BIGINT ( 0x2e, 0xcb, 0x74, 0x7c, 0x64, 0x60,
-					  0xb3, 0x44, 0xf3, 0x23, 0x49, 0x4a,
-					  0xc6, 0xb6, 0xbf, 0xea, 0x80, 0xd8,
-					  0x34, 0xc5, 0x54, 0x22, 0x09 ),
-				 BIGINT ( 0x61, 0x2c, 0x5a, 0xc5, 0xde, 0x07,
-					  0x65, 0x8e, 0xab, 0x88, 0x1a, 0x2e,
-					  0x7a, 0x95, 0x17, 0xe3, 0x3b, 0x17,
-					  0xe4, 0x21, 0xb0, 0xb4, 0x57 ),
-				 BIGINT ( 0x8e, 0x46, 0xa5, 0x87, 0x7b, 0x7f,
-					  0xc4, 0xd7, 0x31, 0xb1, 0x94, 0xe7,
-					  0xe7, 0x1c, 0x7e, 0x7a, 0xc2, 0x6c,
-					  0xce, 0xcb, 0xc8, 0x5d, 0x70 ),
-				 BIGINT ( 0x1e, 0xd1, 0x5b, 0x3d, 0x1d, 0x17,
-					  0x7c, 0x31, 0x95, 0x13, 0x1b, 0xd8,
-					  0xee, 0x0a, 0xb0, 0xe1, 0x5b, 0x13,
-					  0xad, 0x83, 0xe9, 0xf8, 0x7f ) );
-	bigint_mod_multiply_ok ( BIGINT ( 0x56, 0x37, 0xab, 0x07, 0x8b, 0x25,
-					  0xa7, 0xc2, 0x50, 0x30, 0x43, 0xfc,
-					  0x63, 0x8b, 0xdf, 0x84, 0x68, 0x85,
-					  0xca, 0xce, 0x44, 0x5c, 0xb1, 0x14,
-					  0xa4, 0xb5, 0xba, 0x43, 0xe0, 0x31,
-					  0x45, 0x6b, 0x82, 0xa9, 0x0b, 0x9e,
-					  0x3a, 0xb0, 0x39, 0x09, 0x2a, 0x68,
-					  0x2e, 0x0f, 0x09, 0x54, 0x47, 0x04,
-					  0xdb, 0xcf, 0x4a, 0x3a, 0x2d, 0x7b,
-					  0x7d, 0x50, 0xa4, 0xc5, 0xeb, 0x13,
-					  0xdd, 0x49, 0x61, 0x7d, 0x18, 0xa1,
-					  0x0d, 0x6b, 0x58, 0xba, 0x9f, 0x7c,
-					  0x81, 0x34, 0x9e, 0xf9, 0x9c, 0x9e,
-					  0x28, 0xa8, 0x1c, 0x15, 0x16, 0x20,
-					  0x3c, 0x0a, 0xb1, 0x11, 0x06, 0x93,
-					  0xbc, 0xd8, 0x4e, 0x49, 0xae, 0x7b,
-					  0xb4, 0x02, 0x8b, 0x1c, 0x5b, 0x18,
-					  0xb4, 0xac, 0x7f, 0xdd, 0x70, 0xef,
-					  0x87, 0xac, 0x1b, 0xac, 0x25, 0xa3,
-					  0xc9, 0xa7, 0x3a, 0xc5, 0x76, 0x68,
-					  0x09, 0x1f, 0xa1, 0x48, 0x53, 0xb6,
-					  0x13, 0xac ),
-				 BIGINT ( 0xef, 0x5c, 0x1f, 0x1a, 0x44, 0x64,
-					  0x66, 0xcf, 0xdd, 0x3f, 0x0b, 0x27,
-					  0x81, 0xa7, 0x91, 0x7a, 0x35, 0x7b,
-					  0x0f, 0x46, 0x5e, 0xca, 0xbf, 0xf8,
-					  0x50, 0x5e, 0x99, 0x7c, 0xc6, 0x64,
-					  0x43, 0x00, 0x9f, 0xb2, 0xda, 0xfa,
-					  0x42, 0x15, 0x9c, 0xa3, 0xd6, 0xc8,
-					  0x64, 0xa7, 0x65, 0x4a, 0x98, 0xf7,
-					  0xb3, 0x96, 0x5f, 0x42, 0xf9, 0x73,
-					  0xe1, 0x75, 0xc3, 0xc4, 0x0b, 0x5d,
-					  0x5f, 0xf3, 0x04, 0x8a, 0xee, 0x59,
-					  0xa6, 0x1b, 0x06, 0x38, 0x0b, 0xa2,
-					  0x9f, 0xb4, 0x4f, 0x6d, 0x50, 0x5e,
-					  0x37, 0x37, 0x21, 0x83, 0x9d, 0xa3,
-					  0x12, 0x16, 0x4d, 0xab, 0x36, 0x51,
-					  0x21, 0xb1, 0x74, 0x66, 0x40, 0x9a,
-					  0xd3, 0x72, 0xcc, 0x18, 0x40, 0x53,
-					  0x89, 0xff, 0xd7, 0x00, 0x8d, 0x7e,
-					  0x93, 0x81, 0xdb, 0x29, 0xb6, 0xd7,
-					  0x23, 0x2b, 0x67, 0x2f, 0x11, 0x98,
-					  0x49, 0x87, 0x2f, 0x46, 0xb7, 0x33,
-					  0x6d, 0x12 ),
-				 BIGINT ( 0x67, 0x7a, 0x17, 0x6a, 0xd2, 0xf8,
-					  0x49, 0xfb, 0x7c, 0x95, 0x25, 0x54,
-					  0xf0, 0xab, 0x5b, 0xb3, 0x0e, 0x01,
-					  0xab, 0xd3, 0x65, 0x6f, 0x7e, 0x18,
-					  0x05, 0xed, 0x9b, 0xc4, 0x90, 0x6c,
-					  0xd0, 0x6d, 0x94, 0x79, 0x28, 0xd6,
-					  0x24, 0x77, 0x9a, 0x08, 0xd2, 0x2f,
-					  0x7c, 0x2d, 0xa0, 0x0c, 0x14, 0xbe,
-					  0x7b, 0xee, 0x9e, 0x48, 0x88, 0x3c,
-					  0x8f, 0x9f, 0xb9, 0x7a, 0xcb, 0x98,
-					  0x76, 0x61, 0x0d, 0xee, 0xa2, 0x42,
-					  0x67, 0x1b, 0x2c, 0x42, 0x8f, 0x41,
-					  0xcc, 0x78, 0xba, 0xba, 0xaa, 0xa2,
-					  0x92, 0xb0, 0x6e, 0x0c, 0x4e, 0xe1,
-					  0xa5, 0x13, 0x7d, 0x8a, 0x8f, 0x81,
-					  0x95, 0x8a, 0xdf, 0x57, 0x93, 0x88,
-					  0x27, 0x4f, 0x1a, 0x59, 0xa4, 0x74,
-					  0x22, 0xa9, 0x78, 0xe5, 0xed, 0xb1,
-					  0x09, 0x26, 0x59, 0xde, 0x88, 0x21,
-					  0x8d, 0xa2, 0xa8, 0x58, 0x10, 0x7b,
-					  0x65, 0x96, 0xbf, 0x69, 0x3b, 0xc5,
-					  0x55, 0xf8 ),
-				 BIGINT ( 0x15, 0xf7, 0x00, 0xeb, 0xc7, 0x5a,
-					  0x6f, 0xf0, 0x50, 0xf3, 0x21, 0x8a,
-					  0x8e, 0xa6, 0xf6, 0x67, 0x56, 0x7d,
-					  0x07, 0x45, 0x89, 0xdb, 0xd7, 0x7e,
-					  0x9e, 0x28, 0x7f, 0xfb, 0xed, 0xca,
-					  0x2c, 0xbf, 0x47, 0x77, 0x99, 0x95,
-					  0xf3, 0xd6, 0x9d, 0xc5, 0x57, 0x81,
-					  0x7f, 0x97, 0xf2, 0x6b, 0x24, 0xee,
-					  0xce, 0xc5, 0x9b, 0xe6, 0x42, 0x2d,
-					  0x37, 0xb7, 0xeb, 0x3d, 0xb5, 0xf7,
-					  0x1e, 0x86, 0xc2, 0x40, 0x44, 0xc9,
-					  0x85, 0x5a, 0x1a, 0xc0, 0xac, 0x9e,
-					  0x78, 0x69, 0x00, 0x7b, 0x93, 0x65,
-					  0xd7, 0x7f, 0x0c, 0xd6, 0xba, 0x4f,
-					  0x06, 0x00, 0x61, 0x05, 0xb2, 0x44,
-					  0xb4, 0xe7, 0xbb, 0x3b, 0x96, 0xb0,
-					  0x6d, 0xe8, 0x43, 0xd2, 0x03, 0xb7,
-					  0x0a, 0xc4, 0x6d, 0x30, 0xd8, 0xd5,
-					  0xe6, 0x54, 0x65, 0xdd, 0xa9, 0x1b,
-					  0x50, 0xc0, 0xb9, 0x95, 0xb0, 0x7d,
-					  0x7c, 0xca, 0x63, 0xf8, 0x72, 0xbe,
-					  0x3b, 0x00 ) );
 	bigint_mod_exp_ok ( BIGINT ( 0xcd ),
 			    BIGINT ( 0xbb ),
 			    BIGINT ( 0x25 ),