mirror of https://github.com/wolfSSL/wolfssl.git
Rust wrapper: test BLAKE2 finalize() returns error for empty output buffer
parent
ca362a4e8f
commit
4fb4b3c0c8
|
|
@ -1,5 +1,7 @@
|
|||
#[cfg(any(blake2b, blake2s))]
|
||||
use wolfssl_wolfcrypt::blake2::*;
|
||||
#[cfg(any(blake2b, blake2s))]
|
||||
use wolfssl_wolfcrypt::sys;
|
||||
|
||||
#[test]
|
||||
#[cfg(blake2b)]
|
||||
|
|
@ -50,6 +52,15 @@ fn test_blake2b() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(blake2b)]
|
||||
fn test_blake2b_finalize_empty_buffer() {
|
||||
let mut blake2b = BLAKE2b::new(64).expect("Error with new()");
|
||||
let mut hash: [u8; 0] = [];
|
||||
let rc = blake2b.finalize(&mut hash).expect_err("finalize() should fail");
|
||||
assert_eq!(rc, sys::wolfCrypt_ErrorCodes_BUFFER_E);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(blake2b_hmac)]
|
||||
fn test_blake2b_hmac() {
|
||||
|
|
@ -151,6 +162,15 @@ fn test_blake2s() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(blake2s)]
|
||||
fn test_blake2s_finalize_empty_buffer() {
|
||||
let mut blake2s = BLAKE2s::new(32).expect("Error with new()");
|
||||
let mut hash: [u8; 0] = [];
|
||||
let rc = blake2s.finalize(&mut hash).expect_err("finalize() should fail");
|
||||
assert_eq!(rc, sys::wolfCrypt_ErrorCodes_BUFFER_E);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(blake2s_hmac)]
|
||||
fn test_blake2s_hmac() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue