Skip to content

Commit bdbce8a

Browse files
tejlmandcarlescufi
authored andcommitted
cracen: moving declaration of variable to top of function
Declaration of variables after a label inside a switch statement is a c23 extension, not c99. This results in the following warning when compiling with clang: > ..subsys/nrf_security/src/drivers/cracen/cracenpsa/src/ecdsa.c:407:3: > warning: label followed by a declaration is a C23 extension > 407 | size_t copylen = MIN(digestsz, opsz - hmac_op->tlen); > | ^ > 1 warning generated. There is no practical reason why the variable should be declared inside the switch statement, therefore move the declaration and place it together with declaration of other variables. Signed-off-by: Torsten Rasmussen <[email protected]>
1 parent 432819c commit bdbce8a

File tree

1 file changed

+2
-1
lines changed
  • subsys/nrf_security/src/drivers/cracen/cracenpsa/src

1 file changed

+2
-1
lines changed

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/ecdsa.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ static int run_deterministic_ecdsa_hmac_step(const struct sxhashalg *hashalg, si
370370
uint8_t *V = K + digestsz;
371371
uint8_t *T = V + digestsz;
372372
uint8_t step = hmac_op->step;
373+
size_t copylen;
373374

374375
switch (step) {
375376
case 0: /* K = HMAC_K(V || 0x00 || privkey || h1) */
@@ -404,7 +405,7 @@ static int run_deterministic_ecdsa_hmac_step(const struct sxhashalg *hashalg, si
404405
break;
405406

406407
case 5: /* T = T || V */
407-
size_t copylen = MIN(digestsz, opsz - hmac_op->tlen);
408+
copylen = MIN(digestsz, opsz - hmac_op->tlen);
408409

409410
memcpy(T + hmac_op->tlen, V, copylen);
410411
hmac_op->tlen += copylen;

0 commit comments

Comments
 (0)