Skip to content

Commit eeedc47

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

16 files changed

Lines changed: 2307 additions & 1 deletion

File tree

.github/workflows/os-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ 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',
4547
'--enable-all CPPFLAGS=''-DNO_AES_192 -DNO_AES_256'' ',
4648
'--enable-sniffer --enable-curve25519 --enable-curve448 --enable-enckeys
4749
CPPFLAGS=-DWOLFSSL_DH_EXTRA',

.wolfssl_known_macro_extras

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ WOLFSSL_SE050_NO_TRNG
888888
WOLFSSL_SECURE_RENEGOTIATION_ON_BY_DEFAULT
889889
WOLFSSL_SERVER_EXAMPLE
890890
WOLFSSL_SETTINGS_FILE
891+
WOLFSSL_SHE
892+
WOLFSSL_SH224
891893
WOLFSSL_SHA256_ALT_CH_MAJ
892894
WOLFSSL_SHA512_HASHTYPE
893895
WOLFSSL_SHUTDOWNONCE

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,20 @@ if(WOLFSSL_CMAC)
16401640
endif()
16411641
endif()
16421642

1643+
# SHE (Secure Hardware Extension) key update message generation
1644+
add_option("WOLFSSL_SHE"
1645+
"Enable SHE key update support (default: disabled)"
1646+
"no" "yes;no")
1647+
1648+
if(WOLFSSL_SHE)
1649+
if (NOT WOLFSSL_AES)
1650+
message(FATAL_ERROR "Cannot use SHE without AES.")
1651+
else()
1652+
list(APPEND WOLFSSL_DEFINITIONS
1653+
"-DWOLFSSL_SHE")
1654+
endif()
1655+
endif()
1656+
16431657
# TODO: - RC2
16441658
# - FIPS, again (there's more logic for FIPS in configure.ac)
16451659
# - Selftest
@@ -2816,6 +2830,7 @@ if(WOLFSSL_EXAMPLES)
28162830
tests/api/test_hash.c
28172831
tests/api/test_hmac.c
28182832
tests/api/test_cmac.c
2833+
tests/api/test_she.c
28192834
tests/api/test_des3.c
28202835
tests/api/test_chacha.c
28212836
tests/api/test_poly1305.c

configure.ac

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

5948+
# SHE (Secure Hardware Extension) key update message generation
5949+
AC_ARG_ENABLE([she],
5950+
[AS_HELP_STRING([--enable-she],[Enable SHE key update support (default: disabled)])],
5951+
[ ENABLED_SHE=$enableval ],
5952+
[ ENABLED_SHE=no ]
5953+
)
5954+
5955+
AS_IF([test "x$ENABLED_SHE" = "xyes"],
5956+
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHE"])
59485957

59495958
# AES-XTS
59505959
AC_ARG_ENABLE([aesxts],
@@ -11555,6 +11564,7 @@ AM_CONDITIONAL([BUILD_FIPS_V6],[test $HAVE_FIPS_VERSION = 6])
1155511564
AM_CONDITIONAL([BUILD_FIPS_V6_PLUS],[test $HAVE_FIPS_VERSION -ge 6])
1155611565
AM_CONDITIONAL([BUILD_SIPHASH],[test "x$ENABLED_SIPHASH" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1155711566
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"])
1155811568
AM_CONDITIONAL([BUILD_SELFTEST],[test "x$ENABLED_SELFTEST" = "xyes"])
1155911569
AM_CONDITIONAL([BUILD_SHA224],[test "x$ENABLED_SHA224" = "xyes" || test "x$ENABLED_USERSETTINGS" = "xyes"])
1156011570
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

@@ -677,6 +685,10 @@ if BUILD_CMAC
677685
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/cmac.c
678686
endif
679687

688+
if BUILD_SHE
689+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/she.c
690+
endif
691+
680692
if BUILD_CURVE448
681693
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/curve448.c
682694
endif
@@ -1009,6 +1021,10 @@ if !BUILD_FIPS_V2_PLUS
10091021
if BUILD_CMAC
10101022
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/cmac.c
10111023
endif
1024+
1025+
if BUILD_SHE
1026+
src_libwolfssl@LIBSUFFIX@_la_SOURCES += wolfcrypt/src/she.c
1027+
endif
10121028
endif !BUILD_FIPS_V2_PLUS
10131029

10141030
if !BUILD_FIPS_V2

tests/api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
#include <tests/api/test_hash.h>
203203
#include <tests/api/test_hmac.h>
204204
#include <tests/api/test_cmac.h>
205+
#include <tests/api/test_she.h>
205206
#include <tests/api/test_des3.h>
206207
#include <tests/api/test_chacha.h>
207208
#include <tests/api/test_poly1305.h>
@@ -35635,6 +35636,11 @@ TEST_CASE testCases[] = {
3563535636
TEST_HMAC_DECLS,
3563635637
/* CMAC */
3563735638
TEST_CMAC_DECLS,
35639+
/* SHE */
35640+
TEST_SHE_DECLS,
35641+
#ifdef WOLF_CRYPTO_CB
35642+
TEST_SHE_CB_DECLS,
35643+
#endif
3563835644

3563935645
/* Cipher */
3564035646
/* 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)