Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
- fix tests
- better comments
  • Loading branch information
Taowyoo committed Feb 12, 2024
1 parent 19cc8cd commit eb2cf13
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions mbedtls/src/bignum/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,6 @@ impl ShrAssign<usize> for Mpi {

#[cfg(test)]
mod tests {
use core::str::FromStr;

use super::*;

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

// Check: function returns `Error::MpiBadInputData` if the allocated length of the two input Mpis is not the same.
let mpi3 = Mpi::from_str("0xdddddddddddddddddddddddddddddddd").unwrap();
let mpi3 = Mpi::from_binary(&[
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
])
.unwrap();
assert_eq!(mpi3.less_than_const_time(&mpi3), Ok(false));
assert_eq!(mpi2.less_than_const_time(&mpi3), Err(Error::MpiBadInputData));
}
Expand Down
4 changes: 2 additions & 2 deletions mbedtls/src/ecp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ Please use `mul_with_rng` instead."
///
/// This function will return an error if:
///
/// * `k` is not a valid private key, determined by mbedtls function [`mbedtls_ecp_check_privkey`]
/// * `self` is not a valid public key, determined by mbedtls function [`mbedtls_ecp_check_pubkey`]
/// * The scalar `k` is not valid as a private key, determined by mbedtls function [`mbedtls_ecp_check_privkey`].
/// * The point `self` is not valid as a public key, determined by mbedtls function [`mbedtls_ecp_check_pubkey`].
/// * Memory allocation fails.
/// * Any other kind of failure occurs during the execution of the underlying [`mbedtls_ecp_mul`] function.
///
Expand Down

0 comments on commit eb2cf13

Please sign in to comment.