Skip to content

Commit b8748aa

Browse files
committed
Add SHE (Secure Hardware Extension) support to wolfCrypt
1 parent a98cb45 commit b8748aa

16 files changed

Lines changed: 2306 additions & 1 deletion

File tree

.github/workflows/os-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
'--enable-dtls --enable-dtlscid --enable-dtls13 --enable-secure-renegotiation
4444
--enable-psk --enable-aesccm --enable-nullcipher
4545
CPPFLAGS=-DWOLFSSL_STATIC_RSA',
46+
'--enable-she --enable-cmac',
47+
'--enable-she --enable-cmac --enable-cryptocb --enable-cryptocbutils',
4648
'--enable-ascon --enable-experimental',
4749
'--enable-ascon CPPFLAGS=-DWOLFSSL_ASCON_UNROLL --enable-experimental',
4850
'--enable-all CPPFLAGS=''-DNO_AES_192 -DNO_AES_256'' ',

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ WOLFSSL_SE050_NO_TRNG
889889
WOLFSSL_SECURE_RENEGOTIATION_ON_BY_DEFAULT
890890
WOLFSSL_SERVER_EXAMPLE
891891
WOLFSSL_SETTINGS_FILE
892+
WOLFSSL_SHE
892893
WOLFSSL_SH224
893894
WOLFSSL_SHA256_ALT_CH_MAJ
894895
WOLFSSL_SHA512_HASHTYPE

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,6 +1600,20 @@ if(WOLFSSL_CMAC)
16001600
endif()
16011601
endif()
16021602

1603+
# SHE (Secure Hardware Extension) key update message generation
1604+
add_option("WOLFSSL_SHE"
1605+
"Enable SHE key update support (default: disabled)"
1606+
"no" "yes;no")
1607+
1608+
if(WOLFSSL_SHE)
1609+
if (NOT WOLFSSL_AES)
1610+
message(FATAL_ERROR "Cannot use SHE without AES.")
1611+
else()
1612+
list(APPEND WOLFSSL_DEFINITIONS
1613+
"-DWOLFSSL_SHE")
1614+
endif()
1615+
endif()
1616+
16031617
# TODO: - RC2
16041618
# - FIPS, again (there's more logic for FIPS in configure.ac)
16051619
# - Selftest
@@ -2776,6 +2790,7 @@ if(WOLFSSL_EXAMPLES)
27762790
tests/api/test_hash.c
27772791
tests/api/test_hmac.c
27782792
tests/api/test_cmac.c
2793+
tests/api/test_she.c
27792794
tests/api/test_des3.c
27802795
tests/api/test_chacha.c
27812796
tests/api/test_poly1305.c

configure.ac

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6014,6 +6014,15 @@ fi
60146014
AS_IF([test "x$ENABLED_CMAC" = "xyes"],
60156015
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
60166016

6017+
# SHE (Secure Hardware Extension) key update message generation
6018+
AC_ARG_ENABLE([she],
6019+
[AS_HELP_STRING([--enable-she],[Enable SHE key update support (default: disabled)])],
6020+
[ ENABLED_SHE=$enableval ],
6021+
[ ENABLED_SHE=no ]
6022+
)
6023+
6024+
AS_IF([test "x$ENABLED_SHE" = "xyes"],
6025+
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHE"])
60176026

60186027
# AES-XTS
60196028
AC_ARG_ENABLE([aesxts],
@@ -11402,6 +11411,7 @@ AM_CONDITIONAL([BUILD_FIPS_V6],[test $HAVE_FIPS_VERSION = 6])
1140211411
AM_CONDITIONAL([BUILD_FIPS_V6_PLUS],[test $HAVE_FIPS_VERSION -ge 6])
1140311412
AM_CONDITIONAL([BUILD_SIPHASH],[test "x$ENABLED_SIPHASH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1140411413
AM_CONDITIONAL([BUILD_CMAC],[test "x$ENABLED_CMAC" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
11414+
AM_CONDITIONAL([BUILD_SHE],[test "x$ENABLED_SHE" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1140511415
AM_CONDITIONAL([BUILD_SELFTEST],[test "x$ENABLED_SELFTEST" = "xyes"])
1140611416
AM_CONDITIONAL([BUILD_SHA224],[test "x$ENABLED_SHA224" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1140711417
AM_CONDITIONAL([BUILD_SHA3],[test "x$ENABLED_SHA3" != "xno" || test "x$ENABLED_USERSETTINGS" = "xyes"])

src/include.am

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ if BUILD_CMAC
159159
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/cmac.c
160160
endif
161161

162+
if BUILD_SHE
163+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/she.c
164+
endif
165+
162166
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/fips.c \
163167
wolfcrypt/src/fips_test.c
164168

@@ -424,6 +428,10 @@ if BUILD_CMAC
424428
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/cmac.c
425429
endif
426430

431+
if BUILD_SHE
432+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/she.c
433+
endif
434+
427435
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/fips.c \
428436
wolfcrypt/src/fips_test.c
429437

@@ -673,6 +681,10 @@ if BUILD_CMAC
673681
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/cmac.c
674682
endif
675683

684+
if BUILD_SHE
685+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/she.c
686+
endif
687+
676688
if BUILD_CURVE448
677689
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/curve448.c
678690
endif
@@ -1005,6 +1017,10 @@ if !BUILD_FIPS_V2_PLUS
10051017
if BUILD_CMAC
10061018
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/cmac.c
10071019
endif
1020+
1021+
if BUILD_SHE
1022+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/she.c
1023+
endif
10081024
endif !BUILD_FIPS_V2_PLUS
10091025

10101026
if !BUILD_FIPS_V2

tests/api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
#include <tests/api/test_hash.h>
184184
#include <tests/api/test_hmac.h>
185185
#include <tests/api/test_cmac.h>
186+
#include <tests/api/test_she.h>
186187
#include <tests/api/test_des3.h>
187188
#include <tests/api/test_chacha.h>
188189
#include <tests/api/test_poly1305.h>
@@ -33840,6 +33841,11 @@ TEST_CASE testCases[] = {
3384033841
TEST_HMAC_DECLS,
3384133842
/* CMAC */
3384233843
TEST_CMAC_DECLS,
33844+
/* SHE */
33845+
TEST_SHE_DECLS,
33846+
#ifdef WOLF_CRYPTO_CB
33847+
TEST_SHE_CB_DECLS,
33848+
#endif
3384333849

3384433850
/* Cipher */
3384533851
/* Triple-DES */

tests/api/include.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ tests_unit_test_SOURCES += tests/api/test_hash.c
1818
# MAC
1919
tests_unit_test_SOURCES += tests/api/test_hmac.c
2020
tests_unit_test_SOURCES += tests/api/test_cmac.c
21+
# SHE
22+
tests_unit_test_SOURCES += tests/api/test_she.c
2123
# Cipher
2224
tests_unit_test_SOURCES += tests/api/test_des3.c
2325
tests_unit_test_SOURCES += tests/api/test_chacha.c
@@ -124,6 +126,7 @@ EXTRA_DIST += tests/api/test_digest.h
124126
EXTRA_DIST += tests/api/test_hash.h
125127
EXTRA_DIST += tests/api/test_hmac.h
126128
EXTRA_DIST += tests/api/test_cmac.h
129+
EXTRA_DIST += tests/api/test_she.h
127130
EXTRA_DIST += tests/api/test_des3.h
128131
EXTRA_DIST += tests/api/test_chacha.h
129132
EXTRA_DIST += tests/api/test_poly1305.h

0 commit comments

Comments
 (0)