Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
927da9a
F-8341 - Reject shallow AES-CCM context copies
aidangarske Oct 14, 2026
f0d5d91
F-10135 - Initialize and track the AES-CCM backend
aidangarske Oct 14, 2026
e8e5141
F-8352 - Release owned AES-CCM AAD during cleanup
aidangarske Oct 15, 2026
ff11826
F-8377 - Free pending AES-CCM AAD before resetting defaults
aidangarske Oct 15, 2026
edb56c5
F-10142 - Track CCM direction and per-operation tag validity
aidangarske Oct 15, 2026
8fcd72b
F-12248 - Reset spent TLS state during AEAD reinitialization
aidangarske Oct 15, 2026
08dc078
F-10133 - Release untransferred ECDSA signature components
aidangarske Oct 15, 2026
124bdff
F-11322 - Enforce MAC signing output capacity
aidangarske Oct 12, 2026
fd0a94b
F-8348 - Enforce HMAC raw key output capacity
aidangarske Oct 12, 2026
75e6450
F-13713 - Report the maximum HMAC output size
aidangarske Oct 12, 2026
5aa53a7
F-8344 - Reject oversized MAC updates
aidangarske Oct 12, 2026
f582e33
F-6450 - Report CMAC copy failures accurately
aidangarske Oct 12, 2026
ff0a8f1
F-6451 - Check CMAC key assignment
aidangarske Oct 12, 2026
c9d4c7d
F-8374 - Make CMAC ASN1 registration atomic
aidangarske Oct 12, 2026
d85897f
F-10159 - Cleanse MAC keys before release
aidangarske Oct 12, 2026
580c7fa
F-12249 - Preserve legacy CMAC free dispatch
aidangarske Oct 12, 2026
c4f40ce
F-11327 - Keep MAC ASN1 methods engine owned
aidangarske Oct 12, 2026
7d43268
F-13040 - Reject unsupported CMAC ciphers
aidangarske Oct 13, 2026
e7579b7
F-8347 - Cleanse MAC state before release
aidangarske Oct 13, 2026
1e4bbbf
F-8392 - Skip absent MAC keys during duplication
aidangarske Oct 13, 2026
4b2023b
F-11325 - Preserve MAC keys on replacement failure
aidangarske Oct 13, 2026
9dc19a5
F-11329 - Preserve original HMAC key lengths
aidangarske Oct 13, 2026
13cd019
F-8382 - Release failed MAC context copies
aidangarske Oct 13, 2026
93aaee2
F-11331 - Cleanse HMAC alignment buffers
aidangarske Oct 13, 2026
bf11c3e
F-12250 - Clean up failed HMAC initialization
aidangarske Oct 13, 2026
1bfb8e8
F-8351 - Align ECDSA digest feature guards
aidangarske Oct 12, 2026
ad2ceb4
F-8368 - Register PBE independently of ECC
aidangarske Oct 12, 2026
8a37401
F-8379 - Guard ECDSA teardown consistently
aidangarske Oct 12, 2026
0943ed5
F-8390 - Remove duplicate FIPS callback
aidangarske Oct 12, 2026
0acf053
F-11311 - Clear PKEY methods during teardown
aidangarske Oct 12, 2026
810d88b
F-12258 - Correct mutex initialization diagnostic
aidangarske Oct 12, 2026
40c439c
F-8375 - Validate legacy PBKDF2 parameters
aidangarske Oct 13, 2026
6e1b2f4
F-10147 - Require exact engine identifiers
aidangarske Oct 13, 2026
c90674e
F-10148 - Roll back failed engine binding
aidangarske Oct 13, 2026
dd485a7
F-11333 - Serialize engine binding lifecycle
aidangarske Oct 13, 2026
ee61341
F-13063 - Pin process-global PBE callbacks
aidangarske Oct 14, 2026
fbf8d68
F-10134 - Check MAC ASN1 key assignment
aidangarske Oct 14, 2026
7ff899a
F-5449 - Implement MAC string controls
aidangarske Oct 14, 2026
9e5f0ef
F-9347 - Correct AES-CBC-HMAC IV length documentation
aidangarske Oct 12, 2026
9ea20fd
F-10143 - Support staged AES-CBC-HMAC initialization
aidangarske Oct 12, 2026
24b8028
F-13041 - Skip HMAC updates for non-TLS encryption
aidangarske Oct 12, 2026
124466d
F-8366 - Propagate AES-CBC-HMAC encryption failures
aidangarske Oct 12, 2026
c1f4596
F-10140 - Return standard AES-CBC-HMAC control errors
aidangarske Oct 12, 2026
22773db
F-13037 - Track empty TLS CBC-HMAC records
aidangarske Oct 12, 2026
65d73a4
F-13039 - Reset AES-CBC-HMAC TLS framing state
aidangarske Oct 12, 2026
2609d70
F-10131 - Free AES-CBC-HMAC cipher state
aidangarske Oct 12, 2026
5ef459f
F-11326 - Reject malformed CBC-HMAC record lengths
aidangarske Oct 13, 2026
828769e
F-11308 - Skip CBC-HMAC verification outside TLS
aidangarske Oct 13, 2026
e8c5053
F-11309 - Accept extended CBC-HMAC TLS padding
aidangarske Oct 13, 2026
ffe2eec
F-13711 - Preserve CBC-HMAC state after bad padding
aidangarske Oct 13, 2026
c2210ce
F-13067 - Cleanse CBC-HMAC record MAC before return
aidangarske Oct 13, 2026
cd3e752
F-4172 - Balance CBC-HMAC TLS authentication work
aidangarske Oct 13, 2026
a0e7dae
F-8345 - Release DH and ECDH RNG locks only after acquisition
aidangarske Oct 14, 2026
9b4f8b3
F-15141 - Report unsupported PKEY controls distinctly
aidangarske Oct 14, 2026
ae09f24
F-11319 - Return errors for EC_KEY verification setup failures
aidangarske Oct 14, 2026
a8470fa
F-12252 - Return errors for EVP ECDSA verification setup failures
aidangarske Oct 14, 2026
3ad749f
F-6182 - Clear the legacy ECDH shared secret
aidangarske Oct 14, 2026
c0cc843
F-8381 - Track initialized EC keys before RNG setup
aidangarske Oct 14, 2026
619ce2f
F-10132 - Track initialized ECDH keys before RNG setup
aidangarske Oct 14, 2026
c38a9e7
F-11305 - Correct the legacy ECDH output annotation
aidangarske Oct 14, 2026
c7779f1
F-12287 - Derive EC signature capacity from the key
aidangarske Oct 14, 2026
0bcd388
F-13708 - Correct EC signature length logging
aidangarske Oct 14, 2026
04131d2
F-13712 - Correct legacy ECDH KDF error logging
aidangarske Oct 14, 2026
8066bfe
F-6452 - Correct AES-CCM error logging
aidangarske Oct 14, 2026
c9cbd93
F-11321 - Use the standard AES-CCM default tag size
aidangarske Oct 14, 2026
c3d8e8d
F-10136 - Return zero for empty AES-CCM updates
aidangarske Oct 14, 2026
a599727
F-13038 - Preserve the AES-CCM decrypt nonce
aidangarske Oct 14, 2026
59dd0ad
F-6630 - Cleanse the raw ECDH KDF input after use
aidangarske Oct 14, 2026
40c0c3c
F-8371 - Reset cached peer state before replacement
aidangarske Oct 14, 2026
e0b2b44
F-8372 - Reject ECDH derivation without a peer key
aidangarske Oct 14, 2026
99e316a
F-8373 - Propagate EC curve-size failures
aidangarske Oct 14, 2026
091817a
F-10152 - Resolve the EC curve before derivation policy checks
aidangarske Oct 14, 2026
bd74dc3
F-11310 - Write the configured ECDH KDF output length
aidangarske Oct 14, 2026
d75aaf1
F-11328 - Validate ECDH peer groups and point encodings
aidangarske Oct 14, 2026
b9f8231
F-12288 - Validate ECDH KDF configuration before derivation
aidangarske Oct 14, 2026
dc4cec9
F-13048 - Match EC string controls exactly
aidangarske Oct 14, 2026
2d162ec
F-8362 - Report the ECDH KDF output length actually written
aidangarske Oct 14, 2026
ce0df0f
F-15139 - Support named EC parameter string controls
aidangarske Oct 14, 2026
1543742
F-4178 - Guard ECC RNG cleanup after successful initialization
aidangarske Oct 14, 2026
ba57a0d
F-6175 - Release owned ECDH KDF UKM during context cleanup
aidangarske Oct 14, 2026
db664f6
F-12251 - Clean up failed curve-specific EC initialization
aidangarske Oct 14, 2026
bd1fa32
F-8361 - Copy EC contexts into independently owned state
aidangarske Oct 14, 2026
e7d38a2
F-6632 - Guard RSA signing digest check when context data is absent
aidangarske Oct 13, 2026
35c69d3
F-10128 - Correct RSA encrypt output parameter documentation
aidangarske Oct 13, 2026
1399fe0
F-10129 - Correct RSA decrypt output parameter documentation
aidangarske Oct 13, 2026
a90cd8b
F-13042 - Distinguish invalid RSA controls from unsupported controls
aidangarske Oct 13, 2026
3629f57
F-6176 - Preserve full-width RSA key generation exponent
aidangarske Oct 13, 2026
e62292a
F-15138 - Release transferred RSA key generation exponents
aidangarske Oct 13, 2026
6e6625f
F-8342 - Bound RSA digest encoding on all OpenSSL versions
aidangarske Oct 13, 2026
370be7b
F-8364 - Honor RSA OAEP labels and ownership
aidangarske Oct 13, 2026
aa13fea
F-15135 - Return configured digest from RSA verify recovery
aidangarske Oct 13, 2026
e5ac06b
F-8365 - Preserve absent q in named DH groups
aidangarske Oct 12, 2026
fdfb957
F-10145 - Unlock DH RNG mutex only after locking
aidangarske Oct 12, 2026
7261ef5
F-11318 - Pad DH derives to the modulus size
aidangarske Oct 12, 2026
1194614
F-12253 - Normalize DH padding controls
aidangarske Oct 12, 2026
87aaf8c
F-12255 - Clear stale q on DH parameter refresh
aidangarske Oct 12, 2026
6923cee
F-12290 - Verify generated DH generator
aidangarske Oct 12, 2026
a767b56
F-13043 - Size DH generator allocation correctly
aidangarske Oct 12, 2026
db44aae
F-13068 - Validate legacy DH prime lengths
aidangarske Oct 12, 2026
b79da1c
F-9350 - Correct generic digest documentation
aidangarske Oct 12, 2026
2902dc3
F-8378 - Correct direct SHA-1 method identifier
aidangarske Oct 12, 2026
978339e
F-10137 - Set ECDSA SHA-1 block size
aidangarske Oct 12, 2026
a4accfb
F-8367 - Clear failed digest method globals
aidangarske Oct 12, 2026
6732e76
F-13065 - Cleanse digest alignment buffer
aidangarske Oct 12, 2026
cbc2721
F-8343 - Chunk oversized digest updates
aidangarske Oct 12, 2026
5a33345
F-10155 - Deep copy generic digest contexts
aidangarske Oct 13, 2026
b69d712
F-12286 - Register legacy AES-GCM cleanup
aidangarske Oct 13, 2026
aba14bb
F-10158 - Bound AES-GCM AAD accumulation
aidangarske Oct 13, 2026
8d75b61
F-12289 - Report AES-GCM backend errors to OpenSSL
aidangarske Oct 13, 2026
a2c3768
F-13055 - Correct AES-GCM control pointer documentation
aidangarske Oct 13, 2026
c2c7d5f
F-13709 - Match AES-GCM log formats to length type
aidangarske Oct 13, 2026
8867872
F-8376 - Return zero output for empty AES-CTR input
aidangarske Oct 12, 2026
6907a95
F-9346 - Correct AES-CTR IV length documentation
aidangarske Oct 13, 2026
307aa2d
F-10146 - Correct AES-CTR context lifecycle
aidangarske Oct 13, 2026
4683b3b
F-10144 - Propagate RAND seed mixing failures
aidangarske Oct 13, 2026
ab266dc
F-10160 - Report actual RAND initialization status
aidangarske Oct 13, 2026
d421778
F-11332 - Clear supplemental RAND seed state
aidangarske Oct 13, 2026
2ce78de
F-13710 - Format RAND entropy as a double
aidangarske Oct 13, 2026
7964dc1
F-8383 - Return zero for AES block cipher failures
aidangarske Oct 13, 2026
23384f5
F-9345 - Correct AES-CBC IV length documentation
aidangarske Oct 13, 2026
9a3cc0c
F-10149 - Correct AES block context lifecycle
aidangarske Oct 13, 2026
fdbe157
F-13046 - Remove redundant AES-CBC initialization guard
aidangarske Oct 13, 2026
023e1bb
F-13047 - Remove redundant AES-ECB decrypt conditions
aidangarske Oct 13, 2026
52d3863
F-8358 - Limit DES3 IV state copies
aidangarske Oct 13, 2026
1ab4a9b
F-8389 - Correct DES3 decrypt error logging
aidangarske Oct 13, 2026
cf0849a
F-10150 - Clean up DES3 cipher state
aidangarske Oct 13, 2026
130f684
F-8384 - Reject unnamed legacy method allocations
aidangarske Oct 13, 2026
b19ac87
F-8385 - Reject EC keys without private scalars
aidangarske Oct 13, 2026
f310294
F-13707 - Pad legacy EC private scalar encodings
aidangarske Oct 13, 2026
54dd9e3
F-8356 - Reject unsupported TLS1-PRF digests
aidangarske Oct 12, 2026
d8c3702
F-10138 - Clear failed TLS PRF secret state
aidangarske Oct 13, 2026
7e5c1fb
F-12257 - Reject oversized TLS PRF output lengths
aidangarske Oct 13, 2026
37e8214
F-12269 - Correct TLS PRF output parameter directions
aidangarske Oct 13, 2026
99c84b8
F-8360 - Preserve RSA X9.31 signature width
aidangarske Oct 12, 2026
81e11ef
F-13064 - Use produced width for RSA X9.31 operations
aidangarske Oct 13, 2026
2f1ae77
F-6012 - Report RSA X9.31 multiprecision errors
aidangarske Oct 13, 2026
29a47a1
F-11314 - Report RSA X9.31 size errors
aidangarske Oct 13, 2026
2a8b01b
F-11320 - Preserve configured RSA PSS salt length
aidangarske Oct 13, 2026
4744e6a
F-15137 - Preserve RSA PSS salt mode conversion
aidangarske Oct 13, 2026
40986e9
F-8370 - Avoid unlocking an unacquired RSA RNG mutex
aidangarske Oct 13, 2026
a8cc963
F-12254 - Report RSA RNG mutex lock errors
aidangarske Oct 13, 2026
2b927a9
F-6453 - Lock RSA X9.31 global RNG access
aidangarske Oct 13, 2026
b5dab47
F-8380 - Reject negative RSA public key encoding lengths
aidangarske Oct 13, 2026
120016d
F-11306 - Correct RSA private key import documentation
aidangarske Oct 13, 2026
a492604
F-11313 - Reject negative RSA private key encoding lengths
aidangarske Oct 13, 2026
78595f0
F-13066 - Remove unreachable RSA method digest check
aidangarske Oct 13, 2026
645c5ae
F-6183 - Support HKDF extract size queries
aidangarske Oct 13, 2026
9f27fa9
F-8350 - Clear failed HKDF key state
aidangarske Oct 13, 2026
6e6c99b
F-10139 - Clear failed HKDF salt state
aidangarske Oct 13, 2026
3580418
F-11312 - Reject invalid HKDF digests
aidangarske Oct 13, 2026
9dcd9fd
F-12256 - Reject oversized HKDF output
aidangarske Oct 13, 2026
3915795
F-13044 - Accept empty HKDF keys
aidangarske Oct 13, 2026
0f6fec1
F-15140 - Preserve HKDF info across key setup
aidangarske Oct 13, 2026
356cd09
F-13056 - Correct AES-CCM control pointer directions
aidangarske Oct 14, 2026
a2488db
F-11323 - Reject undersized AES-CCM nonces
aidangarske Oct 14, 2026
1237d6c
F-10130 - Correct AES-CCM IV-length getter comment
aidangarske Oct 14, 2026
5166261
F-11317 - Reject null AES-CCM fixed IV data
aidangarske Oct 14, 2026
17d5bdf
F-11324 - Validate AES-CCM tag parameters
aidangarske Oct 14, 2026
5009366
F-8391 - Remove unsupported CCM IV generation documentation
aidangarske Oct 14, 2026
97a24e7
F-9348 - Remove unsupported CCM IV control documentation
aidangarske Oct 14, 2026
4dbd71c
F-10141 - Simplify AES-CCM length-field validation
aidangarske Oct 15, 2026
0bb0399
Add X9.31 RSA signature leading zero regression test
aidangarske Oct 20, 2026
f56a9ac
Add test_openssl_bc.c to the Windows test project
aidangarske Nov 9, 2026
ada32c2
Skip RAND logging observer tests in multithreaded runs
aidangarske Nov 9, 2026
789cac5
Brace the ECDH KDF length check so empty log macros build
aidangarske Nov 9, 2026
f4988b1
Fill the long digest test message without RAND_bytes
aidangarske Nov 9, 2026
a309002
Enable logging for the ECDSA scalar range log check
aidangarske Nov 9, 2026
cca75d1
Discard a rejected CBC-HMAC record header on the next TLS AAD
aidangarske Nov 9, 2026
3e8b762
Ignore the HMAC sign length input as OpenSSL does
aidangarske Nov 9, 2026
65d7f57
Skip the forked RAND teardown check in valgrind unit runs
aidangarske Nov 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,31 @@
/test/.deps
/test/.libs
/test/.dirstamp
/test/dh_alloc.test
/test/dh_alloc.log
/test/dh_alloc.trs
/test/unit.test
/test/unit.log
/test/unit.trs
/test/unit_static.log
/test/unit_static.trs
/test/pbe_lifetime.test
/test/pbe_lifetime.log
/test/pbe_lifetime.trs
/test/pbe_static.test
/test/pbe_static.log
/test/pbe_static.trs
/test/engine_lifetime.test
/test/engine_lifetime.log
/test/engine_lifetime.trs
/test/engine_pbe_init.test
/test/engine_pbe_init.log
/test/engine_pbe_init.trs
/test/engine_bind.log
/test/engine_bind.trs
/test/cmac_cleanup*.test
/test/cmac_cleanup*.log
/test/cmac_cleanup*.trs
/scripts/*.log
*.gcno
*.gcda
Expand Down Expand Up @@ -74,3 +96,6 @@ openssl-source/
wolfssl-install/
wolfssl-source/
wolfengine-install/

/test/rsa_oaep_allocator.sh.log
/test/rsa_oaep_allocator.sh.trs
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
SUFFIXES =
TESTS =
TESTS = test/unit_static.test test/engine_bind.test
noinst_PROGRAMS =
noinst_HEADERS =
check_PROGRAMS =
dist_noinst_SCRIPTS =
DISTCLEANFILES =
pkginclude_HEADERS =
EXTRA_DIST =
EXTRA_DIST = test/unit_static.test test/engine_bind.test

ACLOCAL_AMFLAGS = -I m4

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ having to touch the OpenSSL code itself.
* DRBG
* RSA
* DH
* With wolfCrypt FIPS, use named or imported parameters for key generation
and agreement. Legacy `DH_generate_parameters_ex()` returns 0.
* ECC
* ECDSA
* ECDH
Expand Down
121 changes: 121 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ dnl m4_include([m4/ax_check_wolfssl.m4])

AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests])
LT_INIT([disable-static pic-only])
AM_CONDITIONAL([BUILD_STATIC_TESTS], [test "$enable_static" = "yes"])
AS_IF([test "$enable_shared" != "no"], [
AC_DEFINE([WE_HAVE_SHARED_LIBRARY], [1], [Build the shared engine library])
])

# capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
# if user doesn't override, no way to tell
Expand Down Expand Up @@ -52,6 +56,44 @@ AC_SUBST([WOLFENGINE_LIBRARY_VERSION_SECOND])
AC_SUBST([WOLFENGINE_LIBRARY_VERSION_THIRD])

LIBS="$LIBS -ldl"
AC_CHECK_HEADERS([dlfcn.h link.h valgrind/memcheck.h])
AC_CACHE_CHECK([for the dladdr module-location interface], [we_cv_dladdr], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if defined(__linux__) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
#include <dlfcn.h>
]], [[
Dl_info info;
int (*lookup)(const void *, Dl_info *) = dladdr;
info.dli_fname = 0;
info.dli_fbase = 0;
return lookup((const void *)&lookup, &info);
]])], [we_cv_dladdr=yes], [we_cv_dladdr=no])
])
AS_IF([test "$we_cv_dladdr" = "yes"], [
AC_DEFINE([WE_HAVE_DLADDR], [1],
[The complete dladdr module-location interface is available])
])
AC_CHECK_FUNCS([dl_iterate_phdr])
AS_IF([test "$ac_cv_header_link_h" = "yes" &&
test "$ac_cv_func_dl_iterate_phdr" = "yes"], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <link.h>
]], [[
struct dl_phdr_info info;
info.dlpi_addr = 0;
info.dlpi_phdr = 0;
info.dlpi_phnum = 0;
(void)dl_iterate_phdr(0, &info);
]])], [
AC_DEFINE([WE_HAVE_DL_ITERATE_PHDR], [1],
[Program header iteration is available])
])
])

# OpenSSL
AC_CHECK_HEADERS([openssl/engine.h])
Expand Down Expand Up @@ -338,6 +380,69 @@ if test "$ENABLED_CMAC" = "yes"
then
ENABLED_DIGEST="yes"
AM_CFLAGS="$AM_CFLAGS -DWE_HAVE_CMAC -DWE_HAVE_EVP_PKEY"
we_cmac_saved_CPPFLAGS="$CPPFLAGS"
AS_IF([test "$ENABLED_USERSETTINGS" = "yes"], [
CPPFLAGS="$CPPFLAGS -DWOLFENGINE_USER_SETTINGS -I$srcdir/include"
])
AC_CACHE_CHECK([whether wolfSSL declares wc_CmacFree],
[we_cv_cmac_free], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef WOLFENGINE_USER_SETTINGS
#include "user_settings.h"
#else
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/cmac.h>
]], [[
(void)&wc_CmacFree;
]])], [we_cv_cmac_free=yes], [we_cv_cmac_free=no])
])
AS_IF([test "$we_cv_cmac_free" = "no"], [
AC_DEFINE([WE_NO_CMAC_FREE], [1],
[wolfSSL does not provide the CMAC cleanup interface])
])
AC_CACHE_CHECK([whether wolfSSL CMAC keeps a buffered message],
[we_cv_cmac_buffered_state], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef WOLFENGINE_USER_SETTINGS
#include "user_settings.h"
#else
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/cmac.h>
#ifndef WOLFSSL_HASH_KEEP
#error CMAC message buffering is disabled
#endif
]], [[
Cmac cmac;
(void)sizeof(cmac.msg);
(void)sizeof(cmac.len);
]])], [we_cv_cmac_buffered_state=yes],
[we_cv_cmac_buffered_state=no])
])
AS_IF([test "$we_cv_cmac_buffered_state" = "yes"], [
AC_DEFINE([WE_CMAC_HAS_BUFFERED_STATE], [1],
[wolfSSL CMAC has an owned buffered message])
])
AC_CACHE_CHECK([whether wolfSSL AES direct encryption returns a status],
[we_cv_aes_direct_status], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef WOLFENGINE_USER_SETTINGS
#include "user_settings.h"
#else
#include <wolfssl/options.h>
#endif
#include <wolfssl/wolfcrypt/aes.h>
]], [[
(void)&wc_AesEncryptDirect;
return wc_AesEncryptDirect(NULL, NULL, NULL);
]])], [we_cv_aes_direct_status=yes], [we_cv_aes_direct_status=no])
])
AS_IF([test "$we_cv_aes_direct_status" = "no"], [
AC_DEFINE([WE_AES_DIRECT_RETURNS_VOID], [1],
[wolfSSL AES direct encryption has no return value])
])
CPPFLAGS="$we_cmac_saved_CPPFLAGS"
fi

AC_ARG_ENABLE([hmac],
Expand Down Expand Up @@ -670,6 +775,22 @@ AC_ARG_ENABLE([pbe],

if test "$ENABLED_PBE" = "yes"
then
AS_IF([test "$ENABLED_DYNAMIC_ENGINE" = "yes" &&
test "$we_cv_dladdr" != "yes"], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifndef _WIN32
#error Windows module pinning is unavailable
#endif
#include <windows.h>
]], [[
HMODULE module = NULL;
return GetModuleHandleExA(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
(LPCSTR)(const void *)&module, &module) == 0;
]])], [], [
AC_MSG_ERROR([dynamic PBE requires dladdr with Dl_info or Windows module pinning; use --disable-dynamic-engine for static engine loading])
])
])
AM_CFLAGS="$AM_CFLAGS -DWE_HAVE_PBE"
fi

Expand Down
27 changes: 15 additions & 12 deletions include/wolfengine/we_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#include <openssl/kdf.h>
#endif
#include <openssl/tls1.h>
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
#ifdef WE_HAVE_CMAC
#include <openssl/cmac.h>
#endif
#include <openssl/pkcs12.h>
Expand Down Expand Up @@ -132,24 +132,18 @@ WOLFENGINE_LOCAL void *we_memdup(const void *data, size_t siz);
#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
#endif /* WE_NO_OPENSSL_MALLOC */

