Skip to content

Commit

Permalink
Fix compiler warning
Browse files Browse the repository at this point in the history
Repeated from 97edea3

```
src/encauth/ccm/ccm_add_nonce.c: In function ‘ccm_add_nonce’:
src/encauth/ccm/ccm_add_nonce.c:61:21: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   61 |       ccm->PAD[x++] = (unsigned char)((len >> 24) & 255);
      |       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./src/headers/tomcrypt.h:82,
                 from ./src/headers/tomcrypt_private.h:4,
                 from src/encauth/ccm/ccm_add_nonce.c:3:
./src/headers/tomcrypt_mac.h:410:24: note: at offset 16 into destination object ‘PAD’ of size 16
  410 |    unsigned char       PAD[16],              /* flags | Nonce N | l(m) */
```

Signed-off-by: Steffen Jaeckel <[email protected]>
  • Loading branch information
sjaeckel committed Aug 28, 2024
1 parent c4b423f commit 349d56e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/encauth/ccm/ccm_add_nonce.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ int ccm_add_nonce(ccm_state *ccm,
ccm->PAD[x++] = 0;
}
for (; y < ccm->L; y++) {
if (x >= sizeof(ccm->PAD)) {
return CRYPT_INVALID_ARG;
}
ccm->PAD[x++] = (unsigned char)((len >> 24) & 255);
len <<= 8;
}
Expand Down

0 comments on commit 349d56e

Please sign in to comment.