Skip to content

Commit eb2cf13

Browse files
committed
refactor
- fix tests - better comments
1 parent 19cc8cd commit eb2cf13

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

mbedtls/src/bignum/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,6 @@ impl ShrAssign<usize> for Mpi {
760760

761761
#[cfg(test)]
762762
mod tests {
763-
use core::str::FromStr;
764-
765763
use super::*;
766764

767765
#[test]
@@ -776,7 +774,10 @@ mod tests {
776774
assert_eq!(mpi2.less_than_const_time(&mpi1), Ok(false));
777775

778776
// Check: function returns `Error::MpiBadInputData` if the allocated length of the two input Mpis is not the same.
779-
let mpi3 = Mpi::from_str("0xdddddddddddddddddddddddddddddddd").unwrap();
777+
let mpi3 = Mpi::from_binary(&[
778+
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
779+
])
780+
.unwrap();
780781
assert_eq!(mpi3.less_than_const_time(&mpi3), Ok(false));
781782
assert_eq!(mpi2.less_than_const_time(&mpi3), Err(Error::MpiBadInputData));
782783
}

mbedtls/src/ecp/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ Please use `mul_with_rng` instead."
369369
///
370370
/// This function will return an error if:
371371
///
372-
/// * `k` is not a valid private key, determined by mbedtls function [`mbedtls_ecp_check_privkey`]
373-
/// * `self` is not a valid public key, determined by mbedtls function [`mbedtls_ecp_check_pubkey`]
372+
/// * The scalar `k` is not valid as a private key, determined by mbedtls function [`mbedtls_ecp_check_privkey`].
373+
/// * The point `self` is not valid as a public key, determined by mbedtls function [`mbedtls_ecp_check_pubkey`].
374374
/// * Memory allocation fails.
375375
/// * Any other kind of failure occurs during the execution of the underlying [`mbedtls_ecp_mul`] function.
376376
///

0 commit comments

Comments
 (0)