#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
/* Function is a printf style function. Pretend parameter is string literal.
*
* @param s [in] Index of string literal. Index from 1.
* @param v [in] Index of first argument to check. 0 means don't.
*/
#define WE_PRINTF_FUNC(s, v) __attribute__((__format__ (__printf__, s, v)))
#else
#define WE_PRINTF_FUNC(s, v)
#endif

/*
* Global random
*/

extern WC_RNG* we_rng;
#ifndef WE_SINGLE_THREADED
extern wolfSSL_Mutex* we_rng_mutex;
WOLFENGINE_LOCAL int we_rng_mutex_is_initialized(void);
#endif
WOLFENGINE_LOCAL int we_rng_is_initialized(void);
#if defined(WE_HAVE_RANDOM) && !defined(WE_STATIC_WOLFSSL)
WOLFENGINE_LOCAL void we_rand_clear_seed(void);
#endif

WOLFENGINE_LOCAL int we_pkey_get_nids(const int** nids);
Expand Down Expand Up @@ -241,11 +235,14 @@ extern RAND_METHOD* we_random_method;

#ifdef WE_HAVE_HMAC

typedef int (*we_HmacInitCb)(Hmac*, void*, int);

extern EVP_PKEY_METHOD *we_hmac_pkey_method;
extern EVP_PKEY_ASN1_METHOD *we_hmac_pkey_asn1_method;

