15244 Commits

Author SHA1 Message Date
John Safranek
a4f927999f
Merge pull request #4431 from haydenroche5/is_on_curve_fips
Don't compile wolfSSL_EC_POINT_is_on_curve for FIPS.
2021-09-28 09:42:08 -07:00
Hayden Roche
a9870d59a3 Don't automatically set BUILD_ED25519_SMALL and BUILD_CURVE25519_SMALL in the
CMake build when using user_settings.h.

See https://github.com/wolfSSL/wolfssl/pull/4367 for the same change to the
autotools build.
2021-09-28 09:00:50 -07:00
Hayden Roche
6a0bc995a0 Don't compile wolfSSL_EC_POINT_is_on_curve for FIPS.
This function uses wc_ecc_point_is_on_curve, which isn't in the current (v2)
FIPS module.
2021-09-27 16:08:04 -07:00
David Garske
847b8f9a1f
Reduce openssl verbosity in BIO due to PEM_X509_INFO_read_bio reading 1 byte at a time. Remove duplicate PEM_X509_INFO_read_bio macro. (#4428) 2021-09-28 08:21:23 +10:00
Eric Blankenhorn
702ba65b1c Add support for X9.42 header 2021-09-27 15:37:11 -05:00
Jacob Barthelmeh
6e7c6e8a66 add comments to dox header file 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
41f3a006ac sanity check on padding size imported 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
21181f2437 canned test was made without the wolfssl_idea enum on 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
13478a94a8 sanity check on block size with block cipher type 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
8b456b90e0 add test case for tls export/import 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
1929024029 fix for getting export buffer size 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
64f53c4e1b fix macro name and make api public 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
22b6cc675a add import/export of peer info with tls 2021-09-27 14:01:15 -06:00
Jacob Barthelmeh
2871fc670f initial serialization of TLS session 2021-09-27 14:00:13 -06:00
David Garske
943c98a45e
Fix some PKCS11 warnings and spelling errors. (#4427) 2021-09-27 08:23:48 +10:00
David Garske
3bdce348e9
Added NID_pkcs9_contentType and ub_ to compatibility layer (#4408)
* Added `NID_pkcs9_contentType` and `ub_` values.  ZD 11742

* Improve the API unit test. Also only include when `WOLFSSL_CERT_REQ` defined.
2021-09-27 08:21:53 +10:00
Chris Conlon
9e4ab9b638
Add BIO_up_ref(), PEM_read_DHparam(), EVP_MD_nid() (#4348)
* add BIO_up_ref

* add PEM_read_DHparams()

* add EVP_MD_nid()

* exclude PEM_read_DHparams when NO_FILESYSTEM defined

* review feedback: single threaded, indents, EVP_MD_nid
2021-09-27 08:20:37 +10:00
Juliusz Sosinowicz
32e4d5ad70
Use record size instead of buffer size to validate alert length (#4425) 2021-09-27 08:05:13 +10:00
Hayden Roche
709a84f8b5 Add support for libwolfcrypttest and libwolfcryptbench to autotools flow.
These can be built by configuring with `--enable-crypttests-libs`.
2021-09-25 10:31:06 -07:00
Hayden Roche
302938d3c6 Improve wolfcrypt test/bench library comments.
These can be built as shared libraries, too, so the comments shouldn't be
specific about static libraries.
2021-09-25 10:30:01 -07:00
John Safranek
7319627533
Merge pull request #4423 from elms/gcc_makefile_options
GCC makefile: allow overriding and provide more flexibility
2021-09-24 14:07:48 -07:00
Hayden Roche
9634a54b8f Improve CMake build option handling.
Prior to this commit, we only allowed CMake options to be specified according to
a finite set of values. For example if an option "WOLFSSL_FEATURE" was permitted
to take only the values "yes" and "no" and a user ran
`cmake -DWOLFSSL_FEATURE=ON`, that would fail because ON isn't in `[yes, no]`.
However, this behavior runs counter to CMake's way of evaluating boolean values,
which permits a variety of values that evaluate to true/false (see
https://cmake.org/cmake/help/latest/command/if.html#basic-expressions). This
commit will allow the user to specify any value for a build option. If it's not
in the predefined set of values, we use CMake's "if" logic to reduce the value
to yes or no.
2021-09-24 13:54:18 -07:00
Hayden Roche
ec857f6f62 Add a CMake option to build wolfcrypt test and bench code as static libs.
Application code can use the resulting CMake targets or the static library
artifacts directly (e.g. libwolfcrypttest.a on *nix).
2021-09-24 13:54:18 -07:00
elms
690b7d9800 GCC makefile: fix warning for hard fault format strings 2021-09-24 10:47:47 -07:00
David Garske
8169e12975
Merge pull request #4424 from SparkiDev/rsa_dec_pkcs15
RSA: cast bitwise negate value to byte before converting to int
2021-09-23 21:47:36 -07:00
Hayden Roche
24e2eded1e
Add to the OpenSSL compatibility layer. (#4404)
- X509_get_extension_flags
- X509_get_key_usage
- X509_get_extended_key_usage
- ASN1_TIME_to_tm
- ASN1_TIME_diff
- PEM_read_X509_REQ
- ERR_load_ERR_strings
- BIO_ssl_shutdown
- BIO_get_ssl
- BIO_new_ssl_connect
- BIO_set_conn_hostname
2021-09-24 12:26:53 +10:00
Sean Parkinson
d5a803d81d RSA: cast bitwise negate value to byte before converting to int 2021-09-24 09:18:49 +10:00
Anthony Hu
33cb823148
Remove legacy NTRU and OQS (#4418)
* Remove NTRU and OQS

* Keep the DTLS serialization format backwards compatible.

* Remove n from mygetopt_long() call.

* Fix over-zealous deletion.

* Resolve problems found by @SparkiDev
2021-09-24 08:37:53 +10:00
Elms
23f4aadf27 GCC makefile: allow overriding and provide more flexibility
- older GCC and additional platforms
 - `NO_EXAMPLES` to exclude building .o files
 - add FIPS optional
2021-09-23 14:55:34 -07:00
John Safranek
79787eaaa4
Merge pull request #4419 from anhu/set1_groups_list
Make quantum-safe groups available to the compatibility layer.
2021-09-23 10:28:02 -07:00
Chris Conlon
82a3d79c2f unnecessary variable init, else formatting in bio.c 2021-09-23 11:26:17 -06:00
John Safranek
a4609c612f
Merge pull request #4413 from kabuobeid/wpas_keying
Add HAVE_KEYING_MATERIAL requirement to WPAS, to use wolfSSL_export_keying_material
2021-09-23 10:20:34 -07:00
John Safranek
8818df2d34
Merge pull request #4415 from elms/ppc/define_gates_64bit_literals
Define gate fixes and sha3 64bit literal definitions
2021-09-23 10:18:03 -07:00
Anthony Hu
58a02495fe Make the quantum-safe groups available to the OpenSSL compatibility layer. 2021-09-22 15:28:44 -04:00
Daniel Pouzzner
b716c88e01 smallstack refactors for ge_double_scalarmult_vartime(), sp_ModExp_4096(), and sp_DhExp_4096(). 2021-09-22 13:58:05 -05:00
Eric Blankenhorn
e6e7795140
Make subj alt name order match openSSL (#4406) 2021-09-22 10:29:57 +10:00
John Safranek
df30a88dc6
Merge pull request #4414 from JacobBarthelmeh/devcrypto
update macro guard on SHA256 transform call
2021-09-21 10:03:51 -07:00
John Safranek
63a3eef97a
Merge pull request #4403 from dgarske/zd12852_sniffer
Sniffer improvements for handling TCP ack unseen and retransmission issues
2021-09-21 09:53:27 -07:00
John Safranek
7ec7faddef
Merge pull request #4405 from anhu/truncating_last_char
Fix for `set1_curves_list` ignoring last character
2021-09-21 08:49:53 -07:00
David Garske
34c6e8f975
Merge pull request #4407 from douzzer/linuxkm-SIMD-IRQ
linuxkm-SIMD-IRQ
2021-09-20 14:57:38 -07:00
Elms
ef33445316 Define gate fixes and sha3 64bit literal definitions
Found when supporting PPC750
2021-09-20 13:48:34 -07:00
Daniel Pouzzner
6d715130a2 linuxkm: cleanups and smallstack refactors related to WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED, associated linuxkm-SIMD-IRQ PR, and associated peer review:
smallstack refactors for wolfcrypt/src/rsa.c:wc_CheckProbablePrime_ex() and wolfcrypt/src/pwdbased.c:wc_PKCS12_PBKDF_ex();

add WARN_UNUSED_RESULT macro to types.h;

text format cleanup;

fix internal.c:LowResTimer() implementation.

refactor tls13.c:TimeNowInMilliseconds() for kernel 4.9 and 3.16 compat.

use ktime_get_coarse_real_ts64() only for kernel 5.x+.  in kernel 4.x, use its older form, current_kernel_time64(), and in 3.x, use getnstimeofday().

linuxkm/module_hooks.c: fix wolfssl_init() pie code to be compatible with kernel 4.4-;

fix allocate_wolfcrypt_irq_fpu_states() return codes to all be wolfcrypt codes, and in calling code, pass up that code (suggested by dgarske peer review).
2021-09-20 13:46:51 -05:00
Daniel Pouzzner
ec21dd6d13 miscellaneous buildability fixes:
configure.ac: fix ed25519/sha512 dependency test to not misfire when ENABLED_32BIT;

wolfssl/wolfcrypt/curve{25519,448}.h: fix redundant typedefs of curve{25519,448}_key (fixes -Wpedantic warnings);

configure.ac: fix for "ISO C forbids an empty translation unit [-Werror=pedantic]", re wolfcrypt/src/sp_c{32,64}.c;

configure.ac: fixes for --enable-32bit versus pedantic "ISO C forbids an empty translation unit", including explicit exclusion of 32bit-incompatible algorithms from enable-all and enable-all-crypto sets;

tests/api.c: fixes for a couple inadequately gated SHA2 dependencies;

tests/api.c:test_wolfSSL_set_alpn_protos(): fix prototype missing (void);

wolfcrypt/src/misc.c and wolfssl/wolfcrypt/misc.h: fix ForceZero() definition and NO_INLINE prototype to not counterfactually constify the mem ptr, to avoid -Wmaybe-uninitialized from gcc11;

wolfcrypt/src/des3.c: drop obsolete register qualifier from declaration in DesSetKey(), for c++17 compatibility;

src/ssl.c:wolfSSL_BN_mod_word(): fix cast of arg2 to mp_mod_d().
2021-09-20 13:38:52 -05:00
David Garske
753a931196
Merge pull request #4416 from SparkiDev/mp_submod_addmod_ct
SP math, TFM: constant time addmod, submod
2021-09-20 11:37:45 -07:00
David Garske
a62f103899
Merge pull request #4412 from anhu/level
Convert post-quantum algorithm group names
2021-09-20 11:27:20 -07:00
Daniel Pouzzner
83e0e19e03 linuxkm feature additions:
add build-time support for module signing using native Linux facility;

add support for alternative licenses using WOLFSSL_LICENSE macro;

improve load-time kernel log messages;

add support for sp-math-all asm/AVX2 acceleration;

add error-checking and return in SAVE_VECTOR_REGISTERS();

implement support for x86 accelerated crypto from interrupt handlers, gated on WOLFSSL_LINUXKM_SIMD_X86_IRQ_ALLOWED:

  * wolfcrypt_irq_fpu_states
  * am_in_hard_interrupt_handler()
  * allocate_wolfcrypt_irq_fpu_states()
  * free_wolfcrypt_irq_fpu_states()
  * save_vector_registers_x86()
  * restore_vector_registers_x86()

add WOLFSSL_LINUXKM_SIMD, WOLFSSL_LINUXKM_SIMD_X86, and WOLFSSL_LINUXKM_SIMD_ARM macros for more readable gating.
2021-09-20 10:27:13 -05:00
Daniel Pouzzner
2629b8b1fb wolfcrypt/src/wc_port.c LINUXKM time(): use ktime_get_coarse_real_ts64 instead of ktime_get_real_seconds, to avoid GPL-only function, and fix the calculation in the kernel 3.x codepath. 2021-09-20 10:27:13 -05:00
Daniel Pouzzner
1209908468 tests/api.c: fix key size in test_wc_ecc_shared_secret(). 2021-09-20 10:27:13 -05:00
Daniel Pouzzner
45e9872714 wolfcrypt/benchmark: fix output buffer size in bench_eccEncrypt(). 2021-09-20 10:27:13 -05:00
Anthony Hu
ebf1168240 Documenting the level meanings 2021-09-20 10:11:49 -04:00