aboutsummaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2025-02-13 14:18:15 +0000
committerMichael Brown <mcb30@ipxe.org>2025-02-13 15:25:35 +0000
commit5056e8ad936742ba410031cff14c0f72d87805fc (patch)
tree843fe48d0e4eeea4d78e4c30e31c16268def5ff3 /src/include
parentbd90abf487a6b0500f457193f86ff54fd2be3143 (diff)
downloadipxe-5056e8ad936742ba410031cff14c0f72d87805fc.tar.gz
[crypto] Expose shifted out bit from big integer shifts
Expose the bit shifted out as a result of shifting a big integer left or right. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/bigint.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/include/ipxe/bigint.h b/src/include/ipxe/bigint.h
index 410d0fd90..d8f4571e3 100644
--- a/src/include/ipxe/bigint.h
+++ b/src/include/ipxe/bigint.h
@@ -105,21 +105,23 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* Shift big integer left
*
* @v value Big integer
+ * @ret out Bit shifted out
*/
-#define bigint_shl( value ) do { \
+#define bigint_shl( value ) ( { \
unsigned int size = bigint_size (value); \
bigint_shl_raw ( (value)->element, size ); \
- } while ( 0 )
+ } )
/**
* Shift big integer right
*
* @v value Big integer
+ * @ret out Bit shifted out
*/
-#define bigint_shr( value ) do { \
+#define bigint_shr( value ) ( { \
unsigned int size = bigint_size (value); \
bigint_shr_raw ( (value)->element, size ); \
- } while ( 0 )
+ } )
/**
* Test if big integer is equal to zero
@@ -413,8 +415,8 @@ int bigint_add_raw ( const bigint_element_t *addend0,
bigint_element_t *value0, unsigned int size );
int bigint_subtract_raw ( const bigint_element_t *subtrahend0,
bigint_element_t *value0, unsigned int size );
-void bigint_shl_raw ( bigint_element_t *value0, unsigned int size );
-void bigint_shr_raw ( bigint_element_t *value0, unsigned int size );
+int bigint_shl_raw ( bigint_element_t *value0, unsigned int size );
+int bigint_shr_raw ( bigint_element_t *value0, unsigned int size );
int bigint_is_zero_raw ( const bigint_element_t *value0, unsigned int size );
int bigint_is_geq_raw ( const bigint_element_t *value0,
const bigint_element_t *reference0,