Skip to content

Commit 0d0d2cf

Browse files
authored
Merge pull request #6531 from bandi13/extraCMakeOptions
Extra c make options
2 parents e0fa25e + 155ce9a commit 0d0d2cf

3 files changed

Lines changed: 46 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,42 @@ if(WOLFSSL_AESKEYWRAP)
17741774
)
17751775
endif()
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

17781814
if(WOLFSSL_KEYGEN)
17791815
list(APPEND WOLFSSL_DEFINITIONS "-DWOLFSSL_KEY_GEN")

cmake/functions.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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)
309312
endfunction()
@@ -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)
914921
endfunction()
915922

wolfcrypt/test/test.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)