Skip to content

Commit 7ad9c25

Browse files
Merge pull request #9978 from SparkiDev/xmss_sign_idx_fix
XMSS: Fix index copy for signing.
2 parents f8dda21 + 9590255 commit 7ad9c25

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

wolfcrypt/src/wc_xmss_impl.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ static void wc_idx_update(unsigned char* a, word8 l)
413413

414414
/* Copy index from source buffer to destination buffer.
415415
*
416-
* Index is put into the front of the destination buffer with the length of the
417-
* source.
416+
* Index is put in the back of the destination buffer.
418417
*
419418
* @param [in] s Source buffer.
420419
* @param [in] sl Length of index in source.
@@ -424,8 +423,8 @@ static void wc_idx_update(unsigned char* a, word8 l)
424423
static void wc_idx_copy(const unsigned char* s, word8 sl, unsigned char* d,
425424
word8 dl)
426425
{
427-
XMEMCPY(d, s, sl);
428-
XMEMSET(d + sl, 0, dl - sl);
426+
XMEMSET(d, 0, dl - sl);
427+
XMEMCPY(d + dl - sl, s, sl);
429428
}
430429
#endif
431430

0 commit comments

Comments
 (0)