File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1774,6 +1774,42 @@ if(WOLFSSL_AESKEYWRAP)
17741774 )
17751775endif ()
17761776
1777+ # Hybrid Public Key Encryption (RFC9180)
1778+ add_option ("WOLFSSL_HPKE"
1779+ "Enable wolfSSL hybrid public key encryption (default: disabled)"
1780+ "no" "yes;no" )
1781+
1782+ # Encrypted Client Hello (ECH)
1783+ add_option ("WOLFSSL_ECH"
1784+ "Enable wolfSSL encrypted client hello (default: disabled)"
1785+ "no" "yes;no" )
1786+
1787+ # Keying Material Exporter / TLS Exporter
1788+ add_option ("WOLFSSL_KEYING_MATERIAL"
1789+ "Enable wolfSSL keying material export (default: disabled)"
1790+ "no" "yes;no" )
1791+
1792+ if (WOLFSSL_HPKE)
1793+ if (NOT WOLFSSL_ECC)
1794+ message (FATAL_ERROR "HPKE supported only with ECC (WOLFSSL_ECC)" )
1795+ endif ()
1796+ list (APPEND WOLFSSL_DEFINITIONS "-DHAVE_HPKE" )
1797+ override_cache (WOLFSSL_HKDF "yes" )
1798+ endif ()
1799+
1800+ if (WOLFSSL_ECH)
1801+ if (NOT WOLFSSL_HPKE)
1802+ message (FATAL_ERROR "ECH supported only with HPKE (WOLFSSL_HPKE)" )
1803+ endif ()
1804+ if (NOT WOLFSSL_SNI)
1805+ message (FATAL_ERROR "ECH supported only with SNI (WOLFSSL_SNI)" )
1806+ endif ()
1807+ list (APPEND WOLFSSL_DEFINITIONS "-DHAVE_ECH" )
1808+ endif ()
1809+
1810+ if (WOLFSSL_KEYING_MATERIAL)
1811+ list (APPEND WOLFSSL_DEFINITIONS "-DHAVE_KEYING_MATERIAL" )
1812+ endif ()
17771813
17781814if (WOLFSSL_KEYGEN)
17791815 list (APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_KEY_GEN" )
Original file line number Diff line number Diff line change @@ -304,6 +304,9 @@ function(generate_build_flags)
304304 if (WOLFSSL_CAAM)
305305 set (BUILD_CAAM "yes" PARENT_SCOPE )
306306 endif ()
307+ if (WOLFSSL_HPKE OR WOLFSSL_USER_SETTINGS)
308+ set (BUILD_HPKE "yes" PARENT_SCOPE )
309+ endif ()
307310
308311 set (BUILD_FLAGS_GENERATED "yes" PARENT_SCOPE )
309312endfunction ()
@@ -910,6 +913,10 @@ function(generate_lib_src_list LIB_SOURCES)
910913 wolfcrypt/src/port/caam/wolfcaam_hmac.c)
911914 endif ()
912915
916+ if (BUILD_HPKE)
917+ list (APPEND LIB_SOURCES wolfcrypt/src/hpke.c)
918+ endif ()
919+
913920 set (LIB_SOURCES ${LIB_SOURCES} PARENT_SCOPE )
914921endfunction ()
915922
Original file line number Diff line number Diff line change @@ -23255,10 +23255,10 @@ static wc_test_ret_t hpke_test_single(Hpke* hpke)
2325523255 void* receiverKey = NULL;
2325623256 void* ephemeralKey = NULL;
2325723257#ifdef WOLFSSL_SMALL_STACK
23258- uint8_t *pubKey = NULL; /* public key */
23258+ byte *pubKey = NULL; /* public key */
2325923259 word16 pubKeySz = (word16)HPKE_Npk_MAX;
2326023260#else
23261- uint8_t pubKey[HPKE_Npk_MAX]; /* public key */
23261+ byte pubKey[HPKE_Npk_MAX]; /* public key */
2326223262 word16 pubKeySz = (word16)sizeof(pubKey);
2326323263#endif
2326423264
@@ -23269,7 +23269,7 @@ static wc_test_ret_t hpke_test_single(Hpke* hpke)
2326923269
2327023270#ifdef WOLFSSL_SMALL_STACK
2327123271 if (ret == 0) {
23272- pubKey = (uint8_t *)XMALLOC(pubKeySz, HEAP_HINT,
23272+ pubKey = (byte *)XMALLOC(pubKeySz, HEAP_HINT,
2327323273 DYNAMIC_TYPE_TMP_BUFFER);
2327423274 if (pubKey == NULL)
2327523275 ret = MEMORY_E;
You can’t perform that action at this time.
0 commit comments