Daniel Pouzzner
360c749703
add {SAVE,RESTORE}_VECTOR_REGISTERS() macros for kernel_fpu_{begin,end} when WOLFSSL_LINUXKM, to allow safe use of AESNI and SIMD instructions in the kernel.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
e8b69f8a6a
dh_test(): fix missing casts for XMALLOC().
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
f440089e92
dh_test(): fix typo (undersized dynamic buffers).
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
8b19a9b58c
benchmark.c: fix always-true tests for DECLARE_VAR_IS_HEAP_ALLOC.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
f106fea0d8
rsa_no_pad_test(): fix uninited pointer.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
4ea8b46177
dh_test(): refactor remaining bare returns to ERROR_OUT().
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
2ee218761e
dh_test(): missed a spot in last commit.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
ca1a991de5
wolfcrypt/test/test.c: fix an error-path leak in dh_test(), and deal with possible -Wdeclaration-after-statement for XFILE file.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
a7381f8a48
test.c:rsa_test(): fix uninited pointer
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
6c32a730c2
more work on DECLARE_VAR -- fix allocation failure handling in bench_rsa_helper() to avoid uninitialized variables.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
426de2101a
more work on DECLARE_VAR -- proper handling of failed allocations. WIP.
2020-09-23 18:32:16 -05:00
Daniel Pouzzner
3c91ce9342
wolfcrypt/src/sp_int.c: undo 8efb1142f1f2744ff128033df8a3a2d43e42fd93 to take dgarske's better wc_bigint_init()-based take on it (aa870861921a317cca9a978a75a7de127809e100).
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
c5d28c16b5
wolfcrypt/src/sp_int.c: clear whole struct in sp_init() and sp_init_multi(), to fix uninited pointer free()s in sp_free() when --enable-sp-math -DHAVE_WOLF_BIGINT.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
9b7c753165
wolfssl/wolfcrypt/types.h: make DECLARE_VAR() et al use heap allocation not only when WOLFSSL_ASYNC_CRYPT but also when WOLFSSL_SMALL_STACK.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
ce8f2e65de
wolfcrypt/src/sha256.c: undo c801de9d23c2f3348b84fdb8d893f81e6c3c2849 (dgarske has better&correct fix in 76e1760f915934bdc4911f3ae41abe6803ae094a).
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
571bf897c4
wolfcrypt/test/test.c: stack->heap refactor for dh_test().
2020-09-23 18:32:15 -05:00
David Garske
66b59bda9b
Fix for expected fail test in openssl_test for partial block. Fix for mp_test with ECC disabled, which uses mp_init_copy.
2020-09-23 18:32:15 -05:00
David Garske
0f8cf32122
Fix for possible leak in openssl_test because EVP free not called with WOLFSSL_SMALL_STACK_CACHE (SHA256/SHA512). Added return code checking to the openssl_test in wolfCrypt test.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
32e30d23c6
wolfcrypt/test/test.c: fix uninitialized values in aesofb_test().
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
e09487de1f
sha256.c: add missing _SMALL_STACK_CACHE initialization in InitSha256().
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
922b023aea
wolfcrypt/src/random.c: rename the DRBG internal type __DRBG, because some customer is compiling libwolfssl with a "g++" override, which precludes typedefs and structs with different types but equal labels.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
f56c6d1d8f
wolfcrypt/test/test.c and wolfssl/test.h: implement DEBUG_STACK_SIZE_VERBOSE, measuring and reporting stack usage separately for each test. to use, ./configure --enable-stacksize && make CFLAGS+=-DDEBUG_STACK_SIZE_VERBOSE; also, remove a throwaway dev pragma that snuck into an earlier commit.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
925afe3b74
cast XMALLOC() return values assiduously, for Visual Studio compatibility.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
535822f4df
wolfcrypt/test/test.c: refactor for stack size and namespace control, allowing embedding of wolfcrypt_test() in kernel module.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
9ca94d6ca7
wolfcrypt/src/ge_448.c: refactor ge448_double_scalarmult_vartime() to use heap for workspace unless WOLFSSL_NO_MALLOC.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
92df5692b1
wolfcrypt/src/ecc.c: revert to commit g0fa5af9, which has all the necessary fixes.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
add78dfba9
wolfcrypt/src/sp_int.c: add _LINUXKM do_div codepaths for a couple more 64 bit divisions, in sp_div_word() and sp_mod_d().
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
9ab1df690a
wolfcrypt/src/ecc.c: fix uncompilable !WOLFSSL_SP_MATH && WOLFSSL_SMALL_STACK_CACHE implementations of ecc_key_tmp_init() and ecc_key_tmp_free() (the latter misnamed ecc_key_tmp_final()).
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
03d5a4eadd
wolfcrypt/src/integer.c: mp_div_d(): refactor another 64 bit division to use do_div() when WOLFSSL_LINUXKM.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
2591479866
linuxkm: add macros mapping malloc(), free(), and realloc() to the kernel equivalents, don't set WOLFSSL_NO_MALLOC, and reduce -Wframe-larger-than= from 256k to 64k; tweak fix for HAVE_INTEL_RDSEED conflict with WOLFSSL_LINUXKM; add clean rule to linuxkm/Makefile.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
2bcdfce6df
wolfcrypt/src/evp.c: tweak to silence gcc -Wmaybe-uninitialized.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
0e480d1a14
Linux KM compilability cont'd: conform to C89isms (declarations before statements); iffdef WOLFSSL_LINUXKM use do_div() for long long division rather than C operator (avoids unresolvable compile-time callouts to libgcc function); misc gating and relocations for includes.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
0f783077f8
fix stray whitespace
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
dd825d90c4
more LKM WIP: polish up the struct DRBG refactor ("struct DRBG_internal"), tweaks for buildability on 3.x kernels (now builds on 3.x, 4.x, and 5.x up to 5.8.1), move a slew of #[un]def[ines] from wc_port.h to settings.h where they belong, misc cleanup.
2020-09-23 18:32:15 -05:00
Daniel Pouzzner
3c2155f4a9
linuxkm WIP -- update for kernels 4.9.x (LTS representative) and 5.8.x (latest).
2020-09-23 18:32:15 -05:00
David Garske
6425ebb60e
Linux Kernel Module support using "--enable-linuxkm".
2020-09-23 18:32:15 -05:00
toddouska
2bb8427ab2
Merge pull request #3320 from dgarske/stmcube
...
STM32 Cube Pack and AES GCM improvements
2020-09-23 14:39:53 -07:00
David Garske
c46301f111
Merge pull request #3328 from ejohnstown/fips-ready-fix
...
FIPS Ready Windows Fix
2020-09-23 12:18:23 -07:00
David Garske
ecd5a015eb
Merge pull request #3317 from ejohnstown/evp-fix
...
EVP Fix
2020-09-23 11:10:07 -07:00
toddouska
b0998fb030
Merge pull request #3327 from SparkiDev/pkcs11_ecc
...
PKCS#11 fix: Generate ECC key for decrypt/sign or derive
2020-09-23 09:28:53 -07:00
toddouska
ad00cf0fc8
Merge pull request #3268 from dr-m/intel-intrinsics
...
Use Intel intrinsic functions for RDSEED and RDRAND
2020-09-23 09:24:47 -07:00
toddouska
2f74817e32
Merge pull request #3288 from embhorn/zd10901
...
Fix mp_radix_size off by 1 error
2020-09-23 09:19:02 -07:00
John Safranek
07e1baadc9
EVP Fix
...
Change a few missed strings to use the constant names.
2020-09-22 15:55:46 -07:00
Sean Parkinson
e539322a88
PKCS#11 fix: Generate ECC key for decrypt/sign or derive
...
Add debugging information to PKCS#11.
2020-09-23 08:30:22 +10:00
John Safranek
54c4258c4b
FIPS Ready Windows Fix
...
1. Modify the WIN10 FIPS solution user_settings.h to check for a
FIPS Ready flag and to override HAVE_FIPS_VERSION to 3 if set.
2. Removed some redundant constants from the EVP file.
2020-09-22 15:23:36 -07:00
David Garske
99d96246bd
Fix for STM32 issue with some Cube HAL versions (such as F777) which could modify non-block aligned bytes in the output buffer during decrypt. For TLS these bytes are the authentication tag. Workaround is to save off the incoming expected authentication tag. ZD 10961.
2020-09-22 15:04:30 -07:00
John Safranek
87d042e37d
EVP Fix
...
Clean up a bad guard check for AES-CTR.
2020-09-22 09:46:27 -07:00
John Safranek
fc425b74fc
EVP Fix
...
Add a few more guard flag checks to leave out things appropriately.
2020-09-22 09:06:30 -07:00
Marko Mäkelä
99a481b28e
Use Intel intrinsic functions for RDSEED and RDRAND
...
Starting with GCC 9 or clang 9, we can actually use <immintrin.h>
without any problems. We only have to flag such
functions where such instructions are being used.
The benefit of using intrinsic functions over inline assembler
is that the compiler is given more flexibility. In particular,
clang -fsanitize=memory (MemorySanitizer, MSAN) will not raise
bogus alarms about memory being uninitialized.
Both intrinsic functions are available starting with GCC 5 and
clang 3.8. The RDRAND wrapper is available starting with clang 3.7
via <immintrin.h>. Before GCC 9 and clang 9, the RDSEED wrapper is
not available via <immintrin.h> but via <x86intrin.h>, and only after
jumping through some hoops to enable it.
2020-09-22 09:45:46 +03:00
Takashi Kojo
83cdd1c314
fix NO_DH guard
2020-09-22 07:30:21 +09:00