Add NEON optimizations for Argon2

This commit is contained in:
Frank Denis
2026-01-22 12:00:49 +01:00
parent b36e407fe5
commit 9561aea8e5
23 changed files with 464 additions and 1 deletions
@@ -94,6 +94,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -306,6 +307,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -94,6 +94,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -306,6 +307,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -94,6 +94,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -306,6 +307,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -94,6 +94,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -306,6 +307,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -94,6 +94,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -306,6 +307,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -118,6 +118,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -330,6 +331,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -118,6 +118,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -330,6 +331,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
@@ -118,6 +118,7 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -330,6 +331,7 @@
<ClInclude Include="..\..\..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
@@ -102,6 +102,9 @@
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>crypto_pwhash\argon2</Filter>
</ClCompile>
@@ -734,6 +737,9 @@
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>crypto_pwhash\argon2</Filter>
</ClInclude>
+2
View File
@@ -342,6 +342,7 @@
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ref.c" />
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-ssse3.c" />
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c" />
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c" />
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c" />
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2.c" />
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-avx2.c" />
@@ -554,6 +555,7 @@
<ClInclude Include="..\..\src\libsodium\include\sodium\private\implementations.h" />
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ref.h" />
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h" />
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h" />
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h" />
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2.h" />
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-ssse3.h" />
+6
View File
@@ -93,6 +93,9 @@
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2i.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\argon2-fill-block-neon.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\libsodium\crypto_pwhash\argon2\pwhash_argon2id.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -725,6 +728,9 @@
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-avx2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-neon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\src\libsodium\crypto_pwhash\argon2\blamka-round-wasm32.h">
<Filter>Header Files</Filter>
</ClInclude>
+3 -1
View File
@@ -267,7 +267,9 @@ libarmcrypto_la_SOURCES = \
crypto_aead/aegis256/aegis256_armcrypto.h \
crypto_aead/aes256gcm/armcrypto/aead_aes256gcm_armcrypto.c \
crypto_ipcrypt/ipcrypt_armcrypto.c \
crypto_ipcrypt/ipcrypt_armcrypto.h
crypto_ipcrypt/ipcrypt_armcrypto.h \
crypto_pwhash/argon2/argon2-fill-block-neon.c \
crypto_pwhash/argon2/blamka-round-neon.h
libaesni_la_LDFLAGS = $(libsodium_la_LDFLAGS)
libaesni_la_CPPFLAGS = $(libsodium_la_CPPFLAGS) \
@@ -45,7 +45,12 @@
# define MAP_POPULATE 0
#endif
#if (defined(__aarch64__) || defined(_M_ARM64)) && \
(defined(__ARM_NEON) || defined(__ARM_NEON__))
static fill_segment_fn fill_segment = argon2_fill_segment_neon;
#else
static fill_segment_fn fill_segment = argon2_fill_segment_ref;
#endif
static void
load_block(block *dst, const void *input)
@@ -520,7 +525,12 @@ argon2_pick_best_implementation(void)
return 0;
}
#endif
#if (defined(__aarch64__) || defined(_M_ARM64)) && \
(defined(__ARM_NEON) || defined(__ARM_NEON__))
fill_segment = argon2_fill_segment_neon;
#else
fill_segment = argon2_fill_segment_ref;
#endif
return 0;
/* LCOV_EXCL_STOP */
@@ -260,6 +260,8 @@ void argon2_fill_segment_ssse3(const argon2_instance_t *instance,
argon2_position_t position);
void argon2_fill_segment_wasm32(const argon2_instance_t *instance,
argon2_position_t position);
void argon2_fill_segment_neon(const argon2_instance_t *instance,
argon2_position_t position);
void argon2_fill_segment_ref(const argon2_instance_t *instance,
argon2_position_t position);
@@ -0,0 +1,216 @@
/*
* Argon2 source code package
*
* Written by Daniel Dinu and Dmitry Khovratovich, 2015
*
* This work is licensed under a Creative Commons CC0 1.0 License/Waiver.
*
* You should have received a copy of the CC0 Public Domain Dedication along
* with
* this software. If not, see
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*
* AARCH64 NEON implementation ported from SSSE3 version.
*/
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "argon2-core.h"
#include "argon2.h"
#include "private/common.h"
#if (defined(__aarch64__) || defined(_M_ARM64)) && \
(defined(__ARM_NEON) || defined(__ARM_NEON__))
# include <arm_neon.h>
# include "blamka-round-neon.h"
static void
fill_block(uint64x2_t *state, const uint8_t *ref_block, uint8_t *next_block)
{
uint64x2_t block_XY[ARGON2_OWORDS_IN_BLOCK];
uint32_t i;
for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
block_XY[i] = state[i] = veorq_u64(
state[i], vld1q_u64((const uint64_t *) (&ref_block[16 * i])));
}
for (i = 0; i < 8; ++i) {
BLAKE2_ROUND_NEON(state[8 * i + 0], state[8 * i + 1], state[8 * i + 2],
state[8 * i + 3], state[8 * i + 4], state[8 * i + 5],
state[8 * i + 6], state[8 * i + 7]);
}
for (i = 0; i < 8; ++i) {
BLAKE2_ROUND_NEON(state[8 * 0 + i], state[8 * 1 + i], state[8 * 2 + i],
state[8 * 3 + i], state[8 * 4 + i], state[8 * 5 + i],
state[8 * 6 + i], state[8 * 7 + i]);
}
for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
state[i] = veorq_u64(state[i], block_XY[i]);
vst1q_u64((uint64_t *) (&next_block[16 * i]), state[i]);
}
}
static void
fill_block_with_xor(uint64x2_t *state, const uint8_t *ref_block,
uint8_t *next_block)
{
uint64x2_t block_XY[ARGON2_OWORDS_IN_BLOCK];
uint32_t i;
for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
state[i] = veorq_u64(
state[i], vld1q_u64((const uint64_t *) (&ref_block[16 * i])));
block_XY[i] = veorq_u64(
state[i], vld1q_u64((const uint64_t *) (&next_block[16 * i])));
}
for (i = 0; i < 8; ++i) {
BLAKE2_ROUND_NEON(state[8 * i + 0], state[8 * i + 1], state[8 * i + 2],
state[8 * i + 3], state[8 * i + 4], state[8 * i + 5],
state[8 * i + 6], state[8 * i + 7]);
}
for (i = 0; i < 8; ++i) {
BLAKE2_ROUND_NEON(state[8 * 0 + i], state[8 * 1 + i], state[8 * 2 + i],
state[8 * 3 + i], state[8 * 4 + i], state[8 * 5 + i],
state[8 * 6 + i], state[8 * 7 + i]);
}
for (i = 0; i < ARGON2_OWORDS_IN_BLOCK; i++) {
state[i] = veorq_u64(state[i], block_XY[i]);
vst1q_u64((uint64_t *) (&next_block[16 * i]), state[i]);
}
}
static void
generate_addresses(const argon2_instance_t *instance,
const argon2_position_t *position, uint64_t *pseudo_rands)
{
block address_block, input_block, tmp_block;
uint32_t i;
init_block_value(&address_block, 0);
init_block_value(&input_block, 0);
if (instance != NULL && position != NULL) {
input_block.v[0] = position->pass;
input_block.v[1] = position->lane;
input_block.v[2] = position->slice;
input_block.v[3] = instance->memory_blocks;
input_block.v[4] = instance->passes;
input_block.v[5] = instance->type;
for (i = 0; i < instance->segment_length; ++i) {
if (i % ARGON2_ADDRESSES_IN_BLOCK == 0) {
uint64x2_t zero_block[ARGON2_OWORDS_IN_BLOCK];
uint64x2_t zero2_block[ARGON2_OWORDS_IN_BLOCK];
memset(zero_block, 0, sizeof(zero_block));
memset(zero2_block, 0, sizeof(zero2_block));
init_block_value(&address_block, 0);
init_block_value(&tmp_block, 0);
input_block.v[6]++;
fill_block_with_xor(zero_block, (uint8_t *) &input_block.v,
(uint8_t *) &tmp_block.v);
fill_block_with_xor(zero2_block, (uint8_t *) &tmp_block.v,
(uint8_t *) &address_block.v);
}
pseudo_rands[i] = address_block.v[i % ARGON2_ADDRESSES_IN_BLOCK];
}
}
}
void
argon2_fill_segment_neon(const argon2_instance_t *instance,
argon2_position_t position)
{
block *ref_block = NULL, *curr_block = NULL;
uint64_t pseudo_rand, ref_index, ref_lane;
uint32_t prev_offset, curr_offset;
uint32_t starting_index, i;
uint64x2_t state[ARGON2_OWORDS_IN_BLOCK];
int data_independent_addressing = 1;
uint64_t *pseudo_rands = NULL;
if (instance == NULL) {
return;
}
if (instance->type == Argon2_id &&
(position.pass != 0 || position.slice >= ARGON2_SYNC_POINTS / 2)) {
data_independent_addressing = 0;
}
pseudo_rands = instance->pseudo_rands;
if (data_independent_addressing) {
generate_addresses(instance, &position, pseudo_rands);
}
starting_index = 0;
if ((0 == position.pass) && (0 == position.slice)) {
starting_index = 2;
}
curr_offset = position.lane * instance->lane_length +
position.slice * instance->segment_length + starting_index;
if (0 == curr_offset % instance->lane_length) {
prev_offset = curr_offset + instance->lane_length - 1;
} else {
prev_offset = curr_offset - 1;
}
memcpy(state, ((instance->region->memory + prev_offset)->v),
ARGON2_BLOCK_SIZE);
for (i = starting_index; i < instance->segment_length;
++i, ++curr_offset, ++prev_offset) {
if (curr_offset % instance->lane_length == 1) {
prev_offset = curr_offset - 1;
}
if (data_independent_addressing) {
#pragma warning(push)
#pragma warning(disable : 6385)
pseudo_rand = pseudo_rands[i];
#pragma warning(pop)
} else {
pseudo_rand = instance->region->memory[prev_offset].v[0];
}
ref_lane = ((pseudo_rand >> 32)) % instance->lanes;
if ((position.pass == 0) && (position.slice == 0)) {
ref_lane = position.lane;
}
position.index = i;
ref_index = index_alpha(instance, &position, pseudo_rand & 0xFFFFFFFF,
ref_lane == position.lane);
ref_block = instance->region->memory +
instance->lane_length * ref_lane + ref_index;
curr_block = instance->region->memory + curr_offset;
if (position.pass != 0) {
fill_block_with_xor(state, (uint8_t *) ref_block->v,
(uint8_t *) curr_block->v);
} else {
fill_block(state, (uint8_t *) ref_block->v,
(uint8_t *) curr_block->v);
}
}
}
#endif
@@ -0,0 +1,161 @@
#ifndef blamka_round_neon_H
#define blamka_round_neon_H
#include <arm_neon.h>
#include "private/common.h"
static inline uint64x2_t
fBlaMka_neon(uint64x2_t x, uint64x2_t y)
{
const uint32x2_t x_lo = vmovn_u64(x);
const uint32x2_t y_lo = vmovn_u64(y);
const uint64x2_t z = vmull_u32(x_lo, y_lo);
return vaddq_u64(vaddq_u64(x, y), vaddq_u64(z, z));
}
static inline uint64x2_t
rotr64_32_neon(uint64x2_t x)
{
return vreinterpretq_u64_u32(vrev64q_u32(vreinterpretq_u32_u64(x)));
}
static inline uint64x2_t
rotr64_24_neon(uint64x2_t x)
{
static const uint8_t rot24_tbl[16] = {
3, 4, 5, 6, 7, 0, 1, 2,
11, 12, 13, 14, 15, 8, 9, 10
};
const uint8x16_t tbl = vld1q_u8(rot24_tbl);
return vreinterpretq_u64_u8(vqtbl1q_u8(vreinterpretq_u8_u64(x), tbl));
}
static inline uint64x2_t
rotr64_16_neon(uint64x2_t x)
{
static const uint8_t rot16_tbl[16] = {
2, 3, 4, 5, 6, 7, 0, 1,
10, 11, 12, 13, 14, 15, 8, 9
};
const uint8x16_t tbl = vld1q_u8(rot16_tbl);
return vreinterpretq_u64_u8(vqtbl1q_u8(vreinterpretq_u8_u64(x), tbl));
}
static inline uint64x2_t
rotr64_63_neon(uint64x2_t x)
{
return veorq_u64(vshrq_n_u64(x, 63), vaddq_u64(x, x));
}
#define G1_NEON(A0, B0, C0, D0, A1, B1, C1, D1) \
do { \
A0 = fBlaMka_neon(A0, B0); \
A1 = fBlaMka_neon(A1, B1); \
\
D0 = veorq_u64(D0, A0); \
D1 = veorq_u64(D1, A1); \
\
D0 = rotr64_32_neon(D0); \
D1 = rotr64_32_neon(D1); \
\
C0 = fBlaMka_neon(C0, D0); \
C1 = fBlaMka_neon(C1, D1); \
\
B0 = veorq_u64(B0, C0); \
B1 = veorq_u64(B1, C1); \
\
B0 = rotr64_24_neon(B0); \
B1 = rotr64_24_neon(B1); \
} while ((void) 0, 0)
#define G2_NEON(A0, B0, C0, D0, A1, B1, C1, D1) \
do { \
A0 = fBlaMka_neon(A0, B0); \
A1 = fBlaMka_neon(A1, B1); \
\
D0 = veorq_u64(D0, A0); \
D1 = veorq_u64(D1, A1); \
\
D0 = rotr64_16_neon(D0); \
D1 = rotr64_16_neon(D1); \
\
C0 = fBlaMka_neon(C0, D0); \
C1 = fBlaMka_neon(C1, D1); \
\
B0 = veorq_u64(B0, C0); \
B1 = veorq_u64(B1, C1); \
\
B0 = rotr64_63_neon(B0); \
B1 = rotr64_63_neon(B1); \
} while ((void) 0, 0)
#define DIAGONALIZE_NEON(A0, B0, C0, D0, A1, B1, C1, D1) \
do { \
uint64x2_t t0, t1; \
\
t0 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(B0), \
vreinterpretq_u8_u64(B1), 8)); \
t1 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(B1), \
vreinterpretq_u8_u64(B0), 8)); \
B0 = t0; \
B1 = t1; \
\
t0 = C0; \
C0 = C1; \
C1 = t0; \
\
t0 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(D0), \
vreinterpretq_u8_u64(D1), 8)); \
t1 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(D1), \
vreinterpretq_u8_u64(D0), 8)); \
D0 = t1; \
D1 = t0; \
} while ((void) 0, 0)
#define UNDIAGONALIZE_NEON(A0, B0, C0, D0, A1, B1, C1, D1) \
do { \
uint64x2_t t0, t1; \
\
t0 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(B1), \
vreinterpretq_u8_u64(B0), 8)); \
t1 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(B0), \
vreinterpretq_u8_u64(B1), 8)); \
B0 = t0; \
B1 = t1; \
\
t0 = C0; \
C0 = C1; \
C1 = t0; \
\
t0 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(D1), \
vreinterpretq_u8_u64(D0), 8)); \
t1 = vreinterpretq_u64_u8( \
vextq_u8(vreinterpretq_u8_u64(D0), \
vreinterpretq_u8_u64(D1), 8)); \
D0 = t1; \
D1 = t0; \
} while ((void) 0, 0)
#define BLAKE2_ROUND_NEON(A0, A1, B0, B1, C0, C1, D0, D1) \
do { \
G1_NEON(A0, B0, C0, D0, A1, B1, C1, D1); \
G2_NEON(A0, B0, C0, D0, A1, B1, C1, D1); \
\
DIAGONALIZE_NEON(A0, B0, C0, D0, A1, B1, C1, D1); \
\
G1_NEON(A0, B0, C0, D0, A1, B1, C1, D1); \
G2_NEON(A0, B0, C0, D0, A1, B1, C1, D1); \
\
UNDIAGONALIZE_NEON(A0, B0, C0, D0, A1, B1, C1, D1); \
} while ((void) 0, 0)
#endif