1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows/Linux/macOS: implement AES hardware support on ARM64 (ARMv8)

This commit is contained in:
Mounir IDRASSI
2025-01-17 00:58:54 +01:00
parent c79f8102e0
commit 54bd819990
22 changed files with 492 additions and 49 deletions

View File

@@ -228,6 +228,10 @@ copy $(OutDir)veracrypt.inf "$(SolutionDir)Debug\Setup Files\veracrypt.inf"</Com
</ClCompile>
<ClCompile Include="..\Crypto\Aeskey.c" />
<ClCompile Include="..\Crypto\Aestab.c" />
<ClCompile Include="..\Crypto\Aes_hw_armv8.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Crypto\blake2s.c" />
<ClCompile Include="..\Crypto\blake2s_SSE2.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>

View File

@@ -165,6 +165,9 @@
<ClCompile Include="..\Driver\VolumeFilter.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Crypto\Aes_hw_armv8.c">
<Filter>Crypto\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\Common\Tcdefs.h">

View File

@@ -232,7 +232,7 @@ void GetDriverRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
jent_entropy_collector_free (ec);
}
}
#ifndef _M_ARM64
// use RDSEED or RDRAND from CPU as source of entropy if enabled
if ( IsCpuRngEnabled() &&
( (HasRDSEED() && RDSEED_getBytes (digest, sizeof (digest)))
@@ -241,6 +241,7 @@ void GetDriverRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
{
WHIRLPOOL_add (digest, sizeof(digest), &tctx);
}
#endif
WHIRLPOOL_finalize (&tctx, digest);
count = VC_MIN (cbRandSeed, sizeof (digest));
@@ -266,7 +267,11 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
Dump("DriverEntry " TC_APP_NAME " " VERSION_STRING VERSION_STRING_SUFFIX "\n");
#ifndef _M_ARM64
DetectX86Features();
#else
DetectArmFeatures();
#endif
PsGetVersion(&OsMajorVersion, &OsMinorVersion, NULL, NULL);
@@ -293,7 +298,11 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
// in case of system encryption, if self-tests fail, disable all extended CPU
// features and try again in order to workaround faulty configurations
#ifndef _M_ARM64
DisableCPUExtendedFeatures();
#else
EnableHwEncryption(FALSE);
#endif
SelfTestsPassed = AutoTestAlgorithms();
// BUG CHECK if the self-tests still fail