mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-07 00:46:17 +08:00
Fix SM4-CCM bug in length encoding
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
static void length_to_bytes(size_t len, size_t nbytes, uint8_t *out)
|
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--) {
|
while (nbytes--) {
|
||||||
*p-- = len & 0xff;
|
*p-- = len & 0xff;
|
||||||
len >>= 8;
|
len >>= 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user