5343 Commits

Author SHA1 Message Date
Elms
75e807abc6 Fixes for gcc-10 and -fsanitize=undefined for rabbit.c
* One introduced in #4156
* One from previous commit in this PR
2021-06-30 22:20:17 -07:00
Sean Parkinson
6694775d4b Changes to compile without XTREAM_ALIGN
Use macro to load 32 bits from input parameters key in hc128.c and input
in rabbit.c
Also fix warning about string copy.
2021-06-30 21:58:30 -07:00
Elms
56d879f422 address scan-build issues for clang 6 and 10 2021-06-30 21:58:30 -07:00
Elms
c9597ea735 sha3: align data for Sha3Update 2021-06-30 21:58:30 -07:00
Elms
dc7beab784 address errors with -fsanitize=undefined
- fix null dereferences or undefined `memcpy` calls
 - fix alignment in `myCryptoDevCb`
 - fix default dtls context assignment
 - add align configure option to force data alignment

TESTED:
 `./configure CFLAGS=-fsanitize=undefined\ -DWOLFSSL_GENERAL_ALIGNMENT=1 --enable-all`
2021-06-30 21:58:30 -07:00
Sean Parkinson
4cff893c5f SP math all: allow reading of bin up to max digit size 2021-07-01 14:29:58 +10:00
Jacob Barthelmeh
893b71e8c1 remove dead code 2021-06-30 19:54:25 +07:00
Jacob Barthelmeh
23eededc36 simplify and fix max stream buffer length 2021-06-30 15:26:44 +07:00
Sean Parkinson
60a520c525 SP: Thumb implementaton that works with clang 2021-06-30 13:10:29 +10:00
Sean Parkinson
d1fb736136 Zephyr Project: update port to work with latest 2021-06-30 10:29:54 +10:00
Sean Parkinson
36d534034c SP math: cast number to sp_digit rather than declare as long 2021-06-30 09:28:51 +10:00
David Garske
ae68de060a
Merge pull request #4171 from SparkiDev/sp_small_fast_modexp
SP: allow fast mod_exp to be compiled for small C code
2021-06-29 13:32:55 -07:00
David Garske
0d1672dfee
Merge pull request #4170 from SparkiDev/sp_mingw64
SP: Don't cast number to sp_digit rather than declare as long
2021-06-29 13:32:28 -07:00
Chris Conlon
9179071af5
Merge pull request #4153 from JacobBarthelmeh/Testing
fix for keyid with ktri cms
2021-06-29 11:40:00 -06:00
David Garske
e59cc79a1f Document new WOLFSSL_SP_FAST_MODEXP option. 2021-06-29 09:16:27 -07:00
David Garske
a748b5264e Fix for wolfcrypt/src/sp_int.c:2720:34: error: left shift count >= width of type with mingw64. 2021-06-29 09:13:32 -07:00
Sean Parkinson
303f944935 SP: allow fast mod_exp to be compiled for small C code 2021-06-29 12:51:21 +10:00
Sean Parkinson
08e560e0a7 SP: Don't cast number to sp_digit rather than declare as long
mingw64 has numbers as 32-bit type when declarted long.
Fixup some line lengths.
2021-06-29 11:07:47 +10:00
Daniele Lacamera
15080317ce port/st: added mention of the PKA support in README 2021-06-28 14:39:58 +02:00
David Garske
80480e5d1f
Merge pull request #4163 from lealem47/rsa-test
Rsa test
2021-06-25 13:12:58 -07:00
David Garske
5adbcfb3be
Merge pull request #4151 from SparkiDev/sp_math_all_base10
SP math all: fix read radix 10
2021-06-25 09:37:05 -07:00
David Garske
74b9b5a8cd
Merge pull request #4156 from SparkiDev/regression_fixes_1
Regression test fixes
2021-06-25 07:48:02 -07:00
Lealem Amedie
729fea6b71 unused variable fix in rsa_oaep_padding_test fix 2021-06-25 08:39:44 -06:00
Jacob Barthelmeh
5038a27cda add test cases and set content oid with decode encrypted data 2021-06-25 21:16:01 +07:00
Jacob Barthelmeh
55002c56d2 update for ber padding 2021-06-25 18:57:28 +07:00
Sean Parkinson
fbe086534a SP math all: fix read radix 10
Ensure first digit is 0 when zeroing a number.
Check size of output in _sp_mul_d() - only place to be sure of overflow.
Modify callers of _sp_mul_d() to check return.
2021-06-25 15:55:32 +10:00
Lealem Amedie
873f10b0cf Simplifying rsa_test() by extracting sections as separate functions 2021-06-24 20:47:14 -06:00
Sean Parkinson
1994811d24
Merge pull request #4144 from haydenroche5/pkcs8
Make a bunch of PKCS#8 improvements.
2021-06-25 12:22:11 +10:00
Sean Parkinson
8592053856 Regression test fixes
./configure --enable-all --disable-rsa
./configure --disable-chacha --disable-asm
./configure --disable-rsa --disable-ecc --disable-dh --enable-curve25519
--enable-cryptonly (and ed25519, curve448, ed448)
./configure --disable-tls13 --enable-psk --disable-rsa --disable-ecc
--disable-dh C_EXTRA_FLAGS=-DWOLFSSL_STATIC_PSK
./configure --disable-oldtls --enable-psk -disable-rsa --disable-dh
-disable-ecc --disable-asn C_EXTRA_FLAGS=-DWOLFSSL_STATIC_PSK
--enable-lowresource --enable-singlethreaded --disable-asm
--disable-errorstrings --disable-pkcs12 --disable-sha3 --disable-sha224
--disable-sha384 --disable-sha512 --disable-sha --disable-md5
-disable-aescbc --disable-chacha --disable-poly1305 --disable-coding
Various build combinations with WOLFSSL_SP_MATH and WOLFSSL_SP_MATH_ALL
2021-06-25 09:18:06 +10:00
Juliusz Sosinowicz
656e49cc3b Expand SHA-3 support
Add more support in the EVP layer as well as add signing support. The SHA-3 OID's were also added for DER algorithm identifier encoding.
2021-06-24 19:31:43 +02:00
Jacob Barthelmeh
b826083fbf better checking on length of streaming buffer 2021-06-24 23:06:37 +07:00
Sean Parkinson
2fb6a9eacf SAKKE: fix configurations
Fix position of sp_1024_norm_18 now that div requires it:
./configure --disable-shared --enable-sakke --disable-eccsi
--enable-sp
Fix missing '{' in sp_mulmod_table_1024:
./configure --disable-shared --enable-sakke --enable-eccsi
--enable-smallstack  --enable-sp
2021-06-24 14:01:27 +10:00
David Garske
73c90369c6 Fix for int neg being defined mid code. Fix limit check for mp_mulmod using hardware vs software. Resolves issue when using WC_RSA_BLINDING. 2021-06-23 14:45:52 -07:00
David Garske
2d1b113f51 Fix for missing wolfcrypt_mp_prime_is_prime_ex def. 2021-06-23 14:45:52 -07:00
John Safranek
ae2f2b246e
Merge pull request #4148 from BrianAker/master
Fix for make distcheck, maintainer-clean, to allow distribution builds.
2021-06-23 10:33:06 -07:00
David Garske
81daf9172b
Merge pull request #3872 from ejohnstown/pcExt
Policy Constraints Extension
2021-06-23 09:40:15 -07:00
Hayden Roche
b3401bd102 Make a bunch of PKCS#8 improvements.
- Add doxygen documentation for wc_GetPkcs8TraditionalOffset, wc_CreatePKCS8Key,
wc_EncryptPKCS8Key, and wc_DecryptPKCS8Key.
- Add a new API function, wc_CreateEncryptedPKCS8Key, which handles both
creation of an unencrypted PKCS#8 key and the subsequent encrypting of said key.
This is a wrapper around TraditionalEnc, which does the same thing. This may
become a first-class function at some point (i.e. not a wrapper). TraditionalEnc
is left as is since it is used in the wild.
- Added a unit test which exercises wc_CreateEncryptedPKCS8Key and
wc_DecryptPKCS8Key. Testing wc_CreateEncryptedPKCS8Key inherently also tests
TraditionalEnc, wc_CreatePKCS8Key, and wc_EncryptPKCS8Key.
- Modified wc_EncryptPKCS8Key to be able to return the required output buffer
size via LENGTH_ONLY_E idiom.
- Added parameter checking to wc_EncryptPKCS8Key and wc_DecryptPKCS8Key.
2021-06-23 08:39:20 -07:00
Sean Parkinson
eccfb4f632
Merge pull request #4125 from dgarske/sniffer_etsi
TLS: Fixes for sniffer and static ephemeral keys
2021-06-23 09:17:13 +10:00
Chris Conlon
446393bcab
Merge pull request #3793 from TakayukiMatsuo/os_base64
Add wolfSSL_EVP_Encode/Decode APIs
2021-06-22 10:19:30 -06:00
Jacob Barthelmeh
2b1a6cfb54 add setting contentOID with decode enveloped data 2021-06-22 22:06:16 +07:00
Jacob Barthelmeh
a4b5ebb62f remove contentOID check 2021-06-22 21:59:57 +07:00
Jacob Barthelmeh
31e8784057 fix for compressedData eContent encoding with PKCS7 2021-06-22 21:59:57 +07:00
Jacob Barthelmeh
9c2de0e40a wc_PKCS7_DecodeCompressedData optionally handle a packet without content wrapping 2021-06-22 21:59:57 +07:00
Jacob Barthelmeh
3cd43cf692 fix for keyid with ktri cms 2021-06-22 21:33:12 +07:00
David Garske
52582ede28
Merge pull request #4146 from SparkiDev/pkcs11_dec_final
PKCS #11: Use C_Decrypt instead of C_DecryptUpdate
2021-06-21 15:28:45 -07:00
David Garske
7491a44bb4 Fix for possible memory leak case on mp_init failure in wc_ecc_verify_hash_ex with WOLFSSL_SMALL_STACK. 2021-06-21 09:19:47 -07:00
Guido Vranken
7c600e3ebc In wc_ecc_verify_hash_ex, return if ALLOC_CURVE_SPECS() fails
This prevents a NULL pointer dereference later in the function.
2021-06-20 22:29:20 +02:00
Brian Aker
2d497d1cf5 Fix for make distcheck, maintainer-clean, to allow distribution builds.
This the second pass at this after seeing how fips is added to tree in later phases.
This allow autoreconf to be directly called which allows the Makefile to rebuild when seeing that changes have been ( having an autogen.sh is older convention which left to history in the way autotools are invoked )
This fixes "make distcheck" and "make maintainer-clean" which are required by most distributions packaging systems.

