Skip to content

Commit ca88357

Browse files
committed
wolfcrypt/src/rng_bank.c and wolfssl/wolfcrypt/rng_bank.h: add new wc_rng_bank_default facility:
* wc_rng_bank_default_set() * wc_rng_bank_default_checkout() * wc_rng_bank_default_checkin() * wc_rng_bank_default_clear() * Added additional argument error checking to existing APIs, with a new rng_inst_matches_bank() helper function. * Implemented feature gates WC_RNG_BANK_DEFAULT_SUPPORT and WC_RNG_BANK_NO_DEFAULT_SUPPORT. When WC_RNG_BANK_DEFAULT_SUPPORT, the new APIs are available, and a NULL bank passed to APIs implicitly refers to the default bank. wolfcrypt/test/test.c: in random_bank_test() add comprehensive smoke test coverage of new APIs and argument checking. wolfssl/wolfcrypt/wc_port.h and wolfcrypt/src/wc_port.c: * Add wolfSSL_RefInc2(), wolfSSL_RefDec2(), wolfSSL_RefWithMutexInc2(), and wolfSSL_RefWithMutexDec2(), returning the atomically determined new count in the second arg; * Fix type of second arg in the fallback definition of wolfSSL_Atomic_Ptr_CompareExchange(). linuxkm/lkcapi_sha_glue.c: Refactor the _REGISTER_HASH_DRBG / _REGISTER_HASH_DRBG_DEFAULT facility around the new wc_rng_bank_default facility, eliminating post-init use of kernel-native crypto_default_rng, crypto_get_default_rng(), and crypto_put_default_rng(), and eliminating all use on kernel 7.1+ (where these will become unexported kernel-native statics). With the refactor, the LINUXKM_DRBG_GET_RANDOM_BYTES facility uses only direct native wolfCrypt objects and calls to fulfill requests. wolfssl/wolfcrypt/error-crypt.h, wolfcrypt/src/error.c, wolfcrypt/test/test.c, tests/api.c: add WC_SUCCESS = 0 "wolfCrypt generic success".
1 parent 0c9b639 commit ca88357

File tree

10 files changed

+640
-120
lines changed

10 files changed

+640
-120
lines changed

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ WC_NO_VERBOSE_RNG
646646
WC_PKCS11_FIND_WITH_ID_ONLY
647647
WC_PKCS12_PBKDF_USING_MP_API
648648
WC_PROTECT_ENCRYPTED_MEM
649+
WC_RNG_BANK_NO_DEFAULT_SUPPORT
649650
WC_RNG_BLOCKING
650651
WC_RSA_NONBLOCK
651652
WC_RSA_NONBLOCK_TIME

0 commit comments

Comments
 (0)