-
Notifications
You must be signed in to change notification settings - Fork 922
Refactor wc_rng_new to use wc_rng_new_ex, and to use WC_USE_DEVID as the devId if set at compile time #9312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bigbrett
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@night1rider this fixes the RNG test for me but now is revealing a few other related problems that make sense to fix in this PR
test.c:47429
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t dilithium_test(void)
{
wc_test_ret_t ret;
WC_RNG rng;
#ifndef HAVE_FIPS
ret = wc_InitRng_ex(&rng, HEAP_HINT, INVALID_DEVID); // <--------- Needs global devId
#else
ret = wc_InitRng(&rng);
#endif
if (ret != 0) {
ret = WC_TEST_RET_ENC_EC(ret);
return ret;
}
....
|
@bigbrett Updated the 4 tests that where initializing RNG without the global devId. I see a bunch of other tests that use I do see this failing, unsure if its due to be running on an embedded target do you see a similar failure? |
|
@night1rider yes I'm on an embedded target. The tests wouldn't fail unless you were building with |
|
@night1rider brings up a good point...
@dgarske larger question - do you think it is ever appropriate for our unit tests to manually specify IMO if user sets |
61b7216 to
065899a
Compare
…the devId if set at compile time
…um_test, xmss_test, lms_test
065899a to
bd4099d
Compare
|
Rebased to use fixed kernel test in github actions |
Found that when doing our RNG test it would fail to use my CryptoCallback. Noticed the test would use
wc_rng_newand notwc_rng_new_exand not supply my default devId which is set withWC_USE_DEVID.Change is to assume that if
WC_USE_DEVIDis set that the user intends this to be the default device to use for crypto calls, so this means that ifwc_rng_newis called it should be assumed the user intends it to useWC_USE_DEVIDand notINVALID_DEVIDwhich is our default solution.INVALID_DEVIDcan still be request if used withwc_rng_new_exby the user