From 621f4f14afe83d15d04c5aae2f3290e51ff84bce Mon Sep 17 00:00:00 2001 From: Marco Oliverio Date: Thu, 16 Jun 2022 13:51:39 +0200 Subject: [PATCH] kdf: fix clang uninitialized.Assign commit f1ce0cc95d22569640bc522354025fbc16c88e43 tigger static analyzer warnings about unitialized assign. --- wolfcrypt/src/kdf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wolfcrypt/src/kdf.c b/wolfcrypt/src/kdf.c index 18b02c16f..a10c734bd 100644 --- a/wolfcrypt/src/kdf.c +++ b/wolfcrypt/src/kdf.c @@ -150,6 +150,11 @@ int wc_PRF(byte* result, word32 resLen, const byte* secret, if (lastLen) times += 1; + /* times == 0 iif resLen == 0, but times == 0 abides clang static analyzer + while resLen == 0 doesn't */ + if (times == 0) + return BAD_FUNC_ARG; + lastTime = times - 1; ret = wc_HmacInit(hmac, heap, devId);