libsodium_runtime (libsodium v3.0.1)

View Source

CPU features detected by libsodium at startup, used to choose optimized implementations (for example, libsodium_crypto_aead_aes256gcm requires has_aesni/0 and has_pclmul/0 on x86, or has_armcrypto/0 on ARM).

Each function returns 1 when the feature is available on the current CPU and 0 otherwise. Features that do not apply to the CPU architecture are always 0.

Flags = [libsodium_runtime:has_sse2(), libsodium_runtime:has_avx2(), libsodium_runtime:has_neon()],
true = lists:all(fun(Flag) -> Flag =:= 0 orelse Flag =:= 1 end, Flags).

Summary

Functions

Return 1 if the CPU supports x86 AES-NI instructions, otherwise 0.

Return 1 if the CPU supports the ARMv8 cryptography extensions (AES, SHA), otherwise 0.

Return 1 if the CPU and operating system support x86 AVX2, otherwise 0.

Return 1 if the CPU and operating system support x86 AVX-512F, otherwise 0.

Return 1 if the CPU and operating system support x86 AVX, otherwise 0.

Return 1 if the CPU supports ARM NEON (Advanced SIMD), otherwise 0.

Return 1 if the CPU supports x86 carry-less multiplication (PCLMULQDQ), otherwise 0.

Return 1 if the CPU supports the x86 RDRAND instruction, otherwise 0.

Return 1 if the CPU supports x86 SSE2, otherwise 0.

Return 1 if the CPU supports x86 SSE3, otherwise 0.

Return 1 if the CPU supports x86 SSE4.1, otherwise 0.

Return 1 if the CPU supports x86 SSSE3, otherwise 0.

Functions

has_aesni()

-spec has_aesni() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports x86 AES-NI instructions, otherwise 0.

has_armcrypto()

-spec has_armcrypto() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports the ARMv8 cryptography extensions (AES, SHA), otherwise 0.

has_avx2()

-spec has_avx2() -> Result when Result :: 0 | 1.

Return 1 if the CPU and operating system support x86 AVX2, otherwise 0.

has_avx512f()

-spec has_avx512f() -> Result when Result :: 0 | 1.

Return 1 if the CPU and operating system support x86 AVX-512F, otherwise 0.

has_avx()

-spec has_avx() -> Result when Result :: 0 | 1.

Return 1 if the CPU and operating system support x86 AVX, otherwise 0.

has_neon()

-spec has_neon() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports ARM NEON (Advanced SIMD), otherwise 0.

has_pclmul()

-spec has_pclmul() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports x86 carry-less multiplication (PCLMULQDQ), otherwise 0.

has_rdrand()

-spec has_rdrand() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports the x86 RDRAND instruction, otherwise 0.

has_sse2()

-spec has_sse2() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports x86 SSE2, otherwise 0.

has_sse3()

-spec has_sse3() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports x86 SSE3, otherwise 0.

has_sse41()

-spec has_sse41() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports x86 SSE4.1, otherwise 0.

has_ssse3()

-spec has_ssse3() -> Result when Result :: 0 | 1.

Return 1 if the CPU supports x86 SSSE3, otherwise 0.