aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-10-07 12:13:42 +0100
committerMichael Brown <mcb30@ipxe.org>2024-10-07 13:13:43 +0100
commit7e0bf4ec5cb3dd608d97735575e3f62252455878 (patch)
tree0bb9aa58c73136dc4fa86c3f85d9d90bcafb6bb6 /src/crypto
parent3f4f843920afdc1d808a8b20354cf3eca481401a (diff)
downloadipxe-7e0bf4ec5cb3dd608d97735575e3f62252455878.tar.gz
[crypto] Rename bigint_rol()/bigint_ror() to bigint_shl()/bigint_shr()
The big integer shift operations are misleadingly described as rotations since the original x86 implementations are essentially trivial loops around the relevant rotate-through-carry instruction. The overall operation performed is a shift rather than a rotation. Update the function names and descriptions to reflect this. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/bigint.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/crypto/bigint.c b/src/crypto/bigint.c
index b63f7ccc1..c7b6dafc9 100644
--- a/src/crypto/bigint.c
+++ b/src/crypto/bigint.c
@@ -171,7 +171,7 @@ void bigint_mod_multiply_raw ( const bigint_element_t *multiplicand0,
bigint_t ( size * 2 ) result;
bigint_t ( size * 2 ) modulus;
} *temp = tmp;
- int rotation;
+ int shift;
int i;
/* Start profiling */
@@ -188,18 +188,18 @@ void bigint_mod_multiply_raw ( const bigint_element_t *multiplicand0,
/* Rescale modulus to match result */
profile_start ( &bigint_mod_multiply_rescale_profiler );
bigint_grow ( modulus, &temp->modulus );
- rotation = ( bigint_max_set_bit ( &temp->result ) -
- bigint_max_set_bit ( &temp->modulus ) );
- for ( i = 0 ; i < rotation ; i++ )
- bigint_rol ( &temp->modulus );
+ shift = ( bigint_max_set_bit ( &temp->result ) -
+ bigint_max_set_bit ( &temp->modulus ) );
+ for ( i = 0 ; i < shift ; i++ )
+ bigint_shl ( &temp->modulus );
profile_stop ( &bigint_mod_multiply_rescale_profiler );
/* Subtract multiples of modulus */
profile_start ( &bigint_mod_multiply_subtract_profiler );
- for ( i = 0 ; i <= rotation ; i++ ) {
+ for ( i = 0 ; i <= shift ; i++ ) {
if ( bigint_is_geq ( &temp->result, &temp->modulus ) )
bigint_subtract ( &temp->modulus, &temp->result );
- bigint_ror ( &temp->modulus );
+ bigint_shr ( &temp->modulus );
}
profile_stop ( &bigint_mod_multiply_subtract_profiler );
@@ -255,7 +255,7 @@ void bigint_mod_exp_raw ( const bigint_element_t *base0,
bigint_mod_multiply ( result, &temp->base, modulus,
result, temp->mod_multiply );
}
- bigint_ror ( &temp->exponent );
+ bigint_shr ( &temp->exponent );
bigint_mod_multiply ( &temp->base, &temp->base, modulus,
&temp->base, temp->mod_multiply );
}