Skip to content

Commit 992dfec

Browse files
Merge branch 'master' of https://github.com/wolfSSL/wolfssl into zd19563_4
2 parents 0efc811 + 56524a3 commit 992dfec

49 files changed

Lines changed: 5783 additions & 1051 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/os-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
'--disable-sys-ca-certs',
6161
'--enable-all CPPFLAGS=-DWOLFSSL_DEBUG_CERTS ',
6262
'--enable-all CFLAGS="-DWOLFSSL_CHECK_MEM_ZERO"',
63+
'--enable-coding=no',
6364
]
6465
name: make check
6566
if: github.repository_owner == 'wolfssl'

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ WOLFSSL_ECDHX_SHARED_NOT_ZERO
707707
WOLFSSL_ECDSA_MATCH_HASH
708708
WOLFSSL_ECDSA_SET_K_ONE_LOOP
709709
WOLFSSL_EC_POINT_CMP_JACOBIAN
710+
WOLFSSL_ED448_NO_LARGE_CODE
710711
WOLFSSL_EDDSA_CHECK_PRIV_ON_SIGN
711712
WOLFSSL_EMNET
712713
WOLFSSL_ESPWROOM32

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ set(WOLFSSL_DEFINITIONS)
6666
set(WOLFSSL_LINK_LIBS)
6767
set(WOLFSSL_INCLUDE_DIRS)
6868

69+
# Initialize pkg-config private variables
70+
set(PC_LIBS_PRIVATE "")
71+
6972
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
7073
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/functions.cmake)
7174

@@ -2969,6 +2972,16 @@ if(WOLFSSL_INSTALL)
29692972
endif()
29702973
endif()
29712974

2975+
# Add required frameworks for static linking on Apple platforms
2976+
if(APPLE AND NOT BUILD_SHARED_LIBS)
2977+
if(WOLFSSL_SYS_CA_CERTS)
2978+
list(APPEND PC_LIBS_PRIVATE "-framework CoreFoundation" "-framework Security")
2979+
endif()
2980+
endif()
2981+
2982+
# Convert lists to space-separated strings for pkg-config
2983+
string(JOIN " " PC_LIBS_PRIVATE ${PC_LIBS_PRIVATE})
2984+
29722985
configure_file(support/wolfssl.pc.in ${CMAKE_CURRENT_BINARY_DIR}/support/wolfssl.pc @ONLY)
29732986
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/support/wolfssl.pc
29742987
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

configure.ac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET"
200200
DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
201201
LIB_ADD=
202202
LIB_STATIC_ADD=
203+
PC_LIBS_PRIVATE=""
203204

204205
OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS $EXTRA_OPTS_CFLAGS"
205206
OPTIMIZE_FAST_CFLAGS="$OPTIMIZE_FAST_CFLAGS $EXTRA_OPTS_CFLAGS"
@@ -8247,12 +8248,18 @@ then
82478248
fi
82488249
elif test "$ENABLED_CURL" = "tiny"
82498250
then
8251+
# basic config to support tiny-curl.
8252+
# OPENSSL_EXTRA_X509_SMALL is sufficient.
82508253
if test "x$ENABLED_OPENSSLEXTRA" = "xno"
82518254
then
82528255
ENABLED_OPENSSLEXTRA="x509small"
82538256
fi
82548257
8258+
# expose a bit more compat API without full OPENSSL_EXTRA.
82558259
AM_CFLAGS="$AM_CFLAGS -DHAVE_CURL"
8260+
8261+
# session cache is necessary, but can be small or micro.
8262+
AM_CFLAGS="$AM_CFLAGS -DSMALL_SESSION_CACHE"
82568263
fi
82578264
82588265
if test "$ENABLED_PSK" = "no" && test "$ENABLED_LEANPSK" = "no" \
@@ -10696,6 +10703,13 @@ case $host_os in
1069610703
MINGW_LIB_WARNING="yes"
1069710704
fi
1069810705
fi ;;
10706+
*darwin*)
10707+
# Add required frameworks for static linking on macOS
10708+
if test "$enable_shared" = "no"; then
10709+
if test "x$ENABLED_SYS_CA_CERTS" = "xyes"; then
10710+
PC_LIBS_PRIVATE="$PC_LIBS_PRIVATE -framework CoreFoundation -framework Security"
10711+
fi
10712+
fi ;;
1069910713
esac
1070010714
1070110715
if test "$enable_shared" = "no"; then
@@ -11003,6 +11017,7 @@ AC_SUBST([AM_CCASFLAGS])
1100311017
AC_SUBST([LIB_ADD])
1100411018
AC_SUBST([LIB_STATIC_ADD])
1100511019
AC_SUBST([LIBM])
11020+
AC_SUBST([PC_LIBS_PRIVATE])
1100611021
1100711022
# FINAL
1100811023
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])

