Skip to content

Commit ee7fe9e

Browse files
committed
SHE API: remove key storage from context, add direct output params
1 parent 8c0999a commit ee7fe9e

12 files changed

Lines changed: 1039 additions & 933 deletions

File tree

.github/workflows/os-check.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ jobs:
4242
'--enable-dtls --enable-dtlscid --enable-dtls13 --enable-secure-renegotiation
4343
--enable-psk --enable-aesccm --enable-nullcipher
4444
CPPFLAGS=-DWOLFSSL_STATIC_RSA',
45-
'--enable-she --enable-cmac',
46-
'--enable-she --enable-cmac --enable-cryptocb --enable-cryptocbutils',
45+
'--enable-she=standard --enable-cmac',
46+
'--enable-she=extended --enable-cmac --enable-cryptocb --enable-cryptocbutils',
47+
'--enable-she=standard --enable-cmac CPPFLAGS=''-DNO_WC_SHE_IMPORT_M123'' ',
48+
'--enable-she=extended --enable-cmac --enable-cryptocb --enable-cryptocbutils
49+
CPPFLAGS=''-DNO_WC_SHE_GETUID -DNO_WC_SHE_GETCOUNTER -DNO_WC_SHE_EXPORTKEY'' ',
4750
'--enable-all CPPFLAGS=''-DNO_AES_192 -DNO_AES_256'' ',
4851
'--enable-sniffer --enable-curve25519 --enable-curve448 --enable-enckeys
4952
CPPFLAGS=-DWOLFSSL_DH_EXTRA',

.wolfssl_known_macro_extras

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ NO_TKERNEL_MEM_POOL
446446
NO_TLSX_PSKKEM_PLAIN_ANNOUNCE
447447
NO_VERIFY_OID
448448
NO_WC_DHGENERATEPUBLIC
449+
NO_WC_SHE_EXPORTKEY
450+
NO_WC_SHE_GETCOUNTER
451+
NO_WC_SHE_GETUID
452+
NO_WC_SHE_IMPORT_M123
449453
NO_WC_SSIZE_TYPE
450454
NO_WOLFSSL_ALLOC_ALIGN
451455
NO_WOLFSSL_AUTOSAR_CRYIF
@@ -889,6 +893,7 @@ WOLFSSL_SECURE_RENEGOTIATION_ON_BY_DEFAULT
889893
WOLFSSL_SERVER_EXAMPLE
890894
WOLFSSL_SETTINGS_FILE
891895
WOLFSSL_SHE
896+
WOLFSSL_SHE_EXTENDED
892897
WOLFSSL_SH224
893898
WOLFSSL_SHA256_ALT_CH_MAJ
894899
WOLFSSL_SHA512_HASHTYPE

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,11 +1641,12 @@ if(WOLFSSL_CMAC)
16411641
endif()
16421642

16431643
# SHE (Secure Hardware Extension) key update message generation
1644+
# standard: core SHE support, extended: adds custom KDF/header overrides
16441645
add_option("WOLFSSL_SHE"
1645-
"Enable SHE key update support (default: disabled)"
1646-
"no" "yes;no")
1646+
"Enable SHE key update support (standard|extended|no)"
1647+
"no" "standard;extended;no")
16471648

1648-
if(WOLFSSL_SHE)
1649+
if(WOLFSSL_SHE STREQUAL "standard" OR WOLFSSL_SHE STREQUAL "extended")
16491650
if (NOT WOLFSSL_AES)
16501651
message(FATAL_ERROR "Cannot use SHE without AES.")
16511652
else()
@@ -1654,6 +1655,11 @@ if(WOLFSSL_SHE)
16541655
endif()
16551656
endif()
16561657

1658+
if(WOLFSSL_SHE STREQUAL "extended")
1659+
list(APPEND WOLFSSL_DEFINITIONS
1660+
"-DWOLFSSL_SHE_EXTENDED")
1661+
endif()
1662+
16571663
# TODO: - RC2
16581664
# - FIPS, again (there's more logic for FIPS in configure.ac)
16591665
# - Selftest

configure.ac

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5946,14 +5946,24 @@ AS_IF([test "x$ENABLED_CMAC" = "xyes"],
59465946
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
59475947

59485948
# SHE (Secure Hardware Extension) key update message generation
5949+
# --enable-she=standard: standard SHE support
5950+
# --enable-she=extended: standard + extended overrides (custom KDF/headers)
59495951
AC_ARG_ENABLE([she],
5950-
[AS_HELP_STRING([--enable-she],[Enable SHE key update support (default: disabled)])],
5952+
[AS_HELP_STRING([--enable-she@<:@=standard|extended@:>@],
5953+
[Enable SHE key update support (default: disabled)])],
59515954
[ ENABLED_SHE=$enableval ],
59525955
[ ENABLED_SHE=no ]
59535956
)
59545957

5955-
AS_IF([test "x$ENABLED_SHE" = "xyes"],
5956-
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHE"])
5958+
if test "x$ENABLED_SHE" = "xstandard" || test "x$ENABLED_SHE" = "xextended"
5959+
then
5960+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHE"
5961+
fi
5962+
5963+
if test "x$ENABLED_SHE" = "xextended"
5964+
then
5965+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHE_EXTENDED"
5966+
fi
59575967

59585968
# AES-XTS
59595969
AC_ARG_ENABLE([aesxts],
@@ -11564,7 +11574,7 @@ AM_CONDITIONAL([BUILD_FIPS_V6],[test $HAVE_FIPS_VERSION = 6])
1156411574
AM_CONDITIONAL([BUILD_FIPS_V6_PLUS],[test $HAVE_FIPS_VERSION -ge 6])
1156511575
AM_CONDITIONAL([BUILD_SIPHASH],[test "x$ENABLED_SIPHASH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1156611576
AM_CONDITIONAL([BUILD_CMAC],[test "x$ENABLED_CMAC" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
11567-
AM_CONDITIONAL([BUILD_SHE],[test "x$ENABLED_SHE" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
11577+
AM_CONDITIONAL([BUILD_SHE],[test "x$ENABLED_SHE" = "xstandard" || test "x$ENABLED_SHE" = "xextended" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1156811578
AM_CONDITIONAL([BUILD_SELFTEST],[test "x$ENABLED_SELFTEST" = "xyes"])
1156911579
AM_CONDITIONAL([BUILD_SHA224],[test "x$ENABLED_SHA224" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1157011580
AM_CONDITIONAL([BUILD_SHA3],[test "x$ENABLED_SHA3" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])

tests/api.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35638,6 +35638,9 @@ TEST_CASE testCases[] = {
3563835638
TEST_CMAC_DECLS,
3563935639
/* SHE */
3564035640
TEST_SHE_DECLS,
35641+
#ifdef WOLFSSL_SHE_EXTENDED
35642+
TEST_SHE_EXT_DECLS,
35643+
#endif
3564135644
#if defined(WOLF_CRYPTO_CB) && defined(WOLFSSL_SHE)
3564235645
TEST_SHE_CB_DECLS,
3564335646
#endif

0 commit comments

Comments
 (0)