mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-10-24 04:09:07 +03:00
ARM66 Windows: Add assembly
Add assembly generated for Windows ARM64. Add build option to project files. Add CI loops.
This commit is contained in:
57
.github/workflows/windows-arm64.yml
vendored
Normal file
57
.github/workflows/windows-arm64.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Windows ARM64 Test
|
||||
|
||||
# Builds and tests wolfSSL on a native Windows-on-ARM64 runner. Unlike the
|
||||
# cross-compiled ARM64 job in os-check.yml (which runs on an x64 runner and can
|
||||
# only build), this runs on GitHub's native windows-11-arm image so the test
|
||||
# suite executes on the target ISA. The WolfSSLAarch64Asm=true leg assembles
|
||||
# the ARMv8 crypto .asm (armasm64) and enables the WOLFSSL_ARMASM code paths.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'release/**' ]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'doc/**'
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
branches: [ '*' ]
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- 'doc/**'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
windows_arm64_build:
|
||||
name: Windows ARM64 Build Test
|
||||
if: ${{ (github.repository_owner == 'wolfssl') && (github.event_name != 'pull_request' || github.event.pull_request.draft == false) }}
|
||||
runs-on: windows-11-arm
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# false: pure-C ARM64 build. true: assemble the ARMv8 crypto .asm and
|
||||
# enable the matching WOLFSSL_ARMASM code paths.
|
||||
asm: [ false, true ]
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
SOLUTION_FILE_PATH: wolfssl64.sln
|
||||
BUILD_CONFIGURATION: Release
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v3
|
||||
|
||||
- name: Restore NuGet packages
|
||||
working-directory: ${{env.GITHUB_WORKSPACE}}
|
||||
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{env.GITHUB_WORKSPACE}}
|
||||
run: msbuild /m /p:PlatformToolset=v143 /p:Platform=ARM64 /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:WolfSSLAarch64Asm=${{matrix.asm}} ${{env.SOLUTION_FILE_PATH}}
|
||||
|
||||
- name: Run Test
|
||||
working-directory: ${{env.GITHUB_WORKSPACE}}
|
||||
run: Release/ARM64/testsuite.exe
|
||||
@@ -486,6 +486,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -486,6 +486,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -486,6 +486,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -486,6 +486,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -264,6 +264,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -265,6 +265,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -492,6 +492,13 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- Keep WOLFSSL_ARMASM consistent with the library (set by
|
||||
/p:WolfSSLAarch64Asm=true) so struct layouts match. -->
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -403,6 +403,73 @@
|
||||
new_cpuid_flags |= CPUID_SM4;
|
||||
#endif
|
||||
|
||||
(void)wolfSSL_Atomic_Uint_CompareExchange
|
||||
(&cpuid_flags, &old_cpuid_flags, new_cpuid_flags);
|
||||
}
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
/* Windows on ARM64. IsProcessorFeaturePresent() is the documented way to
|
||||
* query instruction-set extensions: NEON (the 32x64-bit VFP register bank),
|
||||
* the mandatory ARMv8 crypto extension (AES / PMULL / SHA-1 / SHA-256,
|
||||
* reported as one feature), and the optional FEAT_SHA3 / FEAT_SHA512
|
||||
* extensions each have their own flag. FEAT_RDM (SQRDMLSH, ARMv8.1) has no
|
||||
* dedicated flag, so it is gated on the ARMv8.2 dot-product feature. */
|
||||
#include <windows.h>
|
||||
|
||||
/* Older Windows SDKs may not define these processor-feature constants. */
|
||||
#ifndef PF_ARM_VFP_32_REGISTERS_AVAILABLE
|
||||
#define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
|
||||
#endif
|
||||
#ifndef PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE
|
||||
#define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
|
||||
#endif
|
||||
#ifndef PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE
|
||||
#define PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE 64
|
||||
#endif
|
||||
#ifndef PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE
|
||||
#define PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE 65
|
||||
#endif
|
||||
/* No dedicated flag for FEAT_RDM (ARMv8.1); gate on ARMv8.2 dot-product -
|
||||
* a CPU reporting v8.2 DP necessarily implements the v8.1 RDM (SQRDMLSH)
|
||||
* instructions the ML-KEM assembly uses. */
|
||||
#ifndef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE
|
||||
#define PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE 43
|
||||
#endif
|
||||
|
||||
static WC_INLINE void cpuid_set_flags(void)
|
||||
{
|
||||
if (WOLFSSL_ATOMIC_LOAD(cpuid_flags) == WC_CPUID_INITIALIZER) {
|
||||
cpuid_flags_t new_cpuid_flags = 0,
|
||||
old_cpuid_flags = WC_CPUID_INITIALIZER;
|
||||
|
||||
#ifndef WOLFSSL_ARMASM_NO_NEON
|
||||
if (IsProcessorFeaturePresent(PF_ARM_VFP_32_REGISTERS_AVAILABLE))
|
||||
new_cpuid_flags |= CPUID_ASIMD;
|
||||
#endif
|
||||
#ifndef WOLFSSL_ARMASM_NO_HW_CRYPTO
|
||||
if (IsProcessorFeaturePresent(
|
||||
PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)) {
|
||||
new_cpuid_flags |= CPUID_AES;
|
||||
new_cpuid_flags |= CPUID_PMULL;
|
||||
new_cpuid_flags |= CPUID_SHA256;
|
||||
}
|
||||
#endif
|
||||
#ifdef WOLFSSL_ARMASM_CRYPTO_SHA512
|
||||
if (IsProcessorFeaturePresent(
|
||||
PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE))
|
||||
new_cpuid_flags |= CPUID_SHA512;
|
||||
#endif
|
||||
#if !defined(WOLFSSL_AARCH64_NO_SQRDMLSH)
|
||||
if (IsProcessorFeaturePresent(
|
||||
PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE))
|
||||
new_cpuid_flags |= CPUID_RDM;
|
||||
#endif
|
||||
#ifdef WOLFSSL_ARMASM_CRYPTO_SHA3
|
||||
if (IsProcessorFeaturePresent(
|
||||
PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE))
|
||||
new_cpuid_flags |= CPUID_SHA3;
|
||||
#endif
|
||||
|
||||
(void)wolfSSL_Atomic_Uint_CompareExchange
|
||||
(&cpuid_flags, &old_cpuid_flags, new_cpuid_flags);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,14 @@ EXTRA_DIST += wolfcrypt/src/sha512_asm.asm
|
||||
EXTRA_DIST += wolfcrypt/src/sha3_asm.asm
|
||||
EXTRA_DIST += wolfcrypt/src/wc_mlkem_asm.asm
|
||||
EXTRA_DIST += wolfcrypt/src/wc_mldsa_asm.asm
|
||||
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-aes-asm.asm
|
||||
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-chacha-asm.asm
|
||||
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-curve25519.asm
|
||||
EXTRA_DIST += wolfcrypt/src/port/arm/armv8-mlkem-asm.asm
|
||||
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
|
||||
EXTRA_DIST += wolfcrypt/src/wc_dsp.c
|
||||
EXTRA_DIST += wolfcrypt/src/sp_dsp32.c
|
||||
EXTRA_DIST += wolfcrypt/src/sp_x86_64_asm.asm
|
||||
|
||||
55923
wolfcrypt/src/port/arm/armv8-aes-asm.asm
Normal file
55923
wolfcrypt/src/port/arm/armv8-aes-asm.asm
Normal file
File diff suppressed because it is too large
Load Diff
1016
wolfcrypt/src/port/arm/armv8-chacha-asm.asm
Normal file
1016
wolfcrypt/src/port/arm/armv8-chacha-asm.asm
Normal file
File diff suppressed because it is too large
Load Diff
11482
wolfcrypt/src/port/arm/armv8-curve25519.asm
Normal file
11482
wolfcrypt/src/port/arm/armv8-curve25519.asm
Normal file
File diff suppressed because it is too large
Load Diff
11426
wolfcrypt/src/port/arm/armv8-mlkem-asm.asm
Normal file
11426
wolfcrypt/src/port/arm/armv8-mlkem-asm.asm
Normal file
File diff suppressed because it is too large
Load Diff
645
wolfcrypt/src/port/arm/armv8-poly1305-asm.asm
Normal file
645
wolfcrypt/src/port/arm/armv8-poly1305-asm.asm
Normal file
@@ -0,0 +1,645 @@
|
||||
; /* armv8-poly1305-asm
|
||||
; *
|
||||
; * Copyright (C) 2006-2026 wolfSSL Inc.
|
||||
; *
|
||||
; * This file is part of wolfSSL.
|
||||
; *
|
||||
; * wolfSSL is free software; you can redistribute it and/or modify
|
||||
; * it under the terms of the GNU General Public License as published by
|
||||
; * the Free Software Foundation; either version 3 of the License, or
|
||||
; * (at your option) any later version.
|
||||
; *
|
||||
; * wolfSSL is distributed in the hope that it will be useful,
|
||||
; * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; * GNU General Public License for more details.
|
||||
; *
|
||||
; * You should have received a copy of the GNU General Public License
|
||||
; * along with this program; if not, write to the Free Software
|
||||
; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
; */
|
||||
|
||||
|
||||
; Generated using (from wolfssl):
|
||||
; cd ../scripts
|
||||
; ruby ./poly1305/poly1305.rb arm64 \
|
||||
; ../wolfssl/wolfcrypt/src/port/arm/armv8-poly1305-asm.asm
|
||||
AREA |.text|, CODE, READONLY
|
||||
ALIGN 4
|
||||
EXPORT poly1305_arm64_block_16
|
||||
poly1305_arm64_block_16 PROC
|
||||
; Load h
|
||||
ldp w2, w3, [x0, #96]
|
||||
ldp w4, w11, [x0, #104]
|
||||
ldr w12, [x0, #112]
|
||||
; Load m
|
||||
ldr x14, [x1]
|
||||
ldr x15, [x1, #8]
|
||||
; Load r
|
||||
ldp x5, x6, [x0]
|
||||
; h: Base26 -> Base 64
|
||||
add x2, x2, x3, lsl 26
|
||||
lsr x3, x4, #12
|
||||
add x2, x2, x4, lsl 52
|
||||
add x3, x3, x11, lsl 14
|
||||
lsr x4, x12, #24
|
||||
add x3, x3, x12, lsl 40
|
||||
; Add m and !finished at bit 128
|
||||
adds x2, x2, x14
|
||||
adcs x3, x3, x15
|
||||
adc x4, x4, xzr
|
||||
; Multiply h by r
|
||||
; b[0] * a[0]
|
||||
mul x7, x5, x2
|
||||
umulh x8, x5, x2
|
||||
; b[0] * a[1]
|
||||
mul x10, x5, x3
|
||||
umulh x9, x5, x3
|
||||
; b[1] * a[0]
|
||||
mul x11, x6, x2
|
||||
umulh x12, x6, x2
|
||||
adds x8, x8, x10
|
||||
; b[1] * a[1]
|
||||
mul x13, x6, x3
|
||||
umulh x10, x6, x3
|
||||
adc x9, x9, x12
|
||||
adds x8, x8, x11
|
||||
; b[0] * a[2]
|
||||
mul x11, x5, x4
|
||||
adcs x9, x9, x13
|
||||
; b[1] * a[2]
|
||||
mul x12, x6, x4
|
||||
adc x10, x10, xzr
|
||||
adds x9, x9, x11
|
||||
adc x10, x10, x12
|
||||
; Reduce mod 2^130 - 5
|
||||
; Get high bits
|
||||
and x11, x9, #-4
|
||||
; Get top two bits
|
||||
and x9, x9, #3
|
||||
; Add top bits * 4
|
||||
adds x2, x7, x11
|
||||
; Move down 2 bits
|
||||
extr x11, x10, x11, #2
|
||||
adcs x3, x8, x10
|
||||
lsr x10, x10, #2
|
||||
adc x4, x9, xzr
|
||||
; Add top bits.
|
||||
adds x2, x2, x11
|
||||
adcs x3, x3, x10
|
||||
adc x4, x4, xzr
|
||||
extr x12, x4, x3, #40
|
||||
ubfx x4, x2, #52, #12
|
||||
ubfx x11, x3, #14, #26
|
||||
bfi x4, x3, #12, #14
|
||||
ubfx x3, x2, #26, #26
|
||||
ubfx x2, x2, #0, #26
|
||||
stp w2, w3, [x0, #96]
|
||||
stp w4, w11, [x0, #104]
|
||||
str w12, [x0, #112]
|
||||
ret
|
||||
ENDP
|
||||
AREA |.text|, CODE, READONLY
|
||||
ALIGN 4
|
||||
EXPORT poly1305_arm64_blocks
|
||||
poly1305_arm64_blocks PROC
|
||||
stp x29, x30, [sp, #-96]!
|
||||
add x29, sp, #0
|
||||
str x17, [x29, #24]
|
||||
stp d8, d9, [x29, #32]
|
||||
stp d10, d11, [x29, #48]
|
||||
stp d12, d13, [x29, #64]
|
||||
stp d14, d15, [x29, #80]
|
||||
cmp x2, #0x40
|
||||
blt L_poly1305_arm64_blocks_done
|
||||
; Set mask (0x3ffffff), hi bit and 5 into vector registers
|
||||
movi v25.16b, #0xff
|
||||
movi v27.4s, #1, lsl 24
|
||||
ushr v25.4s, v25.4s, #6
|
||||
movi v24.4s, #5
|
||||
uxtl v26.2d, v25.2s
|
||||
add x14, x0, #16
|
||||
ld4 {v15.4s, v16.4s, v17.4s, v18.4s}, [x14], #0x40
|
||||
ld1 {v19.4s}, [x14]
|
||||
add x14, x0, #0x60
|
||||
movi v0.4s, #0
|
||||
movi v1.4s, #0
|
||||
movi v2.4s, #0
|
||||
movi v3.4s, #0
|
||||
movi v4.4s, #0
|
||||
ld4 {v0.s, v1.s, v2.s, v3.s}[0], [x14], #16
|
||||
ld1 {v4.s}[0], [x14]
|
||||
mul v20.4s, v16.4s, v24.4s
|
||||
mul v21.4s, v17.4s, v24.4s
|
||||
mul v22.4s, v18.4s, v24.4s
|
||||
mul v23.4s, v19.4s, v24.4s
|
||||
L_poly1305_arm64_blocks_loop_64
|
||||
; Load message of 64 bytes - setting hi bit for not finished
|
||||
ld4 {v5.4s, v6.4s, v7.4s, v8.4s}, [x1], #0x40
|
||||
sub x2, x2, #0x40
|
||||
ushr v9.4s, v8.4s, #8
|
||||
shl v8.4s, v8.4s, #18
|
||||
orr v9.16b, v9.16b, v27.16b
|
||||
sri v8.4s, v7.4s, #14
|
||||
shl v7.4s, v7.4s, #12
|
||||
and v8.16b, v8.16b, v25.16b
|
||||
sri v7.4s, v6.4s, #20
|
||||
shl v6.4s, v6.4s, #6
|
||||
and v7.16b, v7.16b, v25.16b
|
||||
sri v6.4s, v5.4s, #26
|
||||
and v5.16b, v5.16b, v25.16b
|
||||
and v6.16b, v6.16b, v25.16b
|
||||
umull2 v10.2d, v5.4s, v15.4s
|
||||
umull2 v11.2d, v5.4s, v16.4s
|
||||
umull2 v12.2d, v5.4s, v17.4s
|
||||
umull2 v13.2d, v5.4s, v18.4s
|
||||
umull2 v14.2d, v5.4s, v19.4s
|
||||
umlal2 v10.2d, v6.4s, v23.4s
|
||||
umlal2 v11.2d, v6.4s, v15.4s
|
||||
umlal2 v12.2d, v6.4s, v16.4s
|
||||
umlal2 v13.2d, v6.4s, v17.4s
|
||||
umlal2 v14.2d, v6.4s, v18.4s
|
||||
umlal2 v10.2d, v7.4s, v22.4s
|
||||
umlal2 v11.2d, v7.4s, v23.4s
|
||||
umlal2 v12.2d, v7.4s, v15.4s
|
||||
umlal2 v13.2d, v7.4s, v16.4s
|
||||
umlal2 v14.2d, v7.4s, v17.4s
|
||||
umlal2 v10.2d, v8.4s, v21.4s
|
||||
umlal2 v11.2d, v8.4s, v22.4s
|
||||
umlal2 v12.2d, v8.4s, v23.4s
|
||||
umlal2 v13.2d, v8.4s, v15.4s
|
||||
umlal2 v14.2d, v8.4s, v16.4s
|
||||
umlal2 v10.2d, v9.4s, v20.4s
|
||||
umlal2 v11.2d, v9.4s, v21.4s
|
||||
umlal2 v12.2d, v9.4s, v22.4s
|
||||
umlal2 v13.2d, v9.4s, v23.4s
|
||||
umlal2 v14.2d, v9.4s, v15.4s
|
||||
add v5.4s, v5.4s, v0.4s
|
||||
add v6.4s, v6.4s, v1.4s
|
||||
add v7.4s, v7.4s, v2.4s
|
||||
add v8.4s, v8.4s, v3.4s
|
||||
add v9.4s, v9.4s, v4.4s
|
||||
umlal v10.2d, v5.2s, v15.2s
|
||||
umlal v11.2d, v5.2s, v16.2s
|
||||
umlal v12.2d, v5.2s, v17.2s
|
||||
umlal v13.2d, v5.2s, v18.2s
|
||||
umlal v14.2d, v5.2s, v19.2s
|
||||
umlal v10.2d, v6.2s, v23.2s
|
||||
umlal v11.2d, v6.2s, v15.2s
|
||||
umlal v12.2d, v6.2s, v16.2s
|
||||
umlal v13.2d, v6.2s, v17.2s
|
||||
umlal v14.2d, v6.2s, v18.2s
|
||||
umlal v10.2d, v7.2s, v22.2s
|
||||
umlal v11.2d, v7.2s, v23.2s
|
||||
umlal v12.2d, v7.2s, v15.2s
|
||||
umlal v13.2d, v7.2s, v16.2s
|
||||
umlal v14.2d, v7.2s, v17.2s
|
||||
umlal v10.2d, v8.2s, v21.2s
|
||||
umlal v11.2d, v8.2s, v22.2s
|
||||
umlal v12.2d, v8.2s, v23.2s
|
||||
umlal v13.2d, v8.2s, v15.2s
|
||||
umlal v14.2d, v8.2s, v16.2s
|
||||
umlal v10.2d, v9.2s, v20.2s
|
||||
umlal v11.2d, v9.2s, v21.2s
|
||||
umlal v12.2d, v9.2s, v22.2s
|
||||
umlal v13.2d, v9.2s, v23.2s
|
||||
umlal v14.2d, v9.2s, v15.2s
|
||||
addp d10, v10.2d
|
||||
addp d11, v11.2d
|
||||
addp d12, v12.2d
|
||||
addp d13, v13.2d
|
||||
addp d14, v14.2d
|
||||
; Redistribute and handle overflow
|
||||
usra v11.2d, v10.2d, #26
|
||||
and v10.16b, v10.16b, v26.16b
|
||||
usra v14.2d, v13.2d, #26
|
||||
and v3.16b, v13.16b, v26.16b
|
||||
ushr v2.2d, v14.2d, #26
|
||||
usra v12.2d, v11.2d, #26
|
||||
shl v0.2d, v2.2d, #2
|
||||
and v1.16b, v11.16b, v26.16b
|
||||
add v0.2d, v0.2d, v2.2d
|
||||
and v4.16b, v14.16b, v26.16b
|
||||
add v10.2d, v10.2d, v0.2d
|
||||
usra v3.2d, v12.2d, #26
|
||||
and v2.16b, v12.16b, v26.16b
|
||||
usra v1.2d, v10.2d, #26
|
||||
and v0.16b, v10.16b, v26.16b
|
||||
usra v4.2d, v3.2d, #26
|
||||
and v3.16b, v3.16b, v26.16b
|
||||
cmp x2, #0x40
|
||||
bge L_poly1305_arm64_blocks_loop_64
|
||||
cmp x2, #16
|
||||
ble L_poly1305_arm64_blocks_done_32
|
||||
; Start 32
|
||||
ld4 {v5.2s, v6.2s, v7.2s, v8.2s}, [x1], #32
|
||||
sub x2, x2, #32
|
||||
mov v15.d[0], v15.d[1]
|
||||
mov v16.d[0], v16.d[1]
|
||||
mov v17.d[0], v17.d[1]
|
||||
mov v18.d[0], v18.d[1]
|
||||
mov v19.d[0], v19.d[1]
|
||||
mov v20.d[0], v20.d[1]
|
||||
mov v21.d[0], v21.d[1]
|
||||
mov v22.d[0], v22.d[1]
|
||||
mov v23.d[0], v23.d[1]
|
||||
ushr v9.2s, v8.2s, #8
|
||||
shl v8.2s, v8.2s, #18
|
||||
orr v9.8b, v9.8b, v27.8b
|
||||
sri v8.2s, v7.2s, #14
|
||||
shl v7.2s, v7.2s, #12
|
||||
and v8.8b, v8.8b, v25.8b
|
||||
sri v7.2s, v6.2s, #20
|
||||
shl v6.2s, v6.2s, #6
|
||||
and v7.8b, v7.8b, v25.8b
|
||||
sri v6.2s, v5.2s, #26
|
||||
and v5.8b, v5.8b, v25.8b
|
||||
and v6.8b, v6.8b, v25.8b
|
||||
add v5.2s, v5.2s, v0.2s
|
||||
add v6.2s, v6.2s, v1.2s
|
||||
add v7.2s, v7.2s, v2.2s
|
||||
add v8.2s, v8.2s, v3.2s
|
||||
add v9.2s, v9.2s, v4.2s
|
||||
umull v10.2d, v5.2s, v15.2s
|
||||
umull v11.2d, v5.2s, v16.2s
|
||||
umull v12.2d, v5.2s, v17.2s
|
||||
umull v13.2d, v5.2s, v18.2s
|
||||
umull v14.2d, v5.2s, v19.2s
|
||||
umlal v10.2d, v6.2s, v23.2s
|
||||
umlal v11.2d, v6.2s, v15.2s
|
||||
umlal v12.2d, v6.2s, v16.2s
|
||||
umlal v13.2d, v6.2s, v17.2s
|
||||
umlal v14.2d, v6.2s, v18.2s
|
||||
umlal v10.2d, v7.2s, v22.2s
|
||||
umlal v11.2d, v7.2s, v23.2s
|
||||
umlal v12.2d, v7.2s, v15.2s
|
||||
umlal v13.2d, v7.2s, v16.2s
|
||||
umlal v14.2d, v7.2s, v17.2s
|
||||
umlal v10.2d, v8.2s, v21.2s
|
||||
umlal v11.2d, v8.2s, v22.2s
|
||||
umlal v12.2d, v8.2s, v23.2s
|
||||
umlal v13.2d, v8.2s, v15.2s
|
||||
umlal v14.2d, v8.2s, v16.2s
|
||||
umlal v10.2d, v9.2s, v20.2s
|
||||
umlal v11.2d, v9.2s, v21.2s
|
||||
umlal v12.2d, v9.2s, v22.2s
|
||||
umlal v13.2d, v9.2s, v23.2s
|
||||
umlal v14.2d, v9.2s, v15.2s
|
||||
addp d10, v10.2d
|
||||
addp d11, v11.2d
|
||||
addp d12, v12.2d
|
||||
addp d13, v13.2d
|
||||
addp d14, v14.2d
|
||||
; Redistribute and handle overflow
|
||||
usra v11.2d, v10.2d, #26
|
||||
and v10.16b, v10.16b, v26.16b
|
||||
usra v14.2d, v13.2d, #26
|
||||
and v3.16b, v13.16b, v26.16b
|
||||
ushr v2.2d, v14.2d, #26
|
||||
usra v12.2d, v11.2d, #26
|
||||
shl v0.2d, v2.2d, #2
|
||||
and v1.16b, v11.16b, v26.16b
|
||||
add v0.2d, v0.2d, v2.2d
|
||||
and v4.16b, v14.16b, v26.16b
|
||||
add v10.2d, v10.2d, v0.2d
|
||||
usra v3.2d, v12.2d, #26
|
||||
and v2.16b, v12.16b, v26.16b
|
||||
usra v1.2d, v10.2d, #26
|
||||
and v0.16b, v10.16b, v26.16b
|
||||
usra v4.2d, v3.2d, #26
|
||||
and v3.16b, v3.16b, v26.16b
|
||||
L_poly1305_arm64_blocks_done_32
|
||||
cmp x2, #16
|
||||
beq L_poly1305_arm64_blocks_transfer
|
||||
add x14, x0, #0x60
|
||||
st4 {v0.s, v1.s, v2.s, v3.s}[0], [x14], #16
|
||||
st1 {v4.s}[0], [x14]
|
||||
b L_poly1305_arm64_blocks_done_all
|
||||
L_poly1305_arm64_blocks_transfer
|
||||
mov w3, v0.s[0]
|
||||
mov w4, v1.s[0]
|
||||
mov w5, v2.s[0]
|
||||
mov w6, v3.s[0]
|
||||
mov w7, v4.s[0]
|
||||
b L_poly1305_arm64_blocks_start
|
||||
L_poly1305_arm64_blocks_done
|
||||
cmp x2, #16
|
||||
blt L_poly1305_arm64_blocks_done_all
|
||||
; Load h
|
||||
ldp w3, w4, [x0, #96]
|
||||
ldp w5, w6, [x0, #104]
|
||||
ldr w7, [x0, #112]
|
||||
L_poly1305_arm64_blocks_start
|
||||
mov x17, #1
|
||||
; Load r
|
||||
ldp x8, x9, [x0]
|
||||
; Base26 -> Base 64
|
||||
add x3, x3, x4, lsl 26
|
||||
lsr x4, x5, #12
|
||||
add x3, x3, x5, lsl 52
|
||||
add x4, x4, x6, lsl 14
|
||||
lsr x5, x7, #24
|
||||
add x4, x4, x7, lsl 40
|
||||
L_poly1305_arm64_blocks_loop
|
||||
; Load m
|
||||
ldr x14, [x1]
|
||||
ldr x15, [x1, #8]
|
||||
; Add m and !finished at bit 128
|
||||
adds x3, x3, x14
|
||||
adcs x4, x4, x15
|
||||
adc x5, x5, x17
|
||||
; Multiply h by r
|
||||
; b[0] * a[0]
|
||||
mul x10, x8, x3
|
||||
umulh x11, x8, x3
|
||||
; b[0] * a[1]
|
||||
mul x13, x8, x4
|
||||
umulh x12, x8, x4
|
||||
; b[1] * a[0]
|
||||
mul x14, x9, x3
|
||||
umulh x15, x9, x3
|
||||
adds x11, x11, x13
|
||||
; b[1] * a[1]
|
||||
mul x16, x9, x4
|
||||
umulh x13, x9, x4
|
||||
adc x12, x12, x15
|
||||
adds x11, x11, x14
|
||||
; b[0] * a[2]
|
||||
mul x14, x8, x5
|
||||
adcs x12, x12, x16
|
||||
; b[1] * a[2]
|
||||
mul x15, x9, x5
|
||||
adc x13, x13, xzr
|
||||
adds x12, x12, x14
|
||||
adc x13, x13, x15
|
||||
; Reduce mod 2^130 - 5
|
||||
; Get high bits
|
||||
and x14, x12, #-4
|
||||
; Get top two bits
|
||||
and x12, x12, #3
|
||||
; Add top bits * 4
|
||||
adds x3, x10, x14
|
||||
; Move down 2 bits
|
||||
extr x14, x13, x14, #2
|
||||
adcs x4, x11, x13
|
||||
lsr x13, x13, #2
|
||||
adc x5, x12, xzr
|
||||
; Add top bits.
|
||||
adds x3, x3, x14
|
||||
adcs x4, x4, x13
|
||||
adc x5, x5, xzr
|
||||
; Sub 16 from length.
|
||||
subs x2, x2, #16
|
||||
add x1, x1, #16
|
||||
; Loop again if more message to do.
|
||||
bgt L_poly1305_arm64_blocks_loop
|
||||
extr x7, x5, x4, #40
|
||||
ubfx x5, x3, #52, #12
|
||||
ubfx x6, x4, #14, #26
|
||||
bfi x5, x4, #12, #14
|
||||
ubfx x4, x3, #26, #26
|
||||
ubfx x3, x3, #0, #26
|
||||
stp w3, w4, [x0, #96]
|
||||
stp w5, w6, [x0, #104]
|
||||
str w7, [x0, #112]
|
||||
L_poly1305_arm64_blocks_done_all
|
||||
ldr x17, [x29, #24]
|
||||
ldp d8, d9, [x29, #32]
|
||||
ldp d10, d11, [x29, #48]
|
||||
ldp d12, d13, [x29, #64]
|
||||
ldp d14, d15, [x29, #80]
|
||||
ldp x29, x30, [sp], #0x60
|
||||
ret
|
||||
ENDP
|
||||
AREA |.rodata|, DATA, READONLY
|
||||
ALIGN 8
|
||||
L_poly1305_set_key_arm64_clamp
|
||||
DCD 0x0fffffff, 0x0ffffffc, 0x0ffffffc, 0x0ffffffc
|
||||
AREA |.text|, CODE, READONLY
|
||||
ALIGN 4
|
||||
EXPORT poly1305_set_key
|
||||
poly1305_set_key PROC
|
||||
stp x29, x30, [sp, #-32]!
|
||||
add x29, sp, #0
|
||||
str x17, [x29, #24]
|
||||
adrp x2, L_poly1305_set_key_arm64_clamp
|
||||
add x2, x2, L_poly1305_set_key_arm64_clamp
|
||||
; Load key and pad.
|
||||
ldp x11, x12, [x1]
|
||||
ldp x14, x15, [x1, #16]
|
||||
; Load mask.
|
||||
ldp x16, x17, [x2]
|
||||
; Save pad for later
|
||||
stp x14, x15, [x0, #120]
|
||||
; Apply clamp.
|
||||
; r &= 0x0ffffffc0ffffffc0ffffffc0fffffff
|
||||
and x11, x11, x16
|
||||
and x12, x12, x17
|
||||
; Store r - 64-bit version.
|
||||
stp x11, x12, [x0]
|
||||
; 128-bits: Base 64 -> Base 26
|
||||
lsr x7, x12, #40
|
||||
ubfx x5, x11, #52, #12
|
||||
ubfx x6, x12, #14, #26
|
||||
bfi x5, x12, #12, #14
|
||||
ubfx x4, x11, #26, #26
|
||||
ubfx x3, x11, #0, #26
|
||||
stp w3, w4, [x0, #64]
|
||||
stp w5, w6, [x0, #72]
|
||||
str w7, [x0, #92]
|
||||
; Compute r^2
|
||||
; a[0] * a[0]
|
||||
mul x3, x11, x11
|
||||
umulh x4, x11, x11
|
||||
; 2 * a[0] * a[1]
|
||||
mul x14, x11, x12
|
||||
umulh x5, x11, x12
|
||||
; a[1] * a[1]
|
||||
mul x15, x12, x12
|
||||
umulh x6, x12, x12
|
||||
adds x4, x4, x14, lsl 1
|
||||
extr x5, x5, x14, #63
|
||||
adcs x5, x5, x15
|
||||
adc x6, x6, xzr
|
||||
; Reduce mod 2^130 - 5
|
||||
; Get high bits
|
||||
and x14, x5, #-4
|
||||
; Get top two bits
|
||||
and x5, x5, #3
|
||||
; Add top bits * 4
|
||||
adds x8, x3, x14
|
||||
; Move down 2 bits
|
||||
extr x14, x6, x14, #2
|
||||
adcs x9, x4, x6
|
||||
lsr x6, x6, #2
|
||||
adc x10, x5, xzr
|
||||
; Add top bits.
|
||||
adds x8, x8, x14
|
||||
adcs x9, x9, x6
|
||||
adc x10, x10, xzr
|
||||
; 130-bits: Base 64 -> Base 26
|
||||
extr x7, x10, x9, #40
|
||||
ubfx x5, x8, #52, #12
|
||||
ubfx x6, x9, #14, #26
|
||||
bfi x5, x9, #12, #14
|
||||
ubfx x4, x8, #26, #26
|
||||
ubfx x3, x8, #0, #26
|
||||
stp w3, w4, [x0, #48]
|
||||
stp w5, w6, [x0, #56]
|
||||
str w7, [x0, #88]
|
||||
; Compute r^3
|
||||
; b[0] * a[0]
|
||||
mul x3, x11, x8
|
||||
umulh x4, x11, x8
|
||||
; b[0] * a[1]
|
||||
mul x6, x11, x9
|
||||
umulh x5, x11, x9
|
||||
; b[1] * a[0]
|
||||
mul x14, x12, x8
|
||||
umulh x15, x12, x8
|
||||
adds x4, x4, x6
|
||||
; b[1] * a[1]
|
||||
mul x16, x12, x9
|
||||
umulh x6, x12, x9
|
||||
adc x5, x5, x15
|
||||
adds x4, x4, x14
|
||||
; b[0] * a[2]
|
||||
mul x14, x11, x10
|
||||
adcs x5, x5, x16
|
||||
; b[1] * a[2]
|
||||
mul x15, x12, x10
|
||||
adc x6, x6, xzr
|
||||
adds x5, x5, x14
|
||||
adc x6, x6, x15
|
||||
; Reduce mod 2^130 - 5
|
||||
; Get high bits
|
||||
and x14, x5, #-4
|
||||
; Get top two bits
|
||||
and x5, x5, #3
|
||||
; Add top bits * 4
|
||||
adds x8, x3, x14
|
||||
; Move down 2 bits
|
||||
extr x14, x6, x14, #2
|
||||
adcs x9, x4, x6
|
||||
lsr x6, x6, #2
|
||||
adc x10, x5, xzr
|
||||
; Add top bits.
|
||||
adds x8, x8, x14
|
||||
adcs x9, x9, x6
|
||||
adc x10, x10, xzr
|
||||
; 130-bits: Base 64 -> Base 26
|
||||
extr x7, x10, x9, #40
|
||||
ubfx x5, x8, #52, #12
|
||||
ubfx x6, x9, #14, #26
|
||||
bfi x5, x9, #12, #14
|
||||
ubfx x4, x8, #26, #26
|
||||
ubfx x3, x8, #0, #26
|
||||
stp w3, w4, [x0, #32]
|
||||
stp w5, w6, [x0, #40]
|
||||
str w7, [x0, #84]
|
||||
; Compute r^4
|
||||
; b[0] * a[0]
|
||||
mul x3, x11, x8
|
||||
umulh x4, x11, x8
|
||||
; b[0] * a[1]
|
||||
mul x6, x11, x9
|
||||
umulh x5, x11, x9
|
||||
; b[1] * a[0]
|
||||
mul x14, x12, x8
|
||||
umulh x15, x12, x8
|
||||
adds x4, x4, x6
|
||||
; b[1] * a[1]
|
||||
mul x16, x12, x9
|
||||
umulh x6, x12, x9
|
||||
adc x5, x5, x15
|
||||
adds x4, x4, x14
|
||||
; b[0] * a[2]
|
||||
mul x14, x11, x10
|
||||
adcs x5, x5, x16
|
||||
; b[1] * a[2]
|
||||
mul x15, x12, x10
|
||||
adc x6, x6, xzr
|
||||
adds x5, x5, x14
|
||||
adc x6, x6, x15
|
||||
; Reduce mod 2^130 - 5
|
||||
; Get high bits
|
||||
and x14, x5, #-4
|
||||
; Get top two bits
|
||||
and x5, x5, #3
|
||||
; Add top bits * 4
|
||||
adds x11, x3, x14
|
||||
; Move down 2 bits
|
||||
extr x14, x6, x14, #2
|
||||
adcs x12, x4, x6
|
||||
lsr x6, x6, #2
|
||||
adc x13, x5, xzr
|
||||
; Add top bits.
|
||||
adds x11, x11, x14
|
||||
adcs x12, x12, x6
|
||||
adc x13, x13, xzr
|
||||
; 130-bits: Base 64 -> Base 26
|
||||
extr x7, x13, x12, #40
|
||||
ubfx x5, x11, #52, #12
|
||||
ubfx x6, x12, #14, #26
|
||||
bfi x5, x12, #12, #14
|
||||
ubfx x4, x11, #26, #26
|
||||
ubfx x3, x11, #0, #26
|
||||
stp w3, w4, [x0, #16]
|
||||
stp w5, w6, [x0, #24]
|
||||
str w7, [x0, #80]
|
||||
; h (accumulator) = 0
|
||||
stp xzr, xzr, [x0, #96]
|
||||
str wzr, [x0, #112]
|
||||
; Zero leftover
|
||||
str xzr, [x0, #136]
|
||||
; Zero finished
|
||||
strb wzr, [x0, #160]
|
||||
ldr x17, [x29, #24]
|
||||
ldp x29, x30, [sp], #32
|
||||
ret
|
||||
ENDP
|
||||
AREA |.text|, CODE, READONLY
|
||||
ALIGN 4
|
||||
EXPORT poly1305_final
|
||||
poly1305_final PROC
|
||||
ldp x8, x9, [x0, #120]
|
||||
ldp w2, w3, [x0, #96]
|
||||
ldp w4, w5, [x0, #104]
|
||||
ldr w6, [x0, #112]
|
||||
add x2, x2, x3, lsl 26
|
||||
lsr x3, x4, #12
|
||||
add x2, x2, x4, lsl 52
|
||||
add x3, x3, x5, lsl 14
|
||||
lsr x4, x6, #24
|
||||
add x3, x3, x6, lsl 40
|
||||
; Add 5 to h.
|
||||
adds x5, x2, #5
|
||||
adcs x6, x3, xzr
|
||||
adc x7, x4, xzr
|
||||
; Check if h+5 s larger than p.
|
||||
cmp x7, #3
|
||||
csel x2, x5, x2, hi
|
||||
csel x3, x6, x3, hi
|
||||
; Add padding
|
||||
adds x2, x2, x8
|
||||
adc x3, x3, x9
|
||||
; Store MAC
|
||||
stp x2, x3, [x1]
|
||||
; Zero out h.
|
||||
stp xzr, xzr, [x0, #96]
|
||||
str wzr, [x0, #112]
|
||||
; Zero out r64.
|
||||
stp xzr, xzr, [x0]
|
||||
; Zero out r.
|
||||
stp xzr, xzr, [x0, #16]
|
||||
; Zero out r_2.
|
||||
stp xzr, xzr, [x0, #48]
|
||||
str xzr, [x0, #64]
|
||||
; Zero out r_4.
|
||||
stp xzr, xzr, [x0, #16]
|
||||
str xzr, [x0, #32]
|
||||
; Zero out pad.
|
||||
stp xzr, xzr, [x0, #120]
|
||||
ret
|
||||
ENDP
|
||||
END
|
||||
1193
wolfcrypt/src/port/arm/armv8-sha256-asm.asm
Normal file
1193
wolfcrypt/src/port/arm/armv8-sha256-asm.asm
Normal file
File diff suppressed because it is too large
Load Diff
370
wolfcrypt/src/port/arm/armv8-sha3-asm.asm
Normal file
370
wolfcrypt/src/port/arm/armv8-sha3-asm.asm
Normal file
@@ -0,0 +1,370 @@
|
||||
; /* armv8-sha3-asm
|
||||
; *
|
||||
; * Copyright (C) 2006-2026 wolfSSL Inc.
|
||||
; *
|
||||
; * This file is part of wolfSSL.
|
||||
; *
|
||||
; * wolfSSL is free software; you can redistribute it and/or modify
|
||||
; * it under the terms of the GNU General Public License as published by
|
||||
; * the Free Software Foundation; either version 3 of the License, or
|
||||
; * (at your option) any later version.
|
||||
; *
|
||||
; * wolfSSL is distributed in the hope that it will be useful,
|
||||
; * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
; * GNU General Public License for more details.
|
||||
; *
|
||||
; * You should have received a copy of the GNU General Public License
|
||||
; * along with this program; if not, write to the Free Software
|
||||
; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
; */
|
||||
|
||||
|
||||
; Generated using (from wolfssl):
|
||||
; cd ../scripts
|
||||
; ruby ./sha3/sha3.rb arm64 \
|
||||
; ../wolfssl/wolfcrypt/src/port/arm/armv8-sha3-asm.asm
|
||||
IF :DEF:WOLFSSL_SHA3
|
||||
IF :DEF:WOLFSSL_ARMASM_CRYPTO_SHA3
|
||||
AREA |.rodata|, DATA, READONLY
|
||||
ALIGN 16
|
||||
L_SHA3_transform_crypto_r
|
||||
DCQ 0x0000000000000001, 0x0000000000008082
|
||||
DCQ 0x800000000000808a, 0x8000000080008000
|
||||
DCQ 0x000000000000808b, 0x0000000080000001
|
||||
DCQ 0x8000000080008081, 0x8000000000008009
|
||||
DCQ 0x000000000000008a, 0x0000000000000088
|
||||
DCQ 0x0000000080008009, 0x000000008000000a
|
||||
DCQ 0x000000008000808b, 0x800000000000008b
|
||||
DCQ 0x8000000000008089, 0x8000000000008003
|
||||
DCQ 0x8000000000008002, 0x8000000000000080
|
||||
DCQ 0x000000000000800a, 0x800000008000000a
|
||||
DCQ 0x8000000080008081, 0x8000000000008080
|
||||
DCQ 0x0000000080000001, 0x8000000080008008
|
||||
AREA |.text|, CODE, READONLY
|
||||
ALIGN 4
|
||||
EXPORT BlockSha3_crypto
|
||||
BlockSha3_crypto PROC
|
||||
stp x29, x30, [sp, #-80]!
|
||||
add x29, sp, #0
|
||||
stp d8, d9, [x29, #16]
|
||||
stp d10, d11, [x29, #32]
|
||||
stp d12, d13, [x29, #48]
|
||||
stp d14, d15, [x29, #64]
|
||||
adrp x1, L_SHA3_transform_crypto_r
|
||||
add x1, x1, L_SHA3_transform_crypto_r
|
||||
; .arch_extension sha3
|
||||
ld4 {v0.d, v1.d, v2.d, v3.d}[0], [x0], #32
|
||||
ld4 {v4.d, v5.d, v6.d, v7.d}[0], [x0], #32
|
||||
ld4 {v8.d, v9.d, v10.d, v11.d}[0], [x0], #32
|
||||
ld4 {v12.d, v13.d, v14.d, v15.d}[0], [x0], #32
|
||||
ld4 {v16.d, v17.d, v18.d, v19.d}[0], [x0], #32
|
||||
ld4 {v20.d, v21.d, v22.d, v23.d}[0], [x0], #32
|
||||
ld1 {v24.1d}, [x0]
|
||||
sub x0, x0, #0xc0
|
||||
mov x2, #24
|
||||
; Start of 24 rounds
|
||||
L_sha3_crypto_begin
|
||||
; Col Mix
|
||||
eor3 v31.16b, v0.16b, v5.16b, v10.16b
|
||||
eor3 v27.16b, v1.16b, v6.16b, v11.16b
|
||||
eor3 v28.16b, v2.16b, v7.16b, v12.16b
|
||||
eor3 v29.16b, v3.16b, v8.16b, v13.16b
|
||||
eor3 v30.16b, v4.16b, v9.16b, v14.16b
|
||||
eor3 v31.16b, v31.16b, v15.16b, v20.16b
|
||||
eor3 v27.16b, v27.16b, v16.16b, v21.16b
|
||||
eor3 v28.16b, v28.16b, v17.16b, v22.16b
|
||||
eor3 v29.16b, v29.16b, v18.16b, v23.16b
|
||||
eor3 v30.16b, v30.16b, v19.16b, v24.16b
|
||||
rax1 v25.2d, v30.2d, v27.2d
|
||||
rax1 v26.2d, v31.2d, v28.2d
|
||||
rax1 v27.2d, v27.2d, v29.2d
|
||||
rax1 v28.2d, v28.2d, v30.2d
|
||||
rax1 v29.2d, v29.2d, v31.2d
|
||||
eor v0.16b, v0.16b, v25.16b
|
||||
xar v30.2d, v1.2d, v26.2d, #63
|
||||
xar v1.2d, v6.2d, v26.2d, #20
|
||||
xar v6.2d, v9.2d, v29.2d, #44
|
||||
xar v9.2d, v22.2d, v27.2d, #3
|
||||
xar v22.2d, v14.2d, v29.2d, #25
|
||||
xar v14.2d, v20.2d, v25.2d, #46
|
||||
xar v20.2d, v2.2d, v27.2d, #2
|
||||
xar v2.2d, v12.2d, v27.2d, #21
|
||||
xar v12.2d, v13.2d, v28.2d, #39
|
||||
xar v13.2d, v19.2d, v29.2d, #56
|
||||
xar v19.2d, v23.2d, v28.2d, #8
|
||||
xar v23.2d, v15.2d, v25.2d, #23
|
||||
xar v15.2d, v4.2d, v29.2d, #37
|
||||
xar v4.2d, v24.2d, v29.2d, #50
|
||||
xar v24.2d, v21.2d, v26.2d, #62
|
||||
xar v21.2d, v8.2d, v28.2d, #9
|
||||
xar v8.2d, v16.2d, v26.2d, #19
|
||||
xar v16.2d, v5.2d, v25.2d, #28
|
||||
xar v5.2d, v3.2d, v28.2d, #36
|
||||
xar v3.2d, v18.2d, v28.2d, #43
|
||||
xar v18.2d, v17.2d, v27.2d, #49
|
||||
xar v17.2d, v11.2d, v26.2d, #54
|
||||
xar v11.2d, v7.2d, v27.2d, #58
|
||||
xar v7.2d, v10.2d, v25.2d, #61
|
||||
; Row Mix
|
||||
mov v25.16b, v0.16b
|
||||
mov v26.16b, v1.16b
|
||||
bcax v0.16b, v25.16b, v2.16b, v26.16b
|
||||
bcax v1.16b, v26.16b, v3.16b, v2.16b
|
||||
bcax v2.16b, v2.16b, v4.16b, v3.16b
|
||||
bcax v3.16b, v3.16b, v25.16b, v4.16b
|
||||
bcax v4.16b, v4.16b, v26.16b, v25.16b
|
||||
mov v25.16b, v5.16b
|
||||
mov v26.16b, v6.16b
|
||||
bcax v5.16b, v25.16b, v7.16b, v26.16b
|
||||
bcax v6.16b, v26.16b, v8.16b, v7.16b
|
||||
bcax v7.16b, v7.16b, v9.16b, v8.16b
|
||||
bcax v8.16b, v8.16b, v25.16b, v9.16b
|
||||
bcax v9.16b, v9.16b, v26.16b, v25.16b
|
||||
mov v26.16b, v11.16b
|
||||
bcax v10.16b, v30.16b, v12.16b, v26.16b
|
||||
bcax v11.16b, v26.16b, v13.16b, v12.16b
|
||||
bcax v12.16b, v12.16b, v14.16b, v13.16b
|
||||
bcax v13.16b, v13.16b, v30.16b, v14.16b
|
||||
bcax v14.16b, v14.16b, v26.16b, v30.16b
|
||||
mov v25.16b, v15.16b
|
||||
mov v26.16b, v16.16b
|
||||
bcax v15.16b, v25.16b, v17.16b, v26.16b
|
||||
bcax v16.16b, v26.16b, v18.16b, v17.16b
|
||||
bcax v17.16b, v17.16b, v19.16b, v18.16b
|
||||
bcax v18.16b, v18.16b, v25.16b, v19.16b
|
||||
bcax v19.16b, v19.16b, v26.16b, v25.16b
|
||||
mov v25.16b, v20.16b
|
||||
mov v26.16b, v21.16b
|
||||
bcax v20.16b, v25.16b, v22.16b, v26.16b
|
||||
bcax v21.16b, v26.16b, v23.16b, v22.16b
|
||||
bcax v22.16b, v22.16b, v24.16b, v23.16b
|
||||
bcax v23.16b, v23.16b, v25.16b, v24.16b
|
||||
bcax v24.16b, v24.16b, v26.16b, v25.16b
|
||||
ld1r {v30.2d}, [x1], #8
|
||||
subs x2, x2, #1
|
||||
eor v0.16b, v0.16b, v30.16b
|
||||
bne L_sha3_crypto_begin
|
||||
st4 {v0.d, v1.d, v2.d, v3.d}[0], [x0], #32
|
||||
st4 {v4.d, v5.d, v6.d, v7.d}[0], [x0], #32
|
||||
st4 {v8.d, v9.d, v10.d, v11.d}[0], [x0], #32
|
||||
st4 {v12.d, v13.d, v14.d, v15.d}[0], [x0], #32
|
||||
st4 {v16.d, v17.d, v18.d, v19.d}[0], [x0], #32
|
||||
st4 {v20.d, v21.d, v22.d, v23.d}[0], [x0], #32
|
||||
st1 {v24.1d}, [x0]
|
||||
ldp d8, d9, [x29, #16]
|
||||
ldp d10, d11, [x29, #32]
|
||||
ldp d12, d13, [x29, #48]
|
||||
ldp d14, d15, [x29, #64]
|
||||
ldp x29, x30, [sp], #0x50
|
||||
ret
|
||||
ENDP
|
||||
ENDIF
|
||||
AREA |.rodata|, DATA, READONLY
|
||||
ALIGN 16
|
||||
L_SHA3_transform_base_r
|
||||
DCQ 0x0000000000000001, 0x0000000000008082
|
||||
DCQ 0x800000000000808a, 0x8000000080008000
|
||||
DCQ 0x000000000000808b, 0x0000000080000001
|
||||
DCQ 0x8000000080008081, 0x8000000000008009
|
||||
DCQ 0x000000000000008a, 0x0000000000000088
|
||||
DCQ 0x0000000080008009, 0x000000008000000a
|
||||
DCQ 0x000000008000808b, 0x800000000000008b
|
||||
DCQ 0x8000000000008089, 0x8000000000008003
|
||||
DCQ 0x8000000000008002, 0x8000000000000080
|
||||
DCQ 0x000000000000800a, 0x800000008000000a
|
||||
DCQ 0x8000000080008081, 0x8000000000008080
|
||||
DCQ 0x0000000080000001, 0x8000000080008008
|
||||
AREA |.text|, CODE, READONLY
|
||||
ALIGN 4
|
||||
EXPORT BlockSha3_base
|
||||
BlockSha3_base PROC
|
||||
stp x29, x30, [sp, #-160]!
|
||||
add x29, sp, #0
|
||||
stp x17, x19, [x29, #72]
|
||||
stp x20, x21, [x29, #88]
|
||||
stp x22, x23, [x29, #104]
|
||||
stp x24, x25, [x29, #120]
|
||||
stp x26, x27, [x29, #136]
|
||||
str x28, [x29, #152]
|
||||
adrp x27, L_SHA3_transform_base_r
|
||||
add x27, x27, L_SHA3_transform_base_r
|
||||
ldp x1, x2, [x0]
|
||||
ldp x3, x4, [x0, #16]
|
||||
ldp x5, x6, [x0, #32]
|
||||
ldp x7, x8, [x0, #48]
|
||||
ldp x9, x10, [x0, #64]
|
||||
ldp x11, x12, [x0, #80]
|
||||
ldp x13, x14, [x0, #96]
|
||||
ldp x15, x16, [x0, #112]
|
||||
ldp x17, x19, [x0, #128]
|
||||
ldp x20, x21, [x0, #144]
|
||||
ldp x22, x23, [x0, #160]
|
||||
ldp x24, x25, [x0, #176]
|
||||
ldr x26, [x0, #192]
|
||||
str x0, [x29, #40]
|
||||
mov x28, #24
|
||||
; Start of 24 rounds
|
||||
L_SHA3_transform_base_begin
|
||||
stp x27, x28, [x29, #48]
|
||||
eor x0, x5, x10
|
||||
eor x30, x1, x6
|
||||
eor x28, x3, x8
|
||||
eor x0, x0, x15
|
||||
eor x30, x30, x11
|
||||
eor x28, x28, x13
|
||||
eor x0, x0, x21
|
||||
eor x30, x30, x16
|
||||
eor x28, x28, x19
|
||||
eor x0, x0, x26
|
||||
eor x30, x30, x22
|
||||
eor x28, x28, x24
|
||||
str x0, [x29, #32]
|
||||
str x28, [x29, #24]
|
||||
eor x27, x2, x7
|
||||
eor x28, x4, x9
|
||||
eor x27, x27, x12
|
||||
eor x28, x28, x14
|
||||
eor x27, x27, x17
|
||||
eor x28, x28, x20
|
||||
eor x27, x27, x23
|
||||
eor x28, x28, x25
|
||||
eor x0, x0, x27, ror 63
|
||||
eor x27, x27, x28, ror 63
|
||||
eor x1, x1, x0
|
||||
eor x6, x6, x0
|
||||
eor x11, x11, x0
|
||||
eor x16, x16, x0
|
||||
eor x22, x22, x0
|
||||
eor x3, x3, x27
|
||||
eor x8, x8, x27
|
||||
eor x13, x13, x27
|
||||
eor x19, x19, x27
|
||||
eor x24, x24, x27
|
||||
ldr x0, [x29, #32]
|
||||
ldr x27, [x29, #24]
|
||||
eor x28, x28, x30, ror 63
|
||||
eor x30, x30, x27, ror 63
|
||||
eor x27, x27, x0, ror 63
|
||||
eor x5, x5, x28
|
||||
eor x10, x10, x28
|
||||
eor x15, x15, x28
|
||||
eor x21, x21, x28
|
||||
eor x26, x26, x28
|
||||
eor x2, x2, x30
|
||||
eor x7, x7, x30
|
||||
eor x12, x12, x30
|
||||
eor x17, x17, x30
|
||||
eor x23, x23, x30
|
||||
eor x4, x4, x27
|
||||
eor x9, x9, x27
|
||||
eor x14, x14, x27
|
||||
eor x20, x20, x27
|
||||
eor x25, x25, x27
|
||||
; Swap Rotate
|
||||
ror x0, x2, #63
|
||||
ror x2, x7, #20
|
||||
ror x7, x10, #44
|
||||
ror x10, x24, #3
|
||||
ror x24, x15, #25
|
||||
ror x15, x22, #46
|
||||
ror x22, x3, #2
|
||||
ror x3, x13, #21
|
||||
ror x13, x14, #39
|
||||
ror x14, x21, #56
|
||||
ror x21, x25, #8
|
||||
ror x25, x16, #23
|
||||
ror x16, x5, #37
|
||||
ror x5, x26, #50
|
||||
ror x26, x23, #62
|
||||
ror x23, x9, #9
|
||||
ror x9, x17, #19
|
||||
ror x17, x6, #28
|
||||
ror x6, x4, #36
|
||||
ror x4, x20, #43
|
||||
ror x20, x19, #49
|
||||
ror x19, x12, #54
|
||||
ror x12, x8, #58
|
||||
ror x8, x11, #61
|
||||
; Row Mix
|
||||
bic x11, x3, x2
|
||||
bic x27, x4, x3
|
||||
bic x28, x1, x5
|
||||
bic x30, x2, x1
|
||||
eor x1, x1, x11
|
||||
eor x2, x2, x27
|
||||
bic x11, x5, x4
|
||||
eor x4, x4, x28
|
||||
eor x3, x3, x11
|
||||
eor x5, x5, x30
|
||||
bic x11, x8, x7
|
||||
bic x27, x9, x8
|
||||
bic x28, x6, x10
|
||||
bic x30, x7, x6
|
||||
eor x6, x6, x11
|
||||
eor x7, x7, x27
|
||||
bic x11, x10, x9
|
||||
eor x9, x9, x28
|
||||
eor x8, x8, x11
|
||||
eor x10, x10, x30
|
||||
bic x11, x13, x12
|
||||
bic x27, x14, x13
|
||||
bic x28, x0, x15
|
||||
bic x30, x12, x0
|
||||
eor x11, x0, x11
|
||||
eor x12, x12, x27
|
||||
bic x0, x15, x14
|
||||
eor x14, x14, x28
|
||||
eor x13, x13, x0
|
||||
eor x15, x15, x30
|
||||
bic x0, x19, x17
|
||||
bic x27, x20, x19
|
||||
bic x28, x16, x21
|
||||
bic x30, x17, x16
|
||||
eor x16, x16, x0
|
||||
eor x17, x17, x27
|
||||
bic x0, x21, x20
|
||||
eor x20, x20, x28
|
||||
eor x19, x19, x0
|
||||
eor x21, x21, x30
|
||||
bic x0, x24, x23
|
||||
bic x27, x25, x24
|
||||
bic x28, x22, x26
|
||||
bic x30, x23, x22
|
||||
eor x22, x22, x0
|
||||
eor x23, x23, x27
|
||||
bic x0, x26, x25
|
||||
eor x25, x25, x28
|
||||
eor x24, x24, x0
|
||||
eor x26, x26, x30
|
||||
; Done transforming
|
||||
ldp x27, x28, [x29, #48]
|
||||
ldr x0, [x27], #8
|
||||
subs x28, x28, #1
|
||||
eor x1, x1, x0
|
||||
bne L_SHA3_transform_base_begin
|
||||
ldr x0, [x29, #40]
|
||||
stp x1, x2, [x0]
|
||||
stp x3, x4, [x0, #16]
|
||||
stp x5, x6, [x0, #32]
|
||||
stp x7, x8, [x0, #48]
|
||||
stp x9, x10, [x0, #64]
|
||||
stp x11, x12, [x0, #80]
|
||||
stp x13, x14, [x0, #96]
|
||||
stp x15, x16, [x0, #112]
|
||||
stp x17, x19, [x0, #128]
|
||||
stp x20, x21, [x0, #144]
|
||||
stp x22, x23, [x0, #160]
|
||||
stp x24, x25, [x0, #176]
|
||||
str x26, [x0, #192]
|
||||
ldp x17, x19, [x29, #72]
|
||||
ldp x20, x21, [x29, #88]
|
||||
ldp x22, x23, [x29, #104]
|
||||
ldp x24, x25, [x29, #120]
|
||||
ldp x26, x27, [x29, #136]
|
||||
ldr x28, [x29, #152]
|
||||
ldp x29, x30, [sp], #0xa0
|
||||
ret
|
||||
ENDP
|
||||
ENDIF
|
||||
END
|
||||
1571
wolfcrypt/src/port/arm/armv8-sha512-asm.asm
Normal file
1571
wolfcrypt/src/port/arm/armv8-sha512-asm.asm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -64,6 +64,20 @@
|
||||
msbuild /p:WolfSSLIntelAsm=true -->
|
||||
<WolfSSLIntelAsm Condition="'$(WolfSSLIntelAsm)'==''">false</WolfSSLIntelAsm>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="WolfSSLAarch64Asm">
|
||||
<!-- Build the ARMv8 (AArch64) crypto assembly (AES / SHA-2 / SHA-3 /
|
||||
Curve25519 / Ed25519 / Poly1305 / ChaCha / ML-KEM) with armasm64 and
|
||||
enable the matching WOLFSSL_ARMASM code paths. Off by default (pure
|
||||
C). Enable on an ARM64 build with:
|
||||
msbuild /p:WolfSSLAarch64Asm=true -->
|
||||
<WolfSSLAarch64Asm Condition="'$(WolfSSLAarch64Asm)'==''">false</WolfSSLAarch64Asm>
|
||||
<!-- Feature macros the .asm files are guarded by. These must mirror the
|
||||
feature set enabled for the C compile (see IDE/WIN/user_settings.h and
|
||||
the WOLFSSL_ARMASM* defines below); a symbol that is left undefined
|
||||
here simply drops the matching assembly (safe - the C caller then uses
|
||||
a C fallback), while a symbol enabled here but not in C is dead code. -->
|
||||
<WolfSSLArmAsmDefs>--predefine "HAVE_AES_CBC SETL {TRUE}" --predefine "HAVE_AESCCM SETL {TRUE}" --predefine "HAVE_AESGCM SETL {TRUE}" --predefine "HAVE_AES_ECB SETL {TRUE}" --predefine "HAVE_AES_DECRYPT SETL {TRUE}" --predefine "WOLFSSL_AES_COUNTER SETL {TRUE}" --predefine "WOLFSSL_AES_DIRECT SETL {TRUE}" --predefine "WOLFSSL_AES_XTS SETL {TRUE}" --predefine "WOLFSSL_AESGCM_STREAM SETL {TRUE}" --predefine "WOLFSSL_SHA224 SETL {TRUE}" --predefine "WOLFSSL_SHA3 SETL {TRUE}" --predefine "WOLFSSL_ARMASM_CRYPTO_SHA3 SETL {TRUE}" --predefine "WOLFSSL_SHA384 SETL {TRUE}" --predefine "WOLFSSL_SHA512 SETL {TRUE}" --predefine "WOLFSSL_ARMASM_CRYPTO_SHA512 SETL {TRUE}" --predefine "HAVE_CHACHA SETL {TRUE}" --predefine "HAVE_CURVE25519 SETL {TRUE}" --predefine "HAVE_ED25519 SETL {TRUE}" --predefine "WOLFSSL_HAVE_MLKEM SETL {TRUE}"</WolfSSLArmAsmDefs>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
@@ -638,6 +652,54 @@
|
||||
<Command Condition="'$(WolfSSLIntelAsm)'=='true' And '$(Platform)'=='x64'">ml64.exe /c /Zi /DWOLFSSL_X86_64_BUILD /DWOLFSSL_HAVE_MLKEM /DWOLFSSL_HAVE_MLDSA /DWOLFSSL_HAVE_SLHDSA /DHAVE_ED25519 /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLIntelAsm)'=='true' And '$(Platform)'=='x64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-aes-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-chacha-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-curve25519.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-mlkem-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-poly1305-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-sha256-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-sha3-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-sha512-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="IDE\WIN\user_settings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -655,6 +717,11 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -63,6 +63,20 @@
|
||||
msbuild /p:WolfSSLIntelAsm=true -->
|
||||
<WolfSSLIntelAsm Condition="'$(WolfSSLIntelAsm)'==''">false</WolfSSLIntelAsm>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="WolfSSLAarch64Asm">
|
||||
<!-- Build the ARMv8 (AArch64) crypto assembly (AES / SHA-2 / SHA-3 /
|
||||
Curve25519 / Ed25519 / Poly1305 / ChaCha / ML-KEM) with armasm64 and
|
||||
enable the matching WOLFSSL_ARMASM code paths. Off by default (pure
|
||||
C). Enable on an ARM64 build with:
|
||||
msbuild /p:WolfSSLAarch64Asm=true -->
|
||||
<WolfSSLAarch64Asm Condition="'$(WolfSSLAarch64Asm)'==''">false</WolfSSLAarch64Asm>
|
||||
<!-- Feature macros the .asm files are guarded by. These must mirror the
|
||||
feature set enabled for the C compile (see IDE/WIN/user_settings.h and
|
||||
the WOLFSSL_ARMASM* defines below); a symbol that is left undefined
|
||||
here simply drops the matching assembly (safe - the C caller then uses
|
||||
a C fallback), while a symbol enabled here but not in C is dead code. -->
|
||||
<WolfSSLArmAsmDefs>--predefine "HAVE_AES_CBC SETL {TRUE}" --predefine "HAVE_AESCCM SETL {TRUE}" --predefine "HAVE_AESGCM SETL {TRUE}" --predefine "HAVE_AES_ECB SETL {TRUE}" --predefine "HAVE_AES_DECRYPT SETL {TRUE}" --predefine "WOLFSSL_AES_COUNTER SETL {TRUE}" --predefine "WOLFSSL_AES_DIRECT SETL {TRUE}" --predefine "WOLFSSL_AES_XTS SETL {TRUE}" --predefine "WOLFSSL_AESGCM_STREAM SETL {TRUE}" --predefine "WOLFSSL_SHA224 SETL {TRUE}" --predefine "WOLFSSL_SHA3 SETL {TRUE}" --predefine "WOLFSSL_ARMASM_CRYPTO_SHA3 SETL {TRUE}" --predefine "WOLFSSL_SHA384 SETL {TRUE}" --predefine "WOLFSSL_SHA512 SETL {TRUE}" --predefine "WOLFSSL_ARMASM_CRYPTO_SHA512 SETL {TRUE}" --predefine "HAVE_CHACHA SETL {TRUE}" --predefine "HAVE_CURVE25519 SETL {TRUE}" --predefine "HAVE_ED25519 SETL {TRUE}" --predefine "WOLFSSL_HAVE_MLKEM SETL {TRUE}"</WolfSSLArmAsmDefs>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
@@ -638,6 +652,54 @@
|
||||
<Command Condition="'$(WolfSSLIntelAsm)'=='true' And '$(Platform)'=='x64'">ml64.exe /c /Zi /DWOLFSSL_X86_64_BUILD /DWOLFSSL_HAVE_MLKEM /DWOLFSSL_HAVE_MLDSA /DWOLFSSL_HAVE_SLHDSA /DHAVE_ED25519 /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLIntelAsm)'=='true' And '$(Platform)'=='x64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-aes-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-chacha-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-curve25519.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-mlkem-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-poly1305-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-sha256-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-sha3-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="wolfcrypt\src\port\arm\armv8-sha512-asm.asm">
|
||||
<ExcludedFromBuild>true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">false</ExcludedFromBuild>
|
||||
<Command Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">armasm64.exe -o "$(IntDir)%(Filename).obj" $(WolfSSLArmAsmDefs) %(Identity)</Command>
|
||||
<Outputs Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">$(IntDir)%(Filename).obj</Outputs>
|
||||
</CustomBuild>
|
||||
<ClInclude Include="IDE\WIN\user_settings.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -655,6 +717,11 @@
|
||||
<PreprocessorDefinitions>USE_INTEL_SPEEDUP;WOLFSSL_X86_64_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(WolfSSLAarch64Asm)'=='true' And '$(Platform)'=='ARM64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WOLFSSL_ARMASM;WOLFSSL_ARMASM_CRYPTO_SHA3;WOLFSSL_ARMASM_CRYPTO_SHA512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
||||
@@ -380,6 +380,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Microsoft's ARM64 compiler defines _M_ARM64 but not __aarch64__. The wolfSSL
|
||||
* ARMv8 assembly (WOLFSSL_ARMASM) and all of its C callers are gated on
|
||||
* __aarch64__, so map _M_ARM64 across when building that assembly with MSVC and
|
||||
* armasm64. Scoped to WOLFSSL_ARMASM so a plain MSVC ARM64 (pure C) build is
|
||||
* left untouched. */
|
||||
#if defined(_M_ARM64) && defined(WOLFSSL_ARMASM) && !defined(__aarch64__)
|
||||
#define __aarch64__ 1
|
||||
#endif
|
||||
|
||||
/* Forward propagation of the legacy parent gate to the canonical name
|
||||
* (HAVE_DILITHIUM -> WOLFSSL_HAVE_MLDSA). Always active: required so that
|
||||
* a user_settings.h or build flag using only the legacy spelling still
|
||||
|
||||
Reference in New Issue
Block a user