Fix SM4-CCM bug in length encoding

This commit is contained in:
Zhi Guan
2024-04-21 10:09:31 +08:00
parent afd9682254
commit a485fa0b10

View File

@@ -18,7 +18,7 @@
static void length_to_bytes(size_t len, size_t nbytes, uint8_t *out)
{
uint8_t *p = out + nbytes;
uint8_t *p = out + nbytes - 1;
while (nbytes--) {
*p-- = len & 0xff;
len >>= 8;