mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 10:40:52 +02:00
Rust wrapper: replace Lms::sigs_left() with Lms::has_sigs_left()
Fixes F-3094
This commit is contained in:
@@ -545,17 +545,17 @@ impl Lms {
|
||||
Ok(sig_sz as usize)
|
||||
}
|
||||
|
||||
/// Return the number of signatures remaining for this key.
|
||||
/// Return whether there are more signatures remaining for this key.
|
||||
///
|
||||
/// Returns `Ok(true)` if at least one signature remains, `Ok(false)` if
|
||||
/// exhausted, or `Err(e)` on error. This is a conservative check only.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Returns either Ok(count) on success or Err(e) containing the wolfSSL
|
||||
/// library error code value.
|
||||
/// Returns either Ok(true) if any signatures remain, Ok(false) if
|
||||
/// exhausted, or Err(e) containing the wolfSSL library error code value.
|
||||
#[cfg(lms_make_key)]
|
||||
pub fn sigs_left(&mut self) -> Result<bool, i32> {
|
||||
pub fn has_sigs_left(&mut self) -> Result<bool, i32> {
|
||||
let rc = unsafe { sys::wc_LmsKey_SigsLeft(&mut self.ws_key) };
|
||||
if rc < 0 {
|
||||
return Err(rc);
|
||||
|
||||
@@ -350,11 +350,11 @@ fn test_export_pub_from() {
|
||||
let _ = store;
|
||||
}
|
||||
|
||||
/// Verify that `sigs_left()` indicates signatures are available immediately
|
||||
/// Verify that `has_sigs_left()` indicates signatures are available immediately
|
||||
/// after `make_key()`.
|
||||
#[test]
|
||||
#[cfg(all(lms_make_key, random))]
|
||||
fn test_sigs_left_after_make_key() {
|
||||
fn test_has_sigs_left_after_make_key() {
|
||||
common::setup();
|
||||
let mut rng = RNG::new().expect("Error creating RNG");
|
||||
let mut store = Box::new(KeyStore { buf: [0u8; 16384] });
|
||||
@@ -365,8 +365,8 @@ fn test_sigs_left_after_make_key() {
|
||||
setup_callbacks(&mut key, ctx);
|
||||
key.make_key(&mut rng).expect("Error with make_key()");
|
||||
|
||||
let remaining = key.sigs_left().expect("Error with sigs_left()");
|
||||
assert!(remaining, "sigs_left must be true immediately after make_key()");
|
||||
let remaining = key.has_sigs_left().expect("Error with has_sigs_left()");
|
||||
assert!(remaining, "has_sigs_left must be true immediately after make_key()");
|
||||
|
||||
let _ = store;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user