Merge pull request #11254 from embhorn/zd22371

MSVC: pass SP feature defines to ml64 for sp_x86_64_asm.asm
pull/11289/merge
JacobBarthelmeh 2026-09-17 09:48:47 -06:00 committed by GitHub
commit 3babd3763d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 64 additions and 14 deletions

View File

@ -84,13 +84,27 @@
#define USE_INTEL_POLY1305_SPEEDUP
#endif
/* Single Precision Support for RSA/DH 1024/2048/3072 and
* ECC P-256/P-384 */
/* Single Precision Support. Sizes always assembled are
* RSA/DH 2048 and 3072 and ECC P-256. */
#define WOLFSSL_SP
#define WOLFSSL_HAVE_SP_ECC
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_RSA
/* Opt in Single Precision sizes. ml64.exe cannot read this
* header, so each size must also be assembled. The project files
* assemble 384 and 4096; 521 and 1024 need /p:WolfSSLSpAsmDefs.
* 4096 is in that default because HAVE_FFDHE_4096 above makes
* settings.h define WOLFSSL_SP_4096 whenever SP DH is on. */
#if 0
#define WOLFSSL_SP_384
#define WOLFSSL_SP_4096
#if 0
#define WOLFSSL_SP_521
#define WOLFSSL_SP_1024
#endif
#endif
#ifdef _WIN64
/* Old versions of MASM compiler do not recognize newer
* instructions. */

View File

@ -57,6 +57,18 @@
<ProjectName>wolfssl</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="WolfSSLSpAsm">
<!-- Single precision sizes assembled into sp_x86_64_asm.asm. ml64.exe
cannot read user_settings.h, so a size enabled there must be listed
here too or the link fails with LNK2001 on sp_384_*, sp_521_*,
sp_4096_* or sp_1024_*. ECC P-256 and RSA/DH 2048 and 3072 always
assemble. 4096 stays in the default because IDE/WIN/user_settings.h
turns on HAVE_FFDHE_4096, which makes settings.h define
WOLFSSL_SP_4096. ECC P-521 and SAKKE 1024 are another 16k lines of
rarely used assembly, so add them only when user_settings.h asks:
msbuild /p:WolfSSLSpAsmDefs="/DWOLFSSL_SP_384 /DWOLFSSL_SP_4096 /DWOLFSSL_SP_521" -->
<WolfSSLSpAsmDefs Condition="'$(WolfSSLSpAsmDefs)'==''">/DWOLFSSL_SP_384 /DWOLFSSL_SP_4096</WolfSSLSpAsmDefs>
</PropertyGroup>
<PropertyGroup Label="WolfSSLIntelAsm">
<!-- Build the x86_64 crypto assembly (curve25519 / SHA-2 / SHA-3 / ML-KEM /
ML-DSA) and enable the matching USE_INTEL_SPEEDUP code paths. Off by
@ -629,14 +641,14 @@
<CustomBuild Include="wolfcrypt\src\sp_x86_64_asm.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">$(IntDir)%(Filename).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)%(Filename).obj</Outputs>
</CustomBuild>

View File

@ -56,6 +56,18 @@
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="WolfSSLSpAsm">
<!-- Single precision sizes assembled into sp_x86_64_asm.asm. ml64.exe
cannot read user_settings.h, so a size enabled there must be listed
here too or the link fails with LNK2001 on sp_384_*, sp_521_*,
sp_4096_* or sp_1024_*. ECC P-256 and RSA/DH 2048 and 3072 always
assemble. 4096 stays in the default because IDE/WIN/user_settings.h
turns on HAVE_FFDHE_4096, which makes settings.h define
WOLFSSL_SP_4096. ECC P-521 and SAKKE 1024 are another 16k lines of
rarely used assembly, so add them only when user_settings.h asks:
msbuild /p:WolfSSLSpAsmDefs="/DWOLFSSL_SP_384 /DWOLFSSL_SP_4096 /DWOLFSSL_SP_521" -->
<WolfSSLSpAsmDefs Condition="'$(WolfSSLSpAsmDefs)'==''">/DWOLFSSL_SP_384 /DWOLFSSL_SP_4096</WolfSSLSpAsmDefs>
</PropertyGroup>
<PropertyGroup Label="WolfSSLIntelAsm">
<!-- Build the x86_64 crypto assembly (curve25519 / SHA-2 / SHA-3 / ML-KEM /
ML-DSA) and enable the matching USE_INTEL_SPEEDUP code paths. Off by
@ -629,14 +641,14 @@
<CustomBuild Include="wolfcrypt\src\sp_x86_64_asm.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">$(IntDir)%(Filename).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)%(Filename).obj</Outputs>
</CustomBuild>

View File

@ -40,6 +40,18 @@
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="WolfSSLSpAsm">
<!-- Single precision sizes assembled into sp_x86_64_asm.asm. ml64.exe
cannot read user_settings.h, so a size enabled there must be listed
here too or the link fails with LNK2001 on sp_384_*, sp_521_*,
sp_4096_* or sp_1024_*. ECC P-256 and RSA/DH 2048 and 3072 always
assemble. 4096 stays in the default because IDE/WIN/user_settings.h
turns on HAVE_FFDHE_4096, which makes settings.h define
WOLFSSL_SP_4096. ECC P-521 and SAKKE 1024 are another 16k lines of
rarely used assembly, so add them only when user_settings.h asks:
msbuild /p:WolfSSLSpAsmDefs="/DWOLFSSL_SP_384 /DWOLFSSL_SP_4096 /DWOLFSSL_SP_521" -->
<WolfSSLSpAsmDefs Condition="'$(WolfSSLSpAsmDefs)'==''">/DWOLFSSL_SP_384 /DWOLFSSL_SP_4096</WolfSSLSpAsmDefs>
</PropertyGroup>
<PropertyGroup Label="WolfSSLIntelAsm">
<!-- Build the x86_64 crypto assembly (curve25519 / SHA-2 / SHA-3 / ML-KEM /
ML-DSA) and enable the matching USE_INTEL_SPEEDUP code paths. Off by
@ -469,14 +481,14 @@
<CustomBuild Include="..\..\wolfcrypt\src\sp_x86_64_asm.asm">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'">$(IntDir)%(Filename).obj</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(OutDir)%(Filename).obj" %(Identity)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">ml64.exe $(WolfSSLSpAsmDefs) /c /Zi /Fo"$(IntDir)%(Filename).obj" %(Identity)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).obj</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(IntDir)%(Filename).obj</Outputs>
</CustomBuild>