From 40a7bcfc20bf8badc762b21ff13c952bfc12a9a2 Mon Sep 17 00:00:00 2001 From: David Garske Date: Fri, 1 Feb 2019 17:03:29 -0800 Subject: [PATCH] Fix for new random seed crypto callback to properly reset error code in NOT_COMPILED_IN case. --- wolfcrypt/src/random.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 66e940190..4f20e536a 100755 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -2176,11 +2176,13 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) int ret = 0; #ifdef WOLF_CRYPTO_CB - if (os != NULL && os->devId != INVALID_DEVID) { - ret = wc_CryptoCb_RandomSeed(os, output, sz); - if (ret != NOT_COMPILED_IN) - return ret; - } + if (os != NULL && os->devId != INVALID_DEVID) { + ret = wc_CryptoCb_RandomSeed(os, output, sz); + if (ret != NOT_COMPILED_IN) + return ret; + /* fall-through on not compiled in */ + ret = 0; /* reset error code */ + } #endif #ifdef HAVE_INTEL_RDSEED