Skip to content

Commit 12ee732

Browse files
Merge pull request #6981 from douzzer/20231102-vector-register-dynamic-fallback-aes
20231102-vector-register-dynamic-fallback-aes
2 parents 61a2d2d + efa61ad commit 12ee732

20 files changed

Lines changed: 1924 additions & 1325 deletions

File tree

configure.ac

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,6 @@ then
720720
# this set is also enabled by enable-all-crypto:
721721
test "$enable_atomicuser" = "" && enable_atomicuser=yes
722722
test "$enable_aesgcm" = "" && enable_aesgcm=yes
723-
test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
724723
test "$enable_aesccm" = "" && enable_aesccm=yes
725724
test "$enable_aesctr" = "" && enable_aesctr=yes
726725
test "$enable_aeseax" = "" && enable_aeseax=yes
@@ -741,22 +740,22 @@ then
741740
test "$enable_hkdf" = "" && enable_hkdf=yes
742741
test "$enable_curve25519" = "" && enable_curve25519=yes
743742
test "$enable_curve448" = "" && enable_curve448=yes
744-
test "$enable_fpecc" = "" && enable_fpecc=yes
745-
test "$enable_eccencrypt" = "" && enable_eccencrypt=yes
743+
test "$enable_fpecc" = "" && test "$enable_ecc" != "no" && enable_fpecc=yes
744+
test "$enable_eccencrypt" = "" && test "$enable_ecc" != "no" && enable_eccencrypt=yes
746745
test "$enable_psk" = "" && enable_psk=yes
747746
test "$enable_cmac" = "" && enable_cmac=yes
748747
test "$enable_siphash" = "" && enable_siphash=yes
749748
test "$enable_xts" = "" && enable_xts=yes
750749
test "$enable_ocsp" = "" && enable_ocsp=yes
751-
test "$enable_ocspstapling" = "" && enable_ocspstapling=yes
752-
test "$enable_ocspstapling2" = "" && enable_ocspstapling2=yes
750+
test "$enable_ocspstapling" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling=yes
751+
test "$enable_ocspstapling2" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling2=yes
753752
test "$enable_crl" = "" && enable_crl=yes
754753
test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
755754
test "$enable_tlsx" = "" && enable_tlsx=yes
756755
test "$enable_pwdbased" = "" && enable_pwdbased=yes
757756
test "$enable_aeskeywrap" = "" && enable_aeskeywrap=yes
758757
test "$enable_x963kdf" = "" && enable_x963kdf=yes
759-
test "$enable_scrypt" = "" && enable_scrypt=yes
758+
test "$enable_scrypt" = "" && test "$enable_hmac" != "no" && enable_scrypt=yes
760759
test "$enable_indef" = "" && enable_indef=yes
761760
test "$enable_enckeys" = "" && enable_enckeys=yes
762761
test "$enable_hashflags" = "" && enable_hashflags=yes
@@ -771,7 +770,7 @@ then
771770
test "$enable_md4" = "" && enable_md4=yes
772771
test "$enable_cryptocb" = "" && enable_cryptocb=yes
773772
test "$enable_anon" = "" && enable_anon=yes
774-
test "$enable_ssh" = "" && enable_ssh=yes
773+
test "$enable_ssh" = "" && test "$enable_hmac" != "no" && enable_ssh=yes
775774

776775
test "$enable_savesession" = "" && enable_savesession=yes
777776
test "$enable_savecert" = "" && enable_savecert=yes
@@ -797,6 +796,7 @@ then
797796

798797
if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
799798
then
799+
test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
800800
test "$enable_compkey" = "" && enable_compkey=yes
801801
test "$enable_quic" = "" && test "$enable_cryptonly" != "yes" && enable_quic=yes
802802
AM_CFLAGS="$AM_CFLAGS -DHAVE_CRL_IO -DHAVE_IO_TIMEOUT"
@@ -836,17 +836,17 @@ then
836836
if test "$ENABLED_FIPS" = "no"
837837
then
838838
test "$enable_pkcallbacks" = "" && enable_pkcallbacks=yes
839-
test "$enable_xchacha" = "" && enable_xchacha=yes
839+
test "$enable_xchacha" = "" && test "$enable_chacha" != "no" && enable_xchacha=yes
840840
test "$enable_scep" = "" && enable_scep=yes
841841
test "$enable_pkcs7" = "" && enable_pkcs7=yes
842842
test "$enable_nullcipher" = "" && enable_nullcipher=yes
843843
test "$enable_mcast" = "" && enable_mcast=yes
844844
if test "$ENABLED_32BIT" != "yes"
845845
then
846846
test "$enable_ed25519" = "" && enable_ed25519=yes
847-
test "$enable_ed25519_stream" = "" && enable_ed25519_stream=yes
847+
test "$enable_ed25519_stream" = "" && test "$enable_ed25519" != "no" && enable_ed25519_stream=yes
848848
test "$enable_ed448" = "" && enable_ed448=yes
849-
test "$enable_ed448_stream" = "" && enable_ed448_stream=yes
849+
test "$enable_ed448_stream" = "" && test "$enable_ed448" != "no" && enable_ed448_stream=yes
850850
fi
851851

