summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/bigint.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/ipxe/bigint.h')
-rw-r--r--src/include/ipxe/bigint.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/ipxe/bigint.h b/src/include/ipxe/bigint.h
index 820d306b..3dc344df 100644
--- a/src/include/ipxe/bigint.h
+++ b/src/include/ipxe/bigint.h
@@ -190,6 +190,19 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
} while ( 0 )
/**
+ * Conditionally swap big integers (in constant time)
+ *
+ * @v first Big integer to be conditionally swapped
+ * @v second Big integer to be conditionally swapped
+ * @v swap Swap first and second big integers
+ */
+#define bigint_swap( first, second, swap ) do { \
+ unsigned int size = bigint_size (first); \
+ bigint_swap_raw ( (first)->element, (second)->element, size, \
+ (swap) ); \
+ } while ( 0 )
+
+/**
* Multiply big integers
*
* @v multiplicand Big integer to be multiplied
@@ -296,6 +309,8 @@ void bigint_grow_raw ( const bigint_element_t *source0,
void bigint_shrink_raw ( const bigint_element_t *source0,
unsigned int source_size, bigint_element_t *dest0,
unsigned int dest_size );
+void bigint_swap_raw ( bigint_element_t *first0, bigint_element_t *second0,
+ unsigned int size, int swap );
void bigint_multiply_raw ( const bigint_element_t *multiplicand0,
unsigned int multiplicand_size,
const bigint_element_t *multiplier0,