diff --git a/wolfcrypt/src/cryptocb.c b/wolfcrypt/src/cryptocb.c index 24021a5e8..ee330d1a1 100644 --- a/wolfcrypt/src/cryptocb.c +++ b/wolfcrypt/src/cryptocb.c @@ -785,10 +785,13 @@ int wc_CryptoCb_Sha384Hash(wc_Sha384* sha384, const byte* in, CryptoCb* dev; /* locate registered callback */ + #ifndef NO_SHA2_CRYPTO_CB if (sha384) { dev = wc_CryptoCb_FindDevice(sha384->devId); } - else { + else + #endif + { /* locate first callback and try using it */ dev = wc_CryptoCb_FindDeviceByIndex(0); } @@ -818,10 +821,13 @@ int wc_CryptoCb_Sha512Hash(wc_Sha512* sha512, const byte* in, CryptoCb* dev; /* locate registered callback */ + #ifndef NO_SHA2_CRYPTO_CB if (sha512) { dev = wc_CryptoCb_FindDevice(sha512->devId); } - else { + else + #endif + { /* locate first callback and try using it */ dev = wc_CryptoCb_FindDeviceByIndex(0); } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 1b0a834a4..a5426e137 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -38075,8 +38075,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx) if (info->hash.sha384 == NULL) return NOT_COMPILED_IN; + #ifndef NO_SHA2_CRYPTO_CB /* set devId to invalid, so software is used */ info->hash.sha384->devId = INVALID_DEVID; + #endif if (info->hash.in != NULL) { ret = wc_Sha384Update( @@ -38090,8 +38092,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx) info->hash.digest); } + #ifndef NO_SHA2_CRYPTO_CB /* reset devId */ info->hash.sha384->devId = devIdArg; + #endif } else #endif @@ -38100,8 +38104,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx) if (info->hash.sha512 == NULL) return NOT_COMPILED_IN; + #ifndef NO_SHA2_CRYPTO_CB /* set devId to invalid, so software is used */ info->hash.sha512->devId = INVALID_DEVID; + #endif if (info->hash.in != NULL) { ret = wc_Sha512Update( @@ -38115,8 +38121,10 @@ static int myCryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx) info->hash.digest); } + #ifndef NO_SHA2_CRYPTO_CB /* reset devId */ info->hash.sha512->devId = devIdArg; + #endif } else #endif