File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -338,13 +338,3 @@ impl MessageDecrypter for ChaCha20Poly1305Crypter {
338338 Ok ( msg. into_plain_message ( ) )
339339 }
340340}
341-
342- #[ cfg( test) ]
343- mod tests {
344- use super :: * ;
345-
346- #[ test]
347- fn tls12_ecdsa_sign_schemes_do_not_advertise_ed25519 ( ) {
348- assert ! ( !ECDSA_SCHEMES . contains( & SignatureScheme :: ED25519 ) ) ;
349- }
350- }
Original file line number Diff line number Diff line change @@ -262,7 +262,9 @@ fn rsa_modulus_bit_len(modulus: &[u8]) -> usize {
262262 return 0 ;
263263 } ;
264264
265- ( modulus. len ( ) - 1 ) * 8 + ( u8:: BITS as usize - first. leading_zeros ( ) as usize )
265+ let first_byte_bits =
266+ usize:: try_from ( u8:: BITS - first. leading_zeros ( ) ) . expect ( "u8 bit width fits in usize" ) ;
267+ ( modulus. len ( ) - 1 ) * 8 + first_byte_bits
266268}
267269
268270#[ derive( Debug ) ]
@@ -471,7 +473,7 @@ mod tests {
471473
472474 fn append_der_len ( der : & mut Vec < u8 > , len : usize ) {
473475 if len < 128 {
474- der. push ( len as u8 ) ;
476+ der. push ( u8 :: try_from ( len) . expect ( "short-form DER length fits in u8" ) ) ;
475477 return ;
476478 }
477479
@@ -480,7 +482,9 @@ mod tests {
480482 . iter ( )
481483 . position ( |byte| * byte != 0 )
482484 . unwrap_or ( len_bytes. len ( ) - 1 ) ;
483- der. push ( 0x80 | ( len_bytes. len ( ) - first) as u8 ) ;
485+ let len_len =
486+ u8:: try_from ( len_bytes. len ( ) - first) . expect ( "usize DER length-of-length fits in u8" ) ;
487+ der. push ( 0x80 | len_len) ;
484488 der. extend_from_slice ( & len_bytes[ first..] ) ;
485489 }
486490
You can’t perform that action at this time.
0 commit comments