WOLFENGINE_LOCAL int we_init_hmac_pkey_meth(void);
WOLFENGINE_LOCAL int we_init_hmac_pkey_asn1_meth(void);
WOLFENGINE_LOCAL int we_hmac_pkey_init_ex(EVP_PKEY_CTX*, we_HmacInitCb);
WOLFENGINE_LOCAL int we_hmac_update(Hmac*, const void*, size_t);

#endif /* WE_HAVE_HMAC */
Expand All @@ -257,11 +254,13 @@ WOLFENGINE_LOCAL int we_hmac_update(Hmac*, const void*, size_t);
#ifdef WE_HAVE_CMAC

#define NID_wolfengine_cmac 101
extern EVP_CIPHER *we_cmac_ciph;
extern EVP_PKEY_METHOD *we_cmac_pkey_method;
extern EVP_PKEY_METHOD *we_cmac_we_pkey_method;
extern EVP_PKEY_ASN1_METHOD *we_cmac_pkey_asn1_method;
extern EVP_PKEY_ASN1_METHOD *we_cmac_we_pkey_asn1_method;

WOLFENGINE_LOCAL int we_init_cmac_cipher_meth(void);
WOLFENGINE_LOCAL int we_init_cmac_pkey_meth(void);
WOLFENGINE_LOCAL int we_init_cmac_pkey_asn1_meth(void);