doc/dox_comments/header_files/ed25519.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ int wc_ed25519_import_private_key_ex(const byte* priv, word32 privSz,
767767
/*!
768768
\ingroup ED25519
769769
770-
\brief This function exports the private key from an ed25519_key
770+
\brief This function exports the public key from an ed25519_key
771771
structure. It stores the public key in the buffer out, and sets the bytes
772772
written to this buffer in outLen.
773773

doc/dox_comments/header_files/ssl.h

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15257,6 +15257,239 @@ RFC 9146 and RFC 9147.
1525715257
const unsigned char* wolfSSL_dtls_cid_parse(const unsigned char* msg,
1525815258
unsigned int msgSz, unsigned int cidSz);
1525915259

15260+
/*!
15261+
\ingroup TLS
15262+
\brief On the server, this sets a list of CA names to be sent to clients in
15263+
certificate requests as a hint for which CA's are supported by the server.
15264+
15265+
On the client, this function has no effect.
15266+
15267+
\param [in] ctx Pointer to the wolfSSL context
15268+
\param [in] names List of names to be set
15269+
15270+
\sa wolfSSL_set_client_CA_list
15271+
\sa wolfSSL_CTX_get_client_CA_list
15272+
\sa wolfSSL_get_client_CA_list
15273+
\sa wolfSSL_CTX_set0_CA_list
15274+
\sa wolfSSL_set0_CA_list
15275+
\sa wolfSSL_CTX_get0_CA_list
15276+
\sa wolfSSL_get0_CA_list
15277+
\sa wolfSSL_get0_peer_CA_list
15278+
*/
15279+
void wolfSSL_CTX_set_client_CA_list(WOLFSSL_CTX* ctx,
15280+
WOLF_STACK_OF(WOLFSSL_X509_NAME)* names);
15281+
15282+
/*!
15283+
\ingroup TLS
15284+
\brief This retrieves the list previously set via
15285+
wolfSSL_CTX_set_client_CA_list, or NULL if no list has been set.
15286+
15287+
\param [in] ctx Pointer to the wolfSSL context
15288+
\return A stack of WOLFSSL_X509_NAMEs containing the CA names
15289+
15290+
\sa wolfSSL_set_client_CA_list
15291+
\sa wolfSSL_CTX_set_client_CA_list
15292+
\sa wolfSSL_get_client_CA_list
15293+
\sa wolfSSL_CTX_set0_CA_list
15294+
\sa wolfSSL_set0_CA_list
15295+
\sa wolfSSL_CTX_get0_CA_list
15296+
\sa wolfSSL_get0_CA_list
15297+
\sa wolfSSL_get0_peer_CA_list
15298+
*/
15299+
WOLFSSL_STACK *wolfSSL_CTX_get_client_CA_list(
15300+
const WOLFSSL_CTX *ctx);
15301+
15302+
/*!
15303+
\ingroup TLS
15304+
\brief Same as wolfSSL_CTX_set_client_CA_list, but specific to a session.
15305+
If a CA list is set on both the context and the session, the list on the
15306+
session is used.
15307+
15308+
\param [in] ssl Pointer to the WOLFSSL object
15309+
\param [in] names List of names to be set.
15310+
15311+
\sa wolfSSL_CTX_set_client_CA_list
15312+
\sa wolfSSL_CTX_get_client_CA_list
15313+
\sa wolfSSL_get_client_CA_list
15314+
\sa wolfSSL_CTX_set0_CA_list
15315+
\sa wolfSSL_set0_CA_list
15316+
\sa wolfSSL_CTX_get0_CA_list
15317+
\sa wolfSSL_get0_CA_list
15318+
\sa wolfSSL_get0_peer_CA_list
15319+
*/
15320+
void wolfSSL_set_client_CA_list(WOLFSSL* ssl,
15321+
WOLF_STACK_OF(WOLFSSL_X509_NAME)* names);
15322+
15323+
/*!
15324+
\ingroup TLS
15325+
\brief On the server, this retrieves the list previously set via
15326+
wolfSSL_set_client_CA_list. If none was set, returns the list previously
15327+
set via wolfSSL_CTX_set_client_CA_list. If no list at all was set, returns
15328+
NULL.
15329+
15330+
On the client, this retrieves the list that was received from the server,
15331+
or NULL if none was received. wolfSSL_CTX_set_cert_cb can be used to
15332+
register a callback to dynamically load certificates when a certificate
15333+
request is received from the server.
15334+
15335+
\param [in] ssl Pointer to the WOLFSSL object
15336+
\return A stack of WOLFSSL_X509_NAMEs containing the CA names
15337+
15338+
\sa wolfSSL_CTX_set_cert_cb
15339+
\sa wolfSSL_CTX_set_client_CA_list
15340+
\sa wolfSSL_CTX_get_client_CA_list
15341+
\sa wolfSSL_get_client_CA_list
15342+
\sa wolfSSL_CTX_set0_CA_list
15343+
\sa wolfSSL_set0_CA_list
15344+
\sa wolfSSL_CTX_get0_CA_list
15345+
\sa wolfSSL_get0_CA_list
15346+
\sa wolfSSL_get0_peer_CA_list
15347+
*/
15348+
WOLFSSL_STACK* wolfSSL_get_client_CA_list(
15349+
const WOLFSSL* ssl);
15350+
15351+
/*!
15352+
\ingroup TLS
15353+
\brief This function sets a list of CA names to be sent to the peer as a
15354+
hint for which CA's are supported for its authentication.
15355+
15356+
In TLS >= 1.3, this is supported in both directions between the client and
15357+
the server. On the server, the CA names will be sent as part of a
15358+
CertificateRequest, making this function an equivalent of *_set_client_CA_list;
15359+
on the client, these are sent as part of ClientHello.
15360+
15361+
In TLS < 1.3, sending CA names from the client to the server is not
15362+
supported, therefore this function is equivalent to
15363+
wolfSSL_CTX_set_client_CA_list.
15364+
15365+
Note that the lists set via *_set_client_CA_list and *_set0_CA_list are
15366+
separate internally, i.e. calling *_get_client_CA_list will not retrieve a
15367+
list set via *_set0_CA_list and vice versa. If both are set, the server will
15368+
ignore *_set0_CA_list when sending CA names to the client.
15369+
15370+
\param [in] ctx Pointer to the wolfSSL context
15371+
\param [in] names List of names to be set
15372+
15373+
\sa wolfSSL_CTX_set_client_CA_list
15374+
\sa wolfSSL_set_client_CA_list
15375+
\sa wolfSSL_CTX_get_client_CA_list
15376+
\sa wolfSSL_get_client_CA_list
15377+
\sa wolfSSL_set0_CA_list
15378+
\sa wolfSSL_CTX_get0_CA_list
15379+
\sa wolfSSL_get0_CA_list
15380+
\sa wolfSSL_get0_peer_CA_list
15381+
*/
15382+
void wolfSSL_CTX_set0_CA_list(WOLFSSL_CTX *ctx,
15383+
WOLF_STACK_OF(WOLFSSL_X509_NAME)* names);
15384+
15385+
/*!
15386+
\ingroup TLS
15387+
\brief This retrieves the list previously set via
15388+
wolfSSL_CTX_set0_CA_list, or NULL if no list has been set.
15389+
15390+
\param [in] ctx Pointer to the wolfSSL context
15391+
\return A stack of WOLFSSL_X509_NAMEs containing the CA names
15392+
15393+
\sa wolfSSL_CTX_set_client_CA_list
15394+
\sa wolfSSL_set_client_CA_list
15395+
\sa wolfSSL_CTX_get_client_CA_list
15396+
\sa wolfSSL_get_client_CA_list
15397+
\sa wolfSSL_CTX_set0_CA_list
15398+
\sa wolfSSL_set0_CA_list
15399+
\sa wolfSSL_get0_CA_list
15400+
\sa wolfSSL_get0_peer_CA_list
15401+
*/
15402+
WOLFSSL_STACK *wolfSSL_CTX_get0_CA_list(
15403+
const WOLFSSL_CTX *ctx);
15404+
15405+
/*!
15406+
\ingroup TLS
15407+
\brief Same as wolfSSL_CTX_set0_CA_list, but specific to a session.
15408+
If a CA list is set on both the context and the session, the list on the
15409+
session is used.
15410+
15411+
\param [in] ssl Pointer to the WOLFSSL object
15412+
\param [in] names List of names to be set.
15413+
15414+
\sa wolfSSL_CTX_set_client_CA_list
15415+
\sa wolfSSL_set_client_CA_list
15416+
\sa wolfSSL_CTX_get_client_CA_list
15417+
\sa wolfSSL_get_client_CA_list
15418+
\sa wolfSSL_CTX_set0_CA_list
15419+
\sa wolfSSL_CTX_get0_CA_list
15420+
\sa wolfSSL_get0_CA_list
15421+
\sa wolfSSL_get0_peer_CA_list
15422+
*/
15423+
void wolfSSL_set0_CA_list(WOLFSSL *ssl,
15424+
WOLF_STACK_OF(WOLFSSL_X509_NAME) *names);
15425+
15426+
/*!
15427+
\ingroup TLS
15428+
\brief This retrieves the list previously set via wolfSSL_set0_CA_list. If
15429+
none was set, returns the list previously set via
15430+
wolfSSL_CTX_set0_CA_list. If no list at all was set, returns NULL.
15431+
15432+
\param [in] ssl Pointer to the WOLFSSL object
15433+
\return A stack of WOLFSSL_X509_NAMEs containing the CA names
15434+
15435+
\sa wolfSSL_CTX_set_client_CA_list
15436+
\sa wolfSSL_set_client_CA_list
15437+
\sa wolfSSL_CTX_get_client_CA_list
15438+
\sa wolfSSL_get_client_CA_list
15439+
\sa wolfSSL_CTX_set0_CA_list
15440+
\sa wolfSSL_set0_CA_list
15441+
\sa wolfSSL_CTX_get0_CA_list
15442+
\sa wolfSSL_get0_peer_CA_list
15443+
*/
15444+
WOLFSSL_STACK *wolfSSL_get0_CA_list(
15445+
const WOLFSSL *ssl);
15446+
15447+
/*!
15448+
\ingroup TLS
15449+
\brief This returns the CA list received from the peer.
15450+
15451+
On the client, this is the list sent by the server in a CertificateRequest,
15452+
and this function is equivalent to wolfSSL_get_client_CA_list.
15453+
15454+
On the server, this is the list sent by the client in the ClientHello message
15455+
in TLS >= 1.3; in TLS < 1.3, the function always returns NULL on the server
15456+
side.
15457+
15458+
wolfSSL_CTX_set_cert_cb can be used to register a callback to dynamically
15459+
load certificates when a CA list is received from the peer.
15460+
15461+
\param [in] ssl Pointer to the WOLFSSL object
15462+
\return A stack of WOLFSSL_X509_NAMEs containing the CA names
15463+
15464+
\sa wolfSSL_CTX_set_cert_cb
15465+
\sa wolfSSL_CTX_set_client_CA_list
15466+
\sa wolfSSL_set_client_CA_list
15467+
\sa wolfSSL_CTX_get_client_CA_list
15468+
\sa wolfSSL_get_client_CA_list
15469+
\sa wolfSSL_CTX_set0_CA_list
15470+
\sa wolfSSL_set0_CA_list
15471+
\sa wolfSSL_CTX_get0_CA_list
15472+
\sa wolfSSL_get0_CA_list
15473+
*/
15474+
WOLFSSL_STACK *wolfSSL_get0_peer_CA_list(const WOLFSSL *ssl);
15475+
15476+
/*!
15477+
\ingroup TLS
15478+
\brief This function sets a callback that will be called whenever a
15479+
certificate is about to be used, to allow the application to inspect, set
15480+
or clear any certificates, for example to react to a CA list sent from the
15481+
peer.
15482+
15483+
\param [in] ctx Pointer to the wolfSSL context
15484+
\param [in] cb Function pointer to the callback
15485+
\param [in] arg Pointer that will be passed to the callback
15486+
15487+
\sa wolfSSL_get0_peer_CA_list
15488+
\sa wolfSSL_get_client_CA_list
15489+
*/
15490+
void wolfSSL_CTX_set_cert_cb(WOLFSSL_CTX* ctx,
15491+
int (*cb)(WOLFSSL *, void *), void *arg);
15492+
1526015493
/*!
1526115494
\ingroup TLS
1526215495

examples/client/client.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
22212221
#ifdef HAVE_RPK
22222222
int useRPK = 0;
22232223
#endif /* HAVE_RPK */
2224+
#ifdef WOLFSSL_PEM_TO_DER
22242225
int fileFormat = WOLFSSL_FILETYPE_PEM;
2226+
#else
2227+
int fileFormat = WOLFSSL_FILETYPE_ASN1;
2228+
#endif
22252229
#if defined(WOLFSSL_SYS_CRYPTO_POLICY)
22262230
const char * policy = NULL;
22272231
#endif /* WOLFSSL_SYS_CRYPTO_POLICY */

0 commit comments

Comments
 (0)