Skip to content

Commit 0992ee7

Browse files
signature: Add unit test for OSSL_FUNC_SIGNATURE_NEWCTX
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
1 parent 6d7fa49 commit 0992ee7

File tree

1 file changed

+26
-0
lines changed
  • parsec-openssl-provider/src/signature

1 file changed

+26
-0
lines changed

parsec-openssl-provider/src/signature/mod.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,29 @@ pub const PARSEC_PROVIDER_SIGNATURE: [OSSL_ALGORITHM; 3] = [
9292
),
9393
ossl_algorithm!(),
9494
];
95+
96+
#[test]
97+
fn test_sign_newctx() {
98+
use crate::parsec_provider_provider_init;
99+
100+
let out: *const OSSL_DISPATCH = std::ptr::null();
101+
let mut provctx: types::VOID_PTR = std::ptr::null_mut();
102+
103+
// Initialize the provider
104+
let result: Result<(), parsec_openssl2::Error> = unsafe {
105+
parsec_provider_provider_init(
106+
std::ptr::null(),
107+
std::ptr::null(),
108+
&out as *const _ as *mut _,
109+
&mut provctx as *mut VOID_PTR,
110+
)
111+
};
112+
assert!(result.is_ok());
113+
assert_ne!(provctx, std::ptr::null_mut());
114+
let s = String::from("");
115+
116+
let sig_ctx = unsafe { parsec_provider_signature_newctx(provctx, s.as_ptr() as _) };
117+
assert_ne!(sig_ctx, std::ptr::null_mut());
118+
119+
unsafe { parsec_provider_signature_freectx(sig_ctx) };
120+
}

0 commit comments

Comments
 (0)