Expand Down Expand Up @@ -354,9 +353,13 @@ WOLFENGINE_LOCAL int we_init_ec_key_meths(void);
*/

#ifdef WE_HAVE_PBE
WOLFENGINE_LOCAL int we_prepare_pbe_keygen(void);
WOLFENGINE_LOCAL int we_init_pbe_keygen(void);
WOLFENGINE_LOCAL int we_pbe_keygen_ready(void);
#endif

WOLFENGINE_LOCAL int wolfengine_bind(ENGINE *e, const char *id);
WOLFENGINE_LOCAL int we_engine_bind_available(void);
WOLFENGINE_LOCAL ENGINE *wolfengine_get_bound_engine(void);

#endif /* INTERNAL_H */
8 changes: 8 additions & 0 deletions include/wolfengine/we_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@

#include <wolfengine/we_visibility.h>

#if defined(__IAR_SYSTEMS_ICC__) || defined(__GNUC__)
/* Check printf-style format strings and their arguments. */
#define WE_PRINTF_FUNC(s, v) __attribute__((__format__ (__printf__, s, v)))
#else
#define WE_PRINTF_FUNC(s, v)
#endif

/* wolfEngine debug logging support can be compiled in by defining
* WOLFENGINE_DEBUG or by using the --enable-debug configure option.
*
Expand Down Expand Up @@ -137,6 +144,7 @@ void WOLFENGINE_LEAVE(int type, const char* msg, int ret);
WOLFENGINE_API
void WOLFENGINE_MSG(int type, const char* fmt, ...);
WOLFENGINE_LOCAL
WE_PRINTF_FUNC(2, 3)
void WOLFENGINE_MSG_VERBOSE(int type, const char* fmt, ...);
WOLFENGINE_API
void WOLFENGINE_ERROR_LINE(int type, int err, const char* file, int line);
Expand Down
9 changes: 9 additions & 0 deletions include/wolfengine/we_openssl_bc.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ WOLFENGINE_LOCAL
int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
const void *data,
size_t count));
WOLFENGINE_LOCAL
int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
const EVP_MD_CTX *from));
WOLFENGINE_LOCAL
int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
const EVP_MD_CTX *from);
WOLFENGINE_LOCAL
int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
unsigned char *md));
Expand All @@ -96,6 +102,9 @@ int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,
const unsigned char *iv,
int enc));
WOLFENGINE_LOCAL
int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,
int (*cleanup)(EVP_CIPHER_CTX *ctx));
WOLFENGINE_LOCAL
int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,
int (*do_cipher) (EVP_CIPHER_CTX *ctx,
unsigned char *out,
Expand Down
20 changes: 20 additions & 0 deletions openssl_patches/1.0.2h/tests/fips/dhtest_102h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/crypto/dh/dhtest.c b/crypto/dh/dhtest.c
--- a/crypto/dh/dhtest.c
+++ b/crypto/dh/dhtest.c
@@ -140,5 +140,13 @@
BN_GENCB_set(&_cb, &cb, out);
- if (((a = DH_new()) == NULL) || !DH_generate_parameters_ex(a, 1024,
- DH_GENERATOR_5,
- &_cb))
+ if ((a = DH_new()) == NULL)
+ goto err;
+ if (a->engine != e ||
+ DH_generate_parameters_ex(a, 1024, DH_GENERATOR_5, &_cb) != 0 ||
+ a->p != NULL || a->q != NULL || a->g != NULL || a->engine != e)
+ goto err;
+ BIO_puts(out, "Legacy DH parameter generation rejected in FIPS mode\n");
+ ERR_clear_error();
+ DH_free(a);
+ a = DH_get_2048_256();
+ if (a == NULL || a->engine != e)
goto err;
32 changes: 32 additions & 0 deletions openssl_patches/1.1.1b/tests/fips/dhtest_111b.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/test/dhtest.c b/test/dhtest.c
--- a/test/dhtest.c
+++ b/test/dhtest.c
@@ -25,4 +25,6 @@
static int cb(int p, int n, BN_GENCB *arg);
-
-
+
+extern ENGINE *e;
+
+
static const unsigned char dhtest_1024_p[] =
@@ -193,5 +193,17 @@
BN_GENCB_set(_cb, &cb, NULL);
if (!TEST_ptr(a = DH_new())
- || !TEST_true(DH_generate_parameters_ex(a, 1024,
- DH_GENERATOR_5, _cb)))
+ || !TEST_ptr_eq(DH_get0_engine(a), e)
+ || !TEST_int_eq(DH_generate_parameters_ex(a, 1024,
+ DH_GENERATOR_5, _cb), 0)
+ || !TEST_ptr_null(DH_get0_p(a))
+ || !TEST_ptr_null(DH_get0_q(a))
+ || !TEST_ptr_null(DH_get0_g(a))
+ || !TEST_ptr_eq(DH_get0_engine(a), e))
+ goto err3;
+ TEST_info("Legacy DH parameter generation rejected in FIPS mode");
+ ERR_clear_error();
+ DH_free(a);
+ a = NULL;
+ if (!TEST_ptr(a = DH_get_2048_256())
+ || !TEST_ptr_eq(DH_get0_engine(a), e))
goto err3;
Loading