mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
Merge pull request #8555 from bigbrett/default-devid-disable
Add option to disallow automatic use of "default" devId
This commit is contained in:
18
configure.ac
18
configure.ac
@@ -8802,10 +8802,20 @@ AC_ARG_ENABLE([cryptodev],
|
||||
|
||||
# Support for crypto callbacks
|
||||
AC_ARG_ENABLE([cryptocb],
|
||||
[AS_HELP_STRING([--enable-cryptocb],[Enable crypto callbacks (default: disabled)])],
|
||||
[ ENABLED_CRYPTOCB=$enableval ],
|
||||
[ ENABLED_CRYPTOCB=no ]
|
||||
)
|
||||
[AS_HELP_STRING([--enable-cryptocb],
|
||||
[Enable crypto callbacks (default: disabled). Use 'no-default-devid' to enable without a platform-specific default device ID])],
|
||||
[
|
||||
case "$enableval" in
|
||||
no-default-devid)
|
||||
ENABLED_CRYPTOCB=yes
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -DWC_NO_DEFAULT_DEVID"
|
||||
;;
|
||||
*)
|
||||
ENABLED_CRYPTOCB="$enableval"
|
||||
;;
|
||||
esac
|
||||
],
|
||||
[ ENABLED_CRYPTOCB=no ])
|
||||
|
||||
# Enable testing of cryptoCb using software crypto. On platforms where wolfCrypt tests
|
||||
# are used to test a custom cryptoCb, it may be desired to disable this so wolfCrypt tests
|
||||
|
@@ -1882,6 +1882,12 @@ int wc_CryptoCb_DefaultDevID(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Explicitly disable the "default devId" behavior. Ensures that any devId
|
||||
* will only be used if explicitly passed as an argument to crypto functions,
|
||||
* and never automatically selected. */
|
||||
#ifdef WC_NO_DEFAULT_DEVID
|
||||
ret = INVALID_DEVID;
|
||||
#else
|
||||
/* conditional macro selection based on build */
|
||||
#ifdef WOLFSSL_CAAM_DEVID
|
||||
ret = WOLFSSL_CAAM_DEVID;
|
||||
@@ -1893,6 +1899,7 @@ int wc_CryptoCb_DefaultDevID(void)
|
||||
/* try first available */
|
||||
ret = wc_CryptoCb_GetDevIdAtIndex(0);
|
||||
#endif
|
||||
#endif /* WC_NO_DEFAULT_DEVID */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user