Skip to content

Commit 77dcbb5

Browse files
authored
Merge pull request #9293 from dgpighin/docstrings_update
Some updates to the docstrings
2 parents b2c105d + a61d79d commit 77dcbb5

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

wolfcrypt/src/dilithium.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ static int dilithium_shake256(wc_Shake* shake256, const byte* data,
477477
}
478478

479479
/* 256-bit hash using SHAKE-256.
480+
*
481+
* This is the domain-separated version of the hash.
482+
* See FIPS 204. D.3.
480483
*
481484
* FIPS 204. 8.3: H(v,d) <- SHAKE256(v,d)
482485
*
@@ -622,8 +625,8 @@ static int dilithium_hash256(wc_Shake* shake256, const byte* data1,
622625
* 1 when message was hashed.
623626
* @param [in] ctx Context of signature.
624627
* @param [in] ctxLen Length of context of signature in bytes.
625-
* @param [in] ctx Message to sign.
626-
* @param [in] ctxLen Length of message to sign in bytes.
628+
* @param [in] msg Message to sign.
629+
* @param [in] msgLen Length of message to sign in bytes.
627630
* @param [out] hash Buffer to hold hash result.
628631
* @param [in] hashLen Number of bytes of hash to return.
629632
* @return 0 on success.
@@ -1038,7 +1041,7 @@ static void dilthium_vec_encode_eta_bits(const sword32* s, byte d, byte eta,
10381041
#if !defined(WOLFSSL_NO_ML_DSA_44) || !defined(WOLFSSL_NO_ML_DSA_87)
10391042
/* Decode polynomial with range -2..2.
10401043
*
1041-
* FIPS 204. 8.2: Algorithm 19 skDecode(sk)
1044+
* FIPS 204. 7.2: Algorithm 25 skDecode(sk)
10421045
* ...
10431046
* 5: for i from 0 to l - 1 do
10441047
* 6: s1[i] <- BitUnpack(yi, eta, eta)
@@ -1099,7 +1102,7 @@ static void dilithium_decode_eta_2_bits(const byte* p, sword32* s)
10991102
#ifndef WOLFSSL_NO_ML_DSA_65
11001103
/* Decode polynomial with range -4..4.
11011104
*
1102-
* FIPS 204. 8.2: Algorithm 19 skDecode(sk)
1105+
* FIPS 204. 7.2: Algorithm 25 skDecode(sk)
11031106
* ...
11041107
* 5: for i from 0 to l - 1 do
11051108
* 6: s1[i] <- BitUnpack(yi, eta, eta)
@@ -1173,7 +1176,7 @@ static void dilithium_decode_eta_4_bits(const byte* p, sword32* s)
11731176
!defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM)))
11741177
/* Decode vector of polynomials with range -ETA..ETA.
11751178
*
1176-
* FIPS 204. 8.2: Algorithm 19 skDecode(sk)
1179+
* FIPS 204. 7.2: Algorithm 25 skDecode(sk)
11771180
* ...
11781181
* 5: for i from 0 to l - 1 do
11791182
* 6: s1[i] <- BitUnpack(yi, eta, eta)
@@ -1382,7 +1385,7 @@ static void dilithium_vec_encode_t0_t1(const sword32* t, byte d, byte* t0,
13821385
#if !defined(WOLFSSL_DILITHIUM_NO_SIGN) || defined(WOLFSSL_DILITHIUM_CHECK_KEY)
13831386
/* Decode bottom D bits of t as t0.
13841387
*
1385-
* FIPS 204. 8.2: Algorithm 19 skDecode(sk)
1388+
* FIPS 204. 7.2: Algorithm 25 skDecode(sk)
13861389
* ...
13871390
* 12: t0[i] <- BitUnpack(wi, 2^(d-1) - 1, 2^(d-1)
13881391
* ...
@@ -1482,7 +1485,7 @@ static void dilithium_decode_t0(const byte* t0, sword32* t)
14821485
!defined(WOLFSSL_DILITHIUM_SIGN_SMALL_MEM)))
14831486
/* Decode bottom D bits of t as t0.
14841487
*
1485-
* FIPS 204. 8.2: Algorithm 19 skDecode(sk)
1488+
* FIPS 204. 7.2: Algorithm 25 skDecode(sk)
14861489
* ...
14871490
* 11: for i from 0 to k - 1 do
14881491
* 12: t0[i] <- BitUnpack(wi, 2^(d-1) - 1, 2^(d-1)
@@ -1512,7 +1515,7 @@ static void dilithium_vec_decode_t0(const byte* t0, byte d, sword32* t)
15121515
defined(WOLFSSL_DILITHIUM_CHECK_KEY)
15131516
/* Decode top bits of t as t1.
15141517
*
1515-
* FIPS 204. 8.2: Algorithm 17 pkDecode(pk)
1518+
* FIPS 204. 7.2: Algorithm 23 pkDecode(pk)
15161519
* ...
15171520
* 4: t1[i] <- SimpleBitUnpack(zi, 2^(bitlen(q-1)-d) - 1)
15181521
* ...
@@ -1585,7 +1588,7 @@ static void dilithium_decode_t1_c(const byte* t1, sword32* t)
15851588

15861589
/* Decode top bits of t as t1.
15871590
*
1588-
* FIPS 204. 8.2: Algorithm 17 pkDecode(pk)
1591+
* FIPS 204. 7.2: Algorithm 23 pkDecode(pk)
15891592
* ...
15901593
* 4: t1[i] <- SimpleBitUnpack(zi, 2^(bitlen(q-1)-d) - 1)
15911594
* ...
@@ -1613,7 +1616,7 @@ static void dilithium_decode_t1(const byte* t1, sword32* t)
16131616
defined(WOLFSSL_DILITHIUM_CHECK_KEY)
16141617
/* Decode top bits of t as t1.
16151618
*
1616-
* FIPS 204. 8.2: Algorithm 17 pkDecode(pk)
1619+
* FIPS 204. 7.2: Algorithm 23 pkDecode(pk)
16171620
* ...
16181621
* 3: for i from 0 to k - 1 do
16191622
* 4: t1[i] <- SimpleBitUnpack(zi, 2^(bitlen(q-1)-d) - 1)

0 commit comments

Comments
 (0)