@@ -58,12 +58,6 @@ pub fn limbs_less_than_limbs_vartime(a: &[Limb], b: &[Limb]) -> bool {
58
58
limbs_less_than_limbs_consttime ( a, b) . leak ( )
59
59
}
60
60
61
- #[ inline]
62
- #[ cfg( feature = "alloc" ) ]
63
- pub fn limbs_less_than_limb_constant_time ( a : & [ Limb ] , b : Limb ) -> LimbMask {
64
- unsafe { LIMBS_less_than_limb ( a. as_ptr ( ) , b, a. len ( ) ) }
65
- }
66
-
67
61
#[ inline]
68
62
pub fn limbs_are_zero_constant_time ( limbs : & [ Limb ] ) -> LimbMask {
69
63
unsafe { LIMBS_are_zero ( limbs. as_ptr ( ) , limbs. len ( ) ) }
@@ -345,11 +339,6 @@ prefixed_extern! {
345
339
fn LIMBS_equal_limb ( a: * const Limb , b: Limb , num_limbs: c:: size_t) -> LimbMask ;
346
340
}
347
341
348
- #[ cfg( feature = "alloc" ) ]
349
- prefixed_extern ! {
350
- fn LIMBS_less_than_limb ( a: * const Limb , b: Limb , num_limbs: c:: size_t) -> LimbMask ;
351
- }
352
-
353
342
#[ cfg( test) ]
354
343
mod tests {
355
344
use super :: * ;
@@ -478,46 +467,6 @@ mod tests {
478
467
}
479
468
}
480
469
481
- #[ test]
482
- #[ cfg( feature = "alloc" ) ]
483
- fn test_limbs_less_than_limb_constant_time ( ) {
484
- static LESSER : & [ ( & [ LeakyLimb ] , LeakyLimb ) ] = & [
485
- ( & [ 0 ] , 1 ) ,
486
- ( & [ 0 , 0 ] , 1 ) ,
487
- ( & [ 1 , 0 ] , 2 ) ,
488
- ( & [ 2 , 0 ] , 3 ) ,
489
- ( & [ 2 , 0 ] , 3 ) ,
490
- ( & [ MAX - 1 ] , MAX ) ,
491
- ( & [ MAX - 1 , 0 ] , MAX ) ,
492
- ] ;
493
- for & ( a, b) in LESSER {
494
- let a = & Vec :: from_iter ( a. iter ( ) . copied ( ) . map ( Limb :: from) ) ;
495
- let b = Limb :: from ( b) ;
496
- assert ! ( leak_in_test( limbs_less_than_limb_constant_time( a, b) ) ) ;
497
- }
498
- static EQUAL : & [ ( & [ LeakyLimb ] , LeakyLimb ) ] = & [
499
- ( & [ 0 ] , 0 ) ,
500
- ( & [ 0 , 0 , 0 , 0 ] , 0 ) ,
501
- ( & [ 1 ] , 1 ) ,
502
- ( & [ 1 , 0 , 0 , 0 , 0 , 0 , 0 ] , 1 ) ,
503
- ( & [ MAX ] , MAX ) ,
504
- ] ;
505
- static GREATER : & [ ( & [ LeakyLimb ] , LeakyLimb ) ] = & [
506
- ( & [ 1 ] , 0 ) ,
507
- ( & [ 2 , 0 ] , 1 ) ,
508
- ( & [ 3 , 0 , 0 , 0 ] , 1 ) ,
509
- ( & [ 0 , 1 , 0 , 0 ] , 1 ) ,
510
- ( & [ 0 , 0 , 1 , 0 ] , 1 ) ,
511
- ( & [ 0 , 0 , 1 , 1 ] , 1 ) ,
512
- ( & [ MAX ] , MAX - 1 ) ,
513
- ] ;
514
- for & ( a, b) in EQUAL . iter ( ) . chain ( GREATER . iter ( ) ) {
515
- let a = & Vec :: from_iter ( a. iter ( ) . copied ( ) . map ( Limb :: from) ) ;
516
- let b = Limb :: from ( b) ;
517
- assert ! ( !leak_in_test( limbs_less_than_limb_constant_time( a, b) ) ) ;
518
- }
519
- }
520
-
521
470
#[ test]
522
471
fn test_parse_big_endian_and_pad_consttime ( ) {
523
472
const LIMBS : usize = 4 ;
0 commit comments