mirror of
https://github.com/ipxe/ipxe
synced 2026-01-22 20:19:08 +03:00
[crypto] Allow for zero-length big integer literals
Ensure that zero-length big integer literals are treated as containing a zero value. Avoid tests on every big integer arithmetic operation by ensuring that bigint_required_size() always returns a non-zero value: the zero-length tests can therefore be restricted to only bigint_init() and bigint_done(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -28,8 +28,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
* @ret size Number of elements
|
||||
*/
|
||||
#define bigint_required_size( len ) \
|
||||
( ( (len) + sizeof ( bigint_element_t ) - 1 ) / \
|
||||
sizeof ( bigint_element_t ) )
|
||||
( (len) ? ( ( (len) + sizeof ( bigint_element_t ) - 1 ) / \
|
||||
sizeof ( bigint_element_t ) ) : 1 )
|
||||
|
||||
/**
|
||||
* Determine number of elements in big-integer type
|
||||
|
||||
Reference in New Issue
Block a user