852852
if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
@@ -856,8 +856,8 @@ then
856856
test "$enable_curl" = "" && enable_curl=yes
857857
test "$enable_tcpdump" = "" && enable_tcpdump=yes
858858

859-
test "$enable_eccsi" = "" && enable_eccsi=yes
860-
test "$enable_sakke" = "" && enable_sakke=yes
859+
test "$enable_eccsi" = "" && test "$enable_ecc" != "no" && enable_eccsi=yes
860+
test "$enable_sakke" = "" && test "$enable_ecc" != "no" && enable_sakke=yes
861861
fi
862862
fi
863863

@@ -908,7 +908,6 @@ if test "$ENABLED_ALL_CRYPT" = "yes"
908908
then
909909
test "$enable_atomicuser" = "" && enable_atomicuser=yes
910910
test "$enable_aesgcm" = "" && enable_aesgcm=yes
911-
test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
912911
test "$enable_aesccm" = "" && enable_aesccm=yes
913912
test "$enable_aesctr" = "" && enable_aesctr=yes
914913
test "$enable_aeseax" = "" && enable_aeseax=yes
@@ -929,22 +928,22 @@ then
929928
test "$enable_hkdf" = "" && enable_hkdf=yes
930929
test "$enable_curve25519" = "" && enable_curve25519=yes
931930
test "$enable_curve448" = "" && enable_curve448=yes
932-
test "$enable_fpecc" = "" && enable_fpecc=yes
933-
test "$enable_eccencrypt" = "" && enable_eccencrypt=yes
931+
test "$enable_fpecc" = "" && test "$enable_ecc" != "no" && enable_fpecc=yes
932+
test "$enable_eccencrypt" = "" && test "$enable_ecc" != "no" && enable_eccencrypt=yes
934933
test "$enable_psk" = "" && enable_psk=yes
935934
test "$enable_cmac" = "" && enable_cmac=yes
936935
test "$enable_siphash" = "" && enable_siphash=yes
937936
test "$enable_xts" = "" && enable_xts=yes
938937
test "$enable_ocsp" = "" && enable_ocsp=yes
939-
test "$enable_ocspstapling" = "" && enable_ocspstapling=yes
940-
test "$enable_ocspstapling2" = "" && enable_ocspstapling2=yes
938+
test "$enable_ocspstapling" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling=yes
939+
test "$enable_ocspstapling2" = "" && test "$enable_ocsp" != "no" && enable_ocspstapling2=yes
941940
test "$enable_crl" = "" && enable_crl=yes
942941
test "$enable_supportedcurves" = "" && enable_supportedcurves=yes
943942
test "$enable_tlsx" = "" && enable_tlsx=yes
944943
test "$enable_pwdbased" = "" && enable_pwdbased=yes
945944
test "$enable_aeskeywrap" = "" && enable_aeskeywrap=yes
946945
test "$enable_x963kdf" = "" && enable_x963kdf=yes
947-
test "$enable_scrypt" = "" && enable_scrypt=yes
946+
test "$enable_scrypt" = "" && test "$enable_hmac" != "no" && enable_scrypt=yes
948947
test "$enable_indef" = "" && enable_indef=yes
949948
test "$enable_enckeys" = "" && enable_enckeys=yes
950949
test "$enable_hashflags" = "" && enable_hashflags=yes
@@ -959,7 +958,7 @@ then
959958
test "$enable_md4" = "" && enable_md4=yes
960959
test "$enable_cryptocb" = "" && enable_cryptocb=yes
961960
test "$enable_anon" = "" && enable_anon=yes
962-
test "$enable_ssh" = "" && enable_ssh=yes
961+
test "$enable_ssh" = "" && test "$enable_hmac" != "no" && enable_ssh=yes
963962

964963
if test "$ENABLED_32BIT" != "yes"
965964
then
@@ -969,6 +968,7 @@ then
969968

970969
if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
971970
then
971+
test "$enable_aesgcm_stream" = "" && test "$enable_aesgcm" = "yes" && enable_aesgcm_stream=yes
972972
test "$enable_compkey" = "" && enable_compkey=yes
973973
fi
974974

@@ -983,21 +983,21 @@ then
983983
if test "$ENABLED_FIPS" = "no"
984984
then
985985
test "$enable_pkcallbacks" = "" && enable_pkcallbacks=yes
986-
test "$enable_xchacha" = "" && enable_xchacha=yes
986+
test "$enable_xchacha" = "" && test "$enable_chacha" != "no" && enable_xchacha=yes
987987
test "$enable_pkcs7" = "" && enable_pkcs7=yes
988988
test "$enable_nullcipher" = "" && enable_nullcipher=yes
989989
if test "$ENABLED_32BIT" != "yes"
990990
then
991991
test "$enable_ed25519" = "" && enable_ed25519=yes
992-
test "$enable_ed25519_stream" = "" && enable_ed25519_stream=yes
992+
test "$enable_ed25519_stream" = "" && test "$enable_ed25519" != "no" && enable_ed25519_stream=yes
993993
test "$enable_ed448" = "" && enable_ed448=yes
994-
test "$enable_ed448_stream" = "" && enable_ed448_stream=yes
994+
test "$enable_ed448_stream" = "" && test "$enable_ed448" != "no" && enable_ed448_stream=yes
995995
fi
996996

