Skip to content

Commit e4657d2

Browse files
Add configure and CMake options for WOLF_CRYPTO_CB_RSA_PAD.
Fixes #10271.
1 parent b1983b1 commit e4657d2

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,6 +2235,10 @@ add_option("WOLFSSL_CRYPTOCB_NO_SW_TEST"
22352235
"Disable crypto callback SW testing (default: disabled)"
22362236
"no" "yes;no")
22372237

2238+
add_option("WOLFSSL_CRYPTOCB_RSA_PAD"
2239+
"Enable RSA padding aware crypto callbacks (default: disabled)"
2240+
"no" "yes;no")
2241+
22382242
add_option("WOLFSSL_PKCALLBACKS"
22392243
"Enable public key callbacks (default: disabled)"
22402244
"no" "yes;no")
@@ -2467,6 +2471,13 @@ if(WOLFSSL_CRYPTOCB_NO_SW_TEST)
24672471
list(APPEND WOLFSSL_DEFINITIONS "-DWC_TEST_NO_CRYPTOCB_SW_TEST")
24682472
endif()
24692473

2474+
if(WOLFSSL_CRYPTOCB_RSA_PAD)
2475+
if(NOT WOLFSSL_CRYPTOCB)
2476+
message(FATAL_ERROR "WOLFSSL_CRYPTOCB_RSA_PAD requires WOLFSSL_CRYPTOCB")
2477+
endif()
2478+
list(APPEND WOLFSSL_DEFINITIONS "-DWOLF_CRYPTO_CB_RSA_PAD")
2479+
endif()
2480+
24702481
# Public Key Callbacks
24712482
if(WOLFSSL_PKCALLBACKS)
24722483
list(APPEND WOLFSSL_DEFINITIONS "-DHAVE_PK_CALLBACKS")

cmake/options.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ extern "C" {
258258
#cmakedefine WC_RSA_PSS
259259
#undef WOLF_CRYPTO_CB
260260
#cmakedefine WOLF_CRYPTO_CB
261+
#undef WOLF_CRYPTO_CB_RSA_PAD
262+
#cmakedefine WOLF_CRYPTO_CB_RSA_PAD
261263
#undef WOLFSSL_AARCH64_BUILD
262264
#cmakedefine WOLFSSL_AARCH64_BUILD
263265
#undef WOLFSSL_AES_CFB

configure.ac

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10512,6 +10512,24 @@ if test "$ENABLED_CRYPTOCB_UTILS" != "no"; then
1051210512
fi
1051310513
fi
1051410514
10515+
# Crypto callback RSA padding support
10516+
# When enabled, the RSA crypto callback args struct exposes the RsaPadding
10517+
# parameters so the callback can perform RSA padding/unpadding itself or
10518+
# offload it together with the modular exponentiation.
10519+
AC_ARG_ENABLE([cryptocb-rsa-pad],
10520+
[AS_HELP_STRING([--enable-cryptocb-rsa-pad],[Enable RSA padding aware crypto callbacks (default: disabled). Requires --enable-cryptocb])],
10521+
[ ENABLED_CRYPTOCB_RSA_PAD=$enableval ],
10522+
[ ENABLED_CRYPTOCB_RSA_PAD=no ]
10523+
)
10524+
10525+
if test "$ENABLED_CRYPTOCB_RSA_PAD" = "yes"
10526+
then
10527+
if test "x$ENABLED_CRYPTOCB" = "xno"; then
10528+
AC_MSG_ERROR([--enable-cryptocb-rsa-pad requires --enable-cryptocb])
10529+
fi
10530+
AM_CFLAGS="$AM_CFLAGS -DWOLF_CRYPTO_CB_RSA_PAD"
10531+
fi
10532+
1051510533
1051610534
# Asynchronous Crypto
1051710535
AC_ARG_ENABLE([asynccrypt],

0 commit comments

Comments
 (0)