From 6bd45d212104b9c93b3ca7cddcc731379643b2f3 Mon Sep 17 00:00:00 2001 From: Konstantin Kushnir Date: Sun, 7 Jul 2024 10:16:55 +0000 Subject: [PATCH] Fix CI tests --- generic/crypt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/generic/crypt.c b/generic/crypt.c index e8e15a1..2463212 100644 --- a/generic/crypt.c +++ b/generic/crypt.c @@ -47,6 +47,7 @@ static void Cookfs_HmacInit(HMAC_CTX *ctx, unsigned char *key, Sha256_Init(&ctx->inner); Sha256_Update(&ctx->inner, key, keySize); Sha256_Final(&ctx->inner, k); + // cppcheck-suppress unreadVariable symbolName=key key = k; keySize = SHA256_DIGEST_SIZE; } else { @@ -90,7 +91,7 @@ void Cookfs_Pbkdf2Hmac(unsigned char *secret, Tcl_Size secretSize, unsigned int dklen, unsigned char *output) { CookfsLog2(printf("enter; secretSize: %" TCL_SIZE_MODIFIER "d, saltSize: %" - TCL_SIZE_MODIFIER "d, iter: %d, dklen: %d", secretSize, saltSize, + TCL_SIZE_MODIFIER "d, iter: %u, dklen: %u", secretSize, saltSize, iterations, dklen)); HMAC_CTX ctx; @@ -191,9 +192,9 @@ void Cookfs_RandomGenerate(Tcl_Interp *interp, unsigned char *buf, Tcl_Size size " from Tcl: %s", Tcl_GetString(Tcl_GetObjResult(interp)))); goto fallback_c; } - int want_copy = (i + sizeof(r) > (unsigned)size ? - (unsigned)size - i : sizeof(r)); - CookfsLog2(printf("copy %d bytes from Tcl rng generator", + unsigned int want_copy = ((unsigned)i + sizeof(r) > (unsigned)size ? + (unsigned)size - (unsigned)i : sizeof(r)); + CookfsLog2(printf("copy %u bytes from Tcl rng generator", want_copy)); memcpy(&buf[i], (void *)&r, want_copy); } @@ -219,9 +220,9 @@ void Cookfs_RandomGenerate(Tcl_Interp *interp, unsigned char *buf, Tcl_Size size int r; for (Tcl_Size i = 0; i < size; i += sizeof(r)) { r = rand(); - int want_copy = (i + sizeof(r) > (unsigned)size ? - (unsigned)size - i : sizeof(r)); - CookfsLog2(printf("copy %d bytes from C rng generator", + unsigned int want_copy = ((unsigned)i + sizeof(r) > (unsigned)size ? + (unsigned)size - (unsigned)i : sizeof(r)); + CookfsLog2(printf("copy %u bytes from C rng generator", want_copy)); memcpy(&buf[i], (void *)&r, want_copy); }