Skip to content

Commit

Permalink
Fix CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chpock committed Jul 7, 2024
1 parent d8521ef commit 6bd45d2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions generic/crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 6bd45d2

Please sign in to comment.