1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
mod bindings;
pub use bindings::*;
/**
* Add more tests to gain more confidence in the bindings
*/
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn init_wolfssl() {
unsafe {
let res = wolfSSL_Init();
assert_eq!(res, WOLFSSL_SUCCESS);
}
}
#[test]
#[cfg(feature = "postquantum")]
fn test_post_quantum_available() {
unsafe {
// Init WolfSSL
let res = wolfSSL_Init();
assert_eq!(res, WOLFSSL_SUCCESS);
// Set up client method
let method = wolfTLSv1_3_client_method();
// Create context
let context = wolfSSL_CTX_new(method);
// Create new SSL stream
let ssl = wolfSSL_new(context);
// Enable Kyber
let res = wolfSSL_UseKeyShare(ssl, WOLFSSL_P521_KYBER_LEVEL5.try_into().unwrap());
// Check that Kyber was enabled
assert_eq!(res, WOLFSSL_SUCCESS);
}
}
}