diff --git a/implementations.yaml b/implementations.yaml index ffc9e35..4d6d2db 100644 --- a/implementations.yaml +++ b/implementations.yaml @@ -21,33 +21,33 @@ kems: This implementation requires a lot of stack space. You need to specify ``RUST_MIN_STACK=800000000``, probably. x86_avx2_guard: 'target_arch == "x86_64" && avx2_enabled && !is_windows' - implementations: [clean, avx] + implementations: [clean, avx2] schemes: - name: mceliece348864 - implementations: [clean, avx] + implementations: [clean, avx2] - name: mceliece348864f - implementations: [clean, avx] + implementations: [clean, avx2] - name: mceliece460896 - implementations: [clean, avx] + implementations: [clean, avx2] - name: mceliece460896f - implementations: [clean, avx] + implementations: [clean, avx2] - name: mceliece6688128 - implementations: [clean, avx] + implementations: [clean, avx2] doctest: no - name: mceliece6688128f - implementations: [clean, avx] + implementations: [clean, avx2] doctest: no - name: mceliece6960119 - implementations: [clean, avx] + implementations: [clean, avx2] doctest: no - name: mceliece6960119f - implementations: [clean, avx] + implementations: [clean, avx2] doctest: no - name: mceliece8192128 - implementations: [clean, avx] + implementations: [clean, avx2] doctest: no - name: mceliece8192128f - implementations: [clean, avx] + implementations: [clean, avx2] doctest: no hqc: version: 0.2.0 @@ -75,7 +75,7 @@ signs: implementations: [clean, avx2, aarch64] falcon: version: 0.3.0 - implementations: [clean, avx2] + implementations: [clean, avx2, aarch64] schemes: - name: falcon-512 implementations: [clean, avx2, aarch64] @@ -83,7 +83,7 @@ signs: implementations: [clean, avx2, aarch64] sphincsplus: version: 0.7.0 - implementations: [clean, aesni, avx2] + implementations: [clean, avx2] schemes: - name: sphincs-shake-128f-simple implementations: [clean, avx2] diff --git a/pqcrypto-classicmceliece/README.md b/pqcrypto-classicmceliece/README.md index 018c95e..93a485b 100644 --- a/pqcrypto-classicmceliece/README.md +++ b/pqcrypto-classicmceliece/README.md @@ -21,34 +21,34 @@ methods only. * ``mceliece348864`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece348864f`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece460896`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece460896f`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece6688128`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece6688128f`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece6960119`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece6960119f`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece8192128`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) * ``mceliece8192128f`` * ``clean`` - * ``avx`` (if supported) + * ``avx2`` (if supported) ## Notes diff --git a/pqcrypto-classicmceliece/build.rs b/pqcrypto-classicmceliece/build.rs index d386f58..8167ef3 100644 --- a/pqcrypto-classicmceliece/build.rs +++ b/pqcrypto-classicmceliece/build.rs @@ -36,13 +36,13 @@ macro_rules! build_clean { }; } -macro_rules! build_avx { +macro_rules! build_avx2 { ($variant:expr) => { let internals_include_path = &std::env::var("DEP_PQCRYPTO_INTERNALS_INCLUDEPATH").unwrap(); let common_dir = Path::new("pqclean/common"); let mut builder = cc::Build::new(); - let target_dir: PathBuf = ["pqclean", "crypto_kem", $variant, "avx"].iter().collect(); + let target_dir: PathBuf = ["pqclean", "crypto_kem", $variant, "avx2"].iter().collect(); let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); if target_os == "wasi" { @@ -74,7 +74,7 @@ macro_rules! build_avx { .into_iter() .map(|p| p.unwrap().to_string_lossy().into_owned()), ); - builder.compile(format!("{}_avx", $variant).as_str()); + builder.compile(format!("{}_avx2", $variant).as_str()); }; } @@ -96,43 +96,43 @@ fn main() { build_clean!("mceliece348864"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece348864"); + build_avx2!("mceliece348864"); } build_clean!("mceliece348864f"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece348864f"); + build_avx2!("mceliece348864f"); } build_clean!("mceliece460896"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece460896"); + build_avx2!("mceliece460896"); } build_clean!("mceliece460896f"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece460896f"); + build_avx2!("mceliece460896f"); } build_clean!("mceliece6688128"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece6688128"); + build_avx2!("mceliece6688128"); } build_clean!("mceliece6688128f"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece6688128f"); + build_avx2!("mceliece6688128f"); } build_clean!("mceliece6960119"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece6960119"); + build_avx2!("mceliece6960119"); } build_clean!("mceliece6960119f"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece6960119f"); + build_avx2!("mceliece6960119f"); } build_clean!("mceliece8192128"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece8192128"); + build_avx2!("mceliece8192128"); } build_clean!("mceliece8192128f"); if target_arch == "x86_64" && avx2_enabled && !is_windows { - build_avx!("mceliece8192128f"); + build_avx2!("mceliece8192128f"); } if target_arch == "x86_64" && avx2_enabled && !is_windows { diff --git a/pqcrypto-classicmceliece/src/ffi.rs b/pqcrypto-classicmceliece/src/ffi.rs index c3827c9..615cbcb 100644 --- a/pqcrypto-classicmceliece/src/ffi.rs +++ b/pqcrypto-classicmceliece/src/ffi.rs @@ -27,13 +27,13 @@ pub const PQCLEAN_MCELIECE348864_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 96; pub const PQCLEAN_MCELIECE348864_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864_AVX_CRYPTO_SECRETKEYBYTES: usize = 6492; +pub const PQCLEAN_MCELIECE348864_AVX2_CRYPTO_SECRETKEYBYTES: usize = 6492; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864_AVX_CRYPTO_PUBLICKEYBYTES: usize = 261120; +pub const PQCLEAN_MCELIECE348864_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 261120; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 96; +pub const PQCLEAN_MCELIECE348864_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 96; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE348864_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE348864F_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 6492; pub const PQCLEAN_MCELIECE348864F_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 261120; @@ -41,13 +41,13 @@ pub const PQCLEAN_MCELIECE348864F_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 96; pub const PQCLEAN_MCELIECE348864F_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864F_AVX_CRYPTO_SECRETKEYBYTES: usize = 6492; +pub const PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_SECRETKEYBYTES: usize = 6492; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864F_AVX_CRYPTO_PUBLICKEYBYTES: usize = 261120; +pub const PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 261120; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864F_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 96; +pub const PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 96; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE348864F_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE460896_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 13608; pub const PQCLEAN_MCELIECE460896_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 524160; @@ -55,13 +55,13 @@ pub const PQCLEAN_MCELIECE460896_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 156; pub const PQCLEAN_MCELIECE460896_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896_AVX_CRYPTO_SECRETKEYBYTES: usize = 13608; +pub const PQCLEAN_MCELIECE460896_AVX2_CRYPTO_SECRETKEYBYTES: usize = 13608; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896_AVX_CRYPTO_PUBLICKEYBYTES: usize = 524160; +pub const PQCLEAN_MCELIECE460896_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 524160; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 156; +pub const PQCLEAN_MCELIECE460896_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 156; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE460896_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE460896F_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 13608; pub const PQCLEAN_MCELIECE460896F_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 524160; @@ -69,13 +69,13 @@ pub const PQCLEAN_MCELIECE460896F_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 156; pub const PQCLEAN_MCELIECE460896F_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896F_AVX_CRYPTO_SECRETKEYBYTES: usize = 13608; +pub const PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_SECRETKEYBYTES: usize = 13608; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896F_AVX_CRYPTO_PUBLICKEYBYTES: usize = 524160; +pub const PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 524160; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896F_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 156; +pub const PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 156; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE460896F_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE6688128_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 13932; pub const PQCLEAN_MCELIECE6688128_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 1044992; @@ -83,13 +83,13 @@ pub const PQCLEAN_MCELIECE6688128_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 208; pub const PQCLEAN_MCELIECE6688128_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128_AVX_CRYPTO_SECRETKEYBYTES: usize = 13932; +pub const PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_SECRETKEYBYTES: usize = 13932; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128_AVX_CRYPTO_PUBLICKEYBYTES: usize = 1044992; +pub const PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 1044992; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 208; +pub const PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 208; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE6688128F_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 13932; pub const PQCLEAN_MCELIECE6688128F_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 1044992; @@ -97,13 +97,13 @@ pub const PQCLEAN_MCELIECE6688128F_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 208; pub const PQCLEAN_MCELIECE6688128F_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_SECRETKEYBYTES: usize = 13932; +pub const PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_SECRETKEYBYTES: usize = 13932; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_PUBLICKEYBYTES: usize = 1044992; +pub const PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 1044992; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 208; +pub const PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 208; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE6960119_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 13948; pub const PQCLEAN_MCELIECE6960119_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 1047319; @@ -111,13 +111,13 @@ pub const PQCLEAN_MCELIECE6960119_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 194; pub const PQCLEAN_MCELIECE6960119_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119_AVX_CRYPTO_SECRETKEYBYTES: usize = 13948; +pub const PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_SECRETKEYBYTES: usize = 13948; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119_AVX_CRYPTO_PUBLICKEYBYTES: usize = 1047319; +pub const PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 1047319; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 194; +pub const PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 194; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE6960119F_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 13948; pub const PQCLEAN_MCELIECE6960119F_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 1047319; @@ -125,13 +125,13 @@ pub const PQCLEAN_MCELIECE6960119F_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 194; pub const PQCLEAN_MCELIECE6960119F_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_SECRETKEYBYTES: usize = 13948; +pub const PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_SECRETKEYBYTES: usize = 13948; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_PUBLICKEYBYTES: usize = 1047319; +pub const PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 1047319; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 194; +pub const PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 194; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE8192128_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 14120; pub const PQCLEAN_MCELIECE8192128_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 1357824; @@ -139,13 +139,13 @@ pub const PQCLEAN_MCELIECE8192128_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 208; pub const PQCLEAN_MCELIECE8192128_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128_AVX_CRYPTO_SECRETKEYBYTES: usize = 14120; +pub const PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_SECRETKEYBYTES: usize = 14120; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128_AVX_CRYPTO_PUBLICKEYBYTES: usize = 1357824; +pub const PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 1357824; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 208; +pub const PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 208; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_BYTES: usize = 32; pub const PQCLEAN_MCELIECE8192128F_CLEAN_CRYPTO_SECRETKEYBYTES: usize = 14120; pub const PQCLEAN_MCELIECE8192128F_CLEAN_CRYPTO_PUBLICKEYBYTES: usize = 1357824; @@ -153,13 +153,13 @@ pub const PQCLEAN_MCELIECE8192128F_CLEAN_CRYPTO_CIPHERTEXTBYTES: usize = 208; pub const PQCLEAN_MCELIECE8192128F_CLEAN_CRYPTO_BYTES: usize = 32; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_SECRETKEYBYTES: usize = 14120; +pub const PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_SECRETKEYBYTES: usize = 14120; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_PUBLICKEYBYTES: usize = 1357824; +pub const PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_PUBLICKEYBYTES: usize = 1357824; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_CIPHERTEXTBYTES: usize = 208; +pub const PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_CIPHERTEXTBYTES: usize = 208; #[cfg(enable_x86_avx2)] -pub const PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_BYTES: usize = 32; +pub const PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_BYTES: usize = 32; #[link(name = "mceliece348864_clean")] extern "C" { @@ -177,18 +177,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece348864_avx")] +#[link(name = "mceliece348864_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE348864_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE348864_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE348864_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE348864_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE348864_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE348864_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -211,18 +211,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece348864f_avx")] +#[link(name = "mceliece348864f_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE348864F_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE348864F_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE348864F_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -245,18 +245,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece460896_avx")] +#[link(name = "mceliece460896_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE460896_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE460896_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE460896_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE460896_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE460896_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE460896_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -279,18 +279,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece460896f_avx")] +#[link(name = "mceliece460896f_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE460896F_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE460896F_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE460896F_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -313,18 +313,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece6688128_avx")] +#[link(name = "mceliece6688128_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6688128_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6688128_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6688128_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -347,18 +347,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece6688128f_avx")] +#[link(name = "mceliece6688128f_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -381,18 +381,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece6960119_avx")] +#[link(name = "mceliece6960119_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6960119_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6960119_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6960119_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -415,18 +415,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece6960119f_avx")] +#[link(name = "mceliece6960119f_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -449,18 +449,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece8192128_avx")] +#[link(name = "mceliece8192128_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE8192128_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE8192128_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE8192128_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -483,18 +483,18 @@ extern "C" { } #[cfg(enable_x86_avx2)] -#[link(name = "mceliece8192128f_avx")] +#[link(name = "mceliece8192128f_avx2")] extern "C" { #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; + pub fn PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_keypair(pk: *mut u8, sk: *mut u8) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_enc( + pub fn PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_enc( ct: *mut u8, ss: *mut u8, pk: *const u8, ) -> c_int; #[cfg(enable_x86_avx2)] - pub fn PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_dec( + pub fn PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_dec( ss: *mut u8, ct: *const u8, sk: *const u8, @@ -541,7 +541,7 @@ mod test_mceliece348864_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece348864_avx { +mod test_mceliece348864_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -552,19 +552,19 @@ mod test_mceliece348864_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE348864_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE348864_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE348864_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE348864_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE348864_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE348864_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE348864_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE348864_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE348864_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE348864_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE348864_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE348864_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE348864_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE348864_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -572,7 +572,7 @@ mod test_mceliece348864_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE348864_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE348864_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -623,7 +623,7 @@ mod test_mceliece348864f_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece348864f_avx { +mod test_mceliece348864f_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -634,19 +634,19 @@ mod test_mceliece348864f_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE348864F_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE348864F_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE348864F_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE348864F_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE348864F_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE348864F_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE348864F_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE348864F_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -654,7 +654,7 @@ mod test_mceliece348864f_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE348864F_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -705,7 +705,7 @@ mod test_mceliece460896_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece460896_avx { +mod test_mceliece460896_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -716,19 +716,19 @@ mod test_mceliece460896_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE460896_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE460896_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE460896_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE460896_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE460896_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE460896_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE460896_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE460896_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE460896_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE460896_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE460896_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE460896_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE460896_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE460896_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -736,7 +736,7 @@ mod test_mceliece460896_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE460896_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE460896_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -787,7 +787,7 @@ mod test_mceliece460896f_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece460896f_avx { +mod test_mceliece460896f_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -798,19 +798,19 @@ mod test_mceliece460896f_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE460896F_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE460896F_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE460896F_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE460896F_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE460896F_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE460896F_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE460896F_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE460896F_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -818,7 +818,7 @@ mod test_mceliece460896f_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE460896F_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -869,7 +869,7 @@ mod test_mceliece6688128_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece6688128_avx { +mod test_mceliece6688128_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -880,19 +880,19 @@ mod test_mceliece6688128_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE6688128_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE6688128_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE6688128_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6688128_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6688128_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6688128_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE6688128_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE6688128_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -900,7 +900,7 @@ mod test_mceliece6688128_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE6688128_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -951,7 +951,7 @@ mod test_mceliece6688128f_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece6688128f_avx { +mod test_mceliece6688128f_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -962,19 +962,19 @@ mod test_mceliece6688128f_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6688128F_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -982,7 +982,7 @@ mod test_mceliece6688128f_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -1033,7 +1033,7 @@ mod test_mceliece6960119_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece6960119_avx { +mod test_mceliece6960119_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -1044,19 +1044,19 @@ mod test_mceliece6960119_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE6960119_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE6960119_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE6960119_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6960119_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6960119_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6960119_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE6960119_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE6960119_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -1064,7 +1064,7 @@ mod test_mceliece6960119_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE6960119_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -1115,7 +1115,7 @@ mod test_mceliece6960119f_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece6960119f_avx { +mod test_mceliece6960119f_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -1126,19 +1126,19 @@ mod test_mceliece6960119f_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE6960119F_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -1146,7 +1146,7 @@ mod test_mceliece6960119f_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -1197,7 +1197,7 @@ mod test_mceliece8192128_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece8192128_avx { +mod test_mceliece8192128_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -1208,19 +1208,19 @@ mod test_mceliece8192128_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE8192128_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE8192128_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE8192128_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE8192128_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE8192128_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE8192128_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE8192128_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE8192128_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -1228,7 +1228,7 @@ mod test_mceliece8192128_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE8192128_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() @@ -1279,7 +1279,7 @@ mod test_mceliece8192128f_clean { } #[cfg(all(test, enable_x86_avx2, feature = "avx2"))] -mod test_mceliece8192128f_avx { +mod test_mceliece8192128f_avx2 { use super::*; use alloc::vec; use std::is_x86_feature_detected; @@ -1290,19 +1290,19 @@ mod test_mceliece8192128f_avx { return; } unsafe { - let mut pk = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_PUBLICKEYBYTES]; - let mut sk = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_SECRETKEYBYTES]; - let mut ct = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_CIPHERTEXTBYTES]; - let mut ss1 = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_BYTES]; - let mut ss2 = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX_CRYPTO_BYTES]; + let mut pk = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_PUBLICKEYBYTES]; + let mut sk = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_SECRETKEYBYTES]; + let mut ct = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_CIPHERTEXTBYTES]; + let mut ss1 = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_BYTES]; + let mut ss2 = vec![0u8; PQCLEAN_MCELIECE8192128F_AVX2_CRYPTO_BYTES]; assert_eq!( 0, - PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) + PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_keypair(pk.as_mut_ptr(), sk.as_mut_ptr()) ); assert_eq!( 0, - PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_enc( + PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_enc( ct.as_mut_ptr(), ss1.as_mut_ptr(), pk.as_ptr() @@ -1310,7 +1310,7 @@ mod test_mceliece8192128f_avx { ); assert_eq!( 0, - PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_dec( + PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_dec( ss2.as_mut_ptr(), ct.as_ptr(), sk.as_ptr() diff --git a/pqcrypto-classicmceliece/src/mceliece348864.rs b/pqcrypto-classicmceliece/src/mceliece348864.rs index b9eb6c5..bb24e41 100644 --- a/pqcrypto-classicmceliece/src/mceliece348864.rs +++ b/pqcrypto-classicmceliece/src/mceliece348864.rs @@ -133,7 +133,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE348864_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE348864_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE348864_CLEAN_crypto_kem_keypair) @@ -156,7 +156,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE348864_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE348864_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE348864_CLEAN_crypto_kem_enc, pk) @@ -178,7 +178,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE348864_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE348864_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE348864_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece348864f.rs b/pqcrypto-classicmceliece/src/mceliece348864f.rs index 801e74d..56b463d 100644 --- a/pqcrypto-classicmceliece/src/mceliece348864f.rs +++ b/pqcrypto-classicmceliece/src/mceliece348864f.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE348864F_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE348864F_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE348864F_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE348864F_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE348864F_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE348864F_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE348864F_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece460896.rs b/pqcrypto-classicmceliece/src/mceliece460896.rs index 8db8363..09e038d 100644 --- a/pqcrypto-classicmceliece/src/mceliece460896.rs +++ b/pqcrypto-classicmceliece/src/mceliece460896.rs @@ -133,7 +133,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE460896_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE460896_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE460896_CLEAN_crypto_kem_keypair) @@ -156,7 +156,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE460896_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE460896_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE460896_CLEAN_crypto_kem_enc, pk) @@ -178,7 +178,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE460896_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE460896_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE460896_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece460896f.rs b/pqcrypto-classicmceliece/src/mceliece460896f.rs index dbce7bc..7bb9a28 100644 --- a/pqcrypto-classicmceliece/src/mceliece460896f.rs +++ b/pqcrypto-classicmceliece/src/mceliece460896f.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE460896F_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE460896F_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE460896F_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE460896F_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE460896F_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE460896F_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE460896F_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece6688128.rs b/pqcrypto-classicmceliece/src/mceliece6688128.rs index bd462e2..673aabd 100644 --- a/pqcrypto-classicmceliece/src/mceliece6688128.rs +++ b/pqcrypto-classicmceliece/src/mceliece6688128.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE6688128_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE6688128_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE6688128_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE6688128_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE6688128_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE6688128_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE6688128_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece6688128f.rs b/pqcrypto-classicmceliece/src/mceliece6688128f.rs index 2b17787..ffbffcd 100644 --- a/pqcrypto-classicmceliece/src/mceliece6688128f.rs +++ b/pqcrypto-classicmceliece/src/mceliece6688128f.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE6688128F_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE6688128F_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE6688128F_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE6688128F_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE6688128F_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece6960119.rs b/pqcrypto-classicmceliece/src/mceliece6960119.rs index e605e58..83a3c99 100644 --- a/pqcrypto-classicmceliece/src/mceliece6960119.rs +++ b/pqcrypto-classicmceliece/src/mceliece6960119.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE6960119_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE6960119_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE6960119_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE6960119_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE6960119_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE6960119_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE6960119_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece6960119f.rs b/pqcrypto-classicmceliece/src/mceliece6960119f.rs index 5cd3e18..8f1e720 100644 --- a/pqcrypto-classicmceliece/src/mceliece6960119f.rs +++ b/pqcrypto-classicmceliece/src/mceliece6960119f.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE6960119F_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE6960119F_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE6960119F_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE6960119F_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE6960119F_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece8192128.rs b/pqcrypto-classicmceliece/src/mceliece8192128.rs index 3d53c12..6820380 100644 --- a/pqcrypto-classicmceliece/src/mceliece8192128.rs +++ b/pqcrypto-classicmceliece/src/mceliece8192128.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE8192128_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE8192128_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE8192128_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE8192128_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE8192128_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE8192128_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE8192128_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-classicmceliece/src/mceliece8192128f.rs b/pqcrypto-classicmceliece/src/mceliece8192128f.rs index 23ddbe6..e247b5c 100644 --- a/pqcrypto-classicmceliece/src/mceliece8192128f.rs +++ b/pqcrypto-classicmceliece/src/mceliece8192128f.rs @@ -136,7 +136,7 @@ pub fn keypair() -> (PublicKey, SecretKey) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return gen_keypair!(PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_keypair); + return gen_keypair!(PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_keypair); } } gen_keypair!(PQCLEAN_MCELIECE8192128F_CLEAN_crypto_kem_keypair) @@ -159,7 +159,7 @@ pub fn encapsulate(pk: &PublicKey) -> (SharedSecret, Ciphertext) { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return encap!(PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_enc, pk); + return encap!(PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_enc, pk); } } encap!(PQCLEAN_MCELIECE8192128F_CLEAN_crypto_kem_enc, pk) @@ -181,7 +181,7 @@ pub fn decapsulate(ct: &Ciphertext, sk: &SecretKey) -> SharedSecret { #[cfg(all(enable_x86_avx2, feature = "avx2"))] { if std::is_x86_feature_detected!("avx2") { - return decap!(PQCLEAN_MCELIECE8192128F_AVX_crypto_kem_dec, ct, sk); + return decap!(PQCLEAN_MCELIECE8192128F_AVX2_crypto_kem_dec, ct, sk); } } decap!(PQCLEAN_MCELIECE8192128F_CLEAN_crypto_kem_dec, ct, sk) diff --git a/pqcrypto-falcon/Cargo.toml b/pqcrypto-falcon/Cargo.toml index 26c0b44..57858b2 100644 --- a/pqcrypto-falcon/Cargo.toml +++ b/pqcrypto-falcon/Cargo.toml @@ -19,8 +19,9 @@ serde = { version = "1.0", features = ["derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] -default = ["avx2", "std"] +default = ["avx2", "neon", "std"] avx2 = ["std"] +neon = ["std"] std = ["pqcrypto-traits/std"] serialization = ["serde", "serde-big-array"] diff --git a/pqcrypto-falcon/build.rs b/pqcrypto-falcon/build.rs index daf1075..763f50a 100644 --- a/pqcrypto-falcon/build.rs +++ b/pqcrypto-falcon/build.rs @@ -80,6 +80,39 @@ macro_rules! build_avx2 { }; } +macro_rules! build_aarch64 { + ($variant:expr) => { + let internals_include_path = &std::env::var("DEP_PQCRYPTO_INTERNALS_INCLUDEPATH").unwrap(); + let common_dir = Path::new("pqclean/common"); + + let mut builder = cc::Build::new(); + let target_dir: PathBuf = ["pqclean", "crypto_sign", $variant, "aarch64"] + .iter() + .collect(); + + let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); + if target_os == "wasi" { + let wasi_sdk_path = + &std::env::var("WASI_SDK_DIR").expect("missing environment variable: WASI_SDK_DIR"); + builder.flag(format!("--sysroot={}", wasi_sdk_path).as_str()); + } + + let scheme_files = glob::glob(target_dir.join("*.[csS]").to_str().unwrap()).unwrap(); + builder.flag("-march=armv8-a"); + + builder + .include(internals_include_path) + .include(&common_dir) + .include(target_dir) + .files( + scheme_files + .into_iter() + .map(|p| p.unwrap().to_string_lossy().into_owned()), + ); + builder.compile(format!("{}_aarch64", $variant).as_str()); + }; +} + fn main() { #[allow(unused_variables)] let aes_enabled = env::var("CARGO_FEATURE_AES").is_ok(); @@ -115,4 +148,8 @@ fn main() { // Print enableing flag for AVX2 implementation println!("cargo:rustc-cfg=enable_x86_avx2"); } + if target_arch == "aarch64" && neon_enabled { + // Print enableing flag for AARCH64 implementation + println!("cargo:rustc-cfg=enable_aarch64_neon"); + } } diff --git a/pqcrypto-sphincsplus/Cargo.toml b/pqcrypto-sphincsplus/Cargo.toml index c2ec367..eef71e0 100644 --- a/pqcrypto-sphincsplus/Cargo.toml +++ b/pqcrypto-sphincsplus/Cargo.toml @@ -19,9 +19,8 @@ serde = { version = "1.0", features = ["derive"], optional = true } serde-big-array = { version = "0.5.1", optional = true } [features] -default = ["avx2", "aes", "std"] +default = ["avx2", "std"] avx2 = ["std"] -aes = ["std"] std = ["pqcrypto-traits/std"] serialization = ["serde", "serde-big-array"] diff --git a/pqcrypto-sphincsplus/build.rs b/pqcrypto-sphincsplus/build.rs index d768de5..1753061 100644 --- a/pqcrypto-sphincsplus/build.rs +++ b/pqcrypto-sphincsplus/build.rs @@ -36,44 +36,6 @@ macro_rules! build_clean { }; } -macro_rules! build_aesni { - ($variant:expr) => { - let internals_include_path = &std::env::var("DEP_PQCRYPTO_INTERNALS_INCLUDEPATH").unwrap(); - let common_dir = Path::new("pqclean/common"); - - let mut builder = cc::Build::new(); - let target_dir: PathBuf = ["pqclean", "crypto_sign", $variant, "aesni"] - .iter() - .collect(); - - let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); - if target_os == "wasi" { - let wasi_sdk_path = - &std::env::var("WASI_SDK_DIR").expect("missing environment variable: WASI_SDK_DIR"); - builder.flag(format!("--sysroot={}", wasi_sdk_path).as_str()); - } - - let scheme_files = glob::glob(target_dir.join("*.[csS]").to_str().unwrap()).unwrap(); - let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); - if target_env == "msvc" { - builder.flag("/arch:AVX2"); - } else { - builder.flag("-maes"); - } - - builder - .include(internals_include_path) - .include(&common_dir) - .include(target_dir) - .files( - scheme_files - .into_iter() - .map(|p| p.unwrap().to_string_lossy().into_owned()), - ); - builder.compile(format!("{}_aesni", $variant).as_str()); - }; -} - macro_rules! build_avx2 { ($variant:expr) => { let internals_include_path = &std::env::var("DEP_PQCRYPTO_INTERNALS_INCLUDEPATH").unwrap(); @@ -187,8 +149,4 @@ fn main() { // Print enableing flag for AVX2 implementation println!("cargo:rustc-cfg=enable_x86_avx2"); } - if target_arch == "x86_64" && aes_enabled { - // Print enableing flag for AES implementation - println!("cargo:rustc-cfg=enable_x86_aes"); - } }