The files previously touched by autogen.sh are now properly placed into autoconf.
The include files files are generated by configure. ( There is a note placed in configure.ac as to why and reference to the automake documention for this ). Append to file was done on purpose, touch cannot be in configure safetly. Normally autoheader would be used for this but since the include files are created out of tree, care has to be taken to not overwrite those file.
For the source files, they were moved into the coresponding automake file. It is safe to use touch in automake. Since files can optionally copied from elsewhere, they have to be listed in BUILT_SOURCES. They are written srcdir in order to allow make to do VPATH builds ( which is configure by make distcheck ).
To show fips files are preserved without having the actual fips files, a C style comment can be echoed into the files.
There are a few current, but outstanding issues.
1) config.h needs to be fixed configure.ac to use autoheader in order to allow configure to know to rebuilt depencies on its changes. ( Out of scope for this patch. )
2) verion.h checked into the tree and it is a built file. A make maintainer-clean followed by "git status --ignored" will confirm this. ( Out of scope for this patch )
3) autogen.sh has not been updated to reflect fixes. I believe that for this patch, it should be left alone and checked for regression in Jenkins by itself.
4) There is an out of date .spec file for building RPM which should be updated now that distcheck is working.
5) maintainer-clean should have rule added to remove build-aux testdriver.

This has been tested on current Ubuntu testing, OSX, Fedora 34, and Debian 10.

Additionaly "make distcheck" should be added to regression testing, along with "make maintainer-check".

Other improvement possibilities:
A possible future improvement is to let autoconf handle build with optional out of dist files.
Modify fips configure.ac check to allow for an injection of comments into blank fips files in order to prove distribution of fips/non-fips builds.
Update git rules to use 'make maintainer-clean', 'autoreconf -if', 'make distcheck'.
2021-06-19 20:16:14 -07:00
David Garske
15065175d8
Merge pull request #4145 from SparkiDev/sp_int_neg_mod
SP int negative: check size of a in mp_mod
2021-06-18 08:14:02 -07:00
Sean Parkinson
699a75c211 PKCS #11: Use C_Decrypt instead of C_DecryptUpdate
Some PKCS #11 devices need final called (implicit in C_Decrypt).
2021-06-18 12:14:34 +10:00