997997
if test "$ENABLED_LINUXKM_DEFAULTS" != "yes"
998998
then
999-
test "$enable_eccsi" = "" && enable_eccsi=yes
1000-
test "$enable_sakke" = "" && enable_sakke=yes
999+
test "$enable_eccsi" = "" && test "$enable_ecc" != "no" && enable_eccsi=yes
1000+
test "$enable_sakke" = "" && test "$enable_ecc" != "no" && enable_sakke=yes
10011001
fi
10021002
fi
10031003

@@ -2904,6 +2904,10 @@ then
29042904
if test "$ENABLED_AESNI" = "yes" || test "$ENABLED_INTELASM" = "yes"
29052905
then
29062906
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_AESNI"
2907+
if test "$ENABLED_LINUXKM_DEFAULTS" = "yes"
2908+
then
2909+
AM_CFLAGS="$AM_CFLAGS -DWC_AES_C_DYNAMIC_FALLBACK"
2910+
fi
29072911
if test "$CC" != "icc"
29082912
then
29092913
case $host_os in
@@ -3959,6 +3963,10 @@ AC_ARG_ENABLE([eccsi],
39593963

39603964
if test "x$ENABLED_ECCSI" = "xyes"
39613965
then
3966+
if test "$ENABLED_ECC" = "no"
3967+
then
3968+
AC_MSG_ERROR([ECCSI requires ECC.])
3969+
fi
39623970
AM_CFLAGS="$AM_CFLAGS -DWOLFCRYPT_HAVE_ECCSI -DWOLFSSL_PUBLIC_MP"
39633971
fi
39643972

@@ -3969,6 +3977,11 @@ AC_ARG_ENABLE([sakke],
39693977
[ ENABLED_SAKKE=no ]
39703978
)
39713979

3980+
if test "$ENABLED_SAKKE" != "no" && test "$ENABLED_ECC" = "no"
3981+
then
3982+
AC_MSG_ERROR([SAKKE requires ECC.])
3983+
fi
3984+
39723985
if test "x$ENABLED_SAKKE" = "xsmall"
39733986
then
39743987
ENABLED_SAKKE="yes"
@@ -8940,6 +8953,11 @@ if test "x$ENABLED_OPENSSLCOEXIST" = "xyes"; then
89408953
fi
89418954
fi
89428955

8956+
if test "$ENABLED_WOLFSSH" = "yes" && test "$ENABLED_HMAC" = "no"
8957+
then
8958+
AC_MSG_ERROR([WOLFSSH requires HMAC.])
8959+
fi
8960+
89438961
AS_IF([test "x$ENABLED_WOLFSSH" = "xyes"],[AM_CPPFLAGS="$AM_CPPFLAGS -DWOLFSSL_WOLFSSH"])
89448962

89458963
# only allow secure renegotiation info with TLSV12 and ASN

linuxkm/linuxkm_wc_port.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
#endif
186186
#ifndef SAVE_VECTOR_REGISTERS
187187
#define SAVE_VECTOR_REGISTERS(fail_clause) { int _svr_ret = save_vector_registers_x86(); if (_svr_ret != 0) { fail_clause } }
188+
#define SAVE_VECTOR_REGISTERS2() save_vector_registers_x86()
188189
#endif
189190
#ifndef RESTORE_VECTOR_REGISTERS
190191
#define RESTORE_VECTOR_REGISTERS() restore_vector_registers_x86()
@@ -193,6 +194,7 @@
193194
#include <asm/fpsimd.h>
194195
#ifndef SAVE_VECTOR_REGISTERS
195196
#define SAVE_VECTOR_REGISTERS(fail_clause) { int _svr_ret = save_vector_registers_arm(); if (_svr_ret != 0) { fail_clause } }
197+
#define SAVE_VECTOR_REGISTERS2() save_vector_registers_arm()
196198
#endif
197199
#ifndef RESTORE_VECTOR_REGISTERS
198200
#define RESTORE_VECTOR_REGISTERS() restore_vector_registers_arm()

wolfcrypt/benchmark/benchmark.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,9 @@ static void bench_stats_sym_finish(const char* desc, int useDeviceID,
22962296
(void)useDeviceID;
22972297
(void)ret;
22982298

2299+
#ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
22992300
RESTORE_VECTOR_REGISTERS();
2301+
#endif
23002302

23012303
TEST_SLEEP();
23022304
} /* bench_stats_sym_finish */
@@ -2554,7 +2556,9 @@ static void bench_stats_asym_finish_ex(const char* algo, int strength,
25542556
(void)useDeviceID;
25552557
(void)ret;
25562558

2559+
#ifdef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS
25572560
RESTORE_VECTOR_REGISTERS();
2561+
#endif
25582562

25592563
TEST_SLEEP();
25602564
} /* bench_stats_asym_finish_ex */

0 commit comments

Comments
 (0)