Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2386,6 +2386,28 @@ if (WOLFSSL_ARMASM_INLINE)
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_ARMASM_INLINE")
endif()

# ARM64 crypto kernels as NEON C intrinsics instead of assembly. Intended for
# MSVC on Windows ARM64: cl.exe compiles no ARM64 inline assembly, and the
# Microsoft-syntax .asm files need a separate armasm64.exe step that is only
# wired up through MSBuild (.vcxproj), not CMake. The intrinsics are ordinary C,
# so they need no assembler and no per-source target-feature flag (MSVC enables
# NEON crypto unconditionally on ARM64).
#
# Mutually exclusive with the assembly forms - it supplies the same *_AARCH64
# symbols - hence a separate opt-in rather than an automatic fallback.
add_option("WOLFSSL_ARMASM_INTRINSICS"
"Use NEON C intrinsics for ARM64 crypto instead of assembly, for MSVC \
(default: disabled)"
"no" "yes;no")

if (WOLFSSL_ARMASM_INTRINSICS)
if (NOT MSVC)
message(FATAL_ERROR "WOLFSSL_ARMASM_INTRINSICS is only supported with "
"MSVC on ARM64; other toolchains should use the assembly path.")
endif()
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_ARMASM_INTRINSICS")
endif()

# TODO:
# - CRL monitor
# - User crypto
Expand Down
15 changes: 15 additions & 0 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ function(generate_build_flags)
endif()
set(BUILD_INLINE ${WOLFSSL_INLINE} PARENT_SCOPE)
set(BUILD_ARMASM_INLINE ${WOLFSSL_ARMASM_INLINE} PARENT_SCOPE)
set(BUILD_ARMASM_INTRINSICS ${WOLFSSL_ARMASM_INTRINSICS} PARENT_SCOPE)
set(BUILD_ARM_THUMB ${WOLFSSL_ARMASM_THUMB2} PARENT_SCOPE)
if(WOLFSSL_OCSP OR WOLFSSL_USER_SETTINGS)
set(BUILD_OCSP "yes" PARENT_SCOPE)
Expand Down Expand Up @@ -1345,6 +1346,20 @@ function(generate_lib_src_list LIB_SOURCES)
list(APPEND LIB_SOURCES wolfcrypt/src/puf.c)
endif()

# ARM64 crypto kernels as NEON C intrinsics (MSVC on Windows ARM64).
# Supplies the same *_AARCH64 symbols as the assembly forms, so it is an
# alternative to them rather than an addition - see WOLFSSL_ARMASM_INTRINSICS
# in CMakeLists.txt. Each file is self-guarding on the macro, so listing them
# unconditionally would also work; they are gated here to keep the compile
# command clean and to avoid listing sources no other toolchain can use.
if(BUILD_ARMASM_INTRINSICS)
list(APPEND LIB_SOURCES
wolfcrypt/src/port/arm/armv8-aes-intrinsics-msvc.c
wolfcrypt/src/port/arm/armv8-sha-intrinsics-msvc.c
wolfcrypt/src/port/arm/armv8-poly1305-intrinsics-msvc.c
wolfcrypt/src/port/arm/armv8-chacha-intrinsics-msvc.c)
endif()

set(LIB_SOURCES ${LIB_SOURCES} PARENT_SCOPE)
endfunction()

Expand Down
7 changes: 7 additions & 0 deletions wolfcrypt/src/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ EXTRA_DIST += wolfcrypt/src/port/arm/armv8-poly1305-asm.asm
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-sha256-asm.asm
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-sha3-asm.asm
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-sha512-asm.asm
# ARM64 crypto as NEON C intrinsics, for MSVC on Windows ARM64 (built via CMake
# with WOLFSSL_ARMASM_INTRINSICS, or the MSVC project files). Not built by
# autotools, which targets GCC/Clang where the assembly path applies.
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-aes-intrinsics-msvc.c
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-sha-intrinsics-msvc.c
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-poly1305-intrinsics-msvc.c
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-chacha-intrinsics-msvc.c
EXTRA_DIST += wolfcrypt/src/wc_dsp.c
EXTRA_DIST += wolfcrypt/src/sp_dsp32.c
EXTRA_DIST += wolfcrypt/src/sp_x86_64_asm.asm
Expand Down
Loading