slhdsa: align function parameter name

This commit is contained in:
Sun Yimin 2025-05-22 15:47:56 +08:00 committed by GitHub
parent c467b22fb9
commit 08bf93c1b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -47,10 +47,10 @@ func (sk *PrivateKey) wotsPkGen(out, tmpBuf []byte, addr adrsOperations) {
// wotsSign generates a WOTS signature on an n-byte message. // wotsSign generates a WOTS signature on an n-byte message.
// //
// See FIPS 205 Algorithm 10 wots_sign // See FIPS 205 Algorithm 10 wots_sign
func (sk *PrivateKey) wotsSign(m []byte, adrs adrsOperations, sigWots []byte) { func (sk *PrivateKey) wotsSign(msg []byte, adrs adrsOperations, sigWots []byte) {
var msgAndCsum [MAX_WOTS_LEN]byte var msgAndCsum [MAX_WOTS_LEN]byte
// convert message to base w=16 // convert message to base w=16
bytes2nibbles(m, msgAndCsum[:]) bytes2nibbles(msg, msgAndCsum[:])
// compute checksum // compute checksum
// checksum = 15 * len1 - sum(msgAndCsum) // checksum = 15 * len1 - sum(msgAndCsum)
var csum uint16 var csum uint16
@ -83,10 +83,10 @@ func (sk *PrivateKey) wotsSign(m []byte, adrs adrsOperations, sigWots []byte) {
// wotsPkFromSig computes a WOTS public key from a message and its signature // wotsPkFromSig computes a WOTS public key from a message and its signature
// //
// See FIPS 205 Algorithm 8 wots_pkFromSig // See FIPS 205 Algorithm 8 wots_pkFromSig
func (pk *PublicKey) wotsPkFromSig(signature, m, tmpBuf []byte, adrs adrsOperations, out []byte) { func (pk *PublicKey) wotsPkFromSig(signature, msg, tmpBuf []byte, adrs adrsOperations, out []byte) {
var msgAndCsum [MAX_WOTS_LEN]byte var msgAndCsum [MAX_WOTS_LEN]byte
// convert message to base w=16 // convert message to base w=16
bytes2nibbles(m, msgAndCsum[:]) bytes2nibbles(msg, msgAndCsum[:])
// compute checksum // compute checksum
// checksum = 15 * len1 - sum(msgAndCsum) // checksum = 15 * len1 - sum(msgAndCsum)
var csum uint16 var csum uint16

View File

@ -27,11 +27,11 @@ func (sk *PrivateKey) xmssNode(out, tmpBuf []byte, i, z uint32, adrs adrsOperati
} }
} }
// xmssSign generates an XMSS signature on an n-byte message pkFors by // xmssSign generates an XMSS signature on an n-byte message by
// creating an authentication path and signing pkFors with the appropriate WORTS+ key. // creating an authentication path and signing message with the appropriate WORTS+ key.
// //
// See FIPS 205 Algorithm 10 xmss_sign // See FIPS 205 Algorithm 10 xmss_sign
func (sk *PrivateKey) xmssSign(pkFors, tmpBuf []byte, leafIdx uint32, adrs adrsOperations, signature []byte) { func (sk *PrivateKey) xmssSign(msg, tmpBuf []byte, leafIdx uint32, adrs adrsOperations, signature []byte) {
// build auth path, the auth path consists of the sibling nodes of each node that is on the path from the WOTS+ key used to the root // build auth path, the auth path consists of the sibling nodes of each node that is on the path from the WOTS+ key used to the root
authStart := sk.params.n * sk.params.len authStart := sk.params.n * sk.params.len
authPath := signature[authStart:] authPath := signature[authStart:]
@ -44,17 +44,17 @@ func (sk *PrivateKey) xmssSign(pkFors, tmpBuf []byte, leafIdx uint32, adrs adrsO
// compute WOTS+ signature // compute WOTS+ signature
adrs.setTypeAndClear(AddressTypeWOTSHash) adrs.setTypeAndClear(AddressTypeWOTSHash)
adrs.setKeyPairAddress(leafIdxCopy) adrs.setKeyPairAddress(leafIdxCopy)
sk.wotsSign(pkFors, adrs, signature) sk.wotsSign(msg, adrs, signature)
} }
// xmssPkFromSig computes an XMSS public key from an XMSS signature. // xmssPkFromSig computes an XMSS public key from an XMSS signature.
// //
// See FIPS 205 Algorithm 11 xmss_pkFromSig // See FIPS 205 Algorithm 11 xmss_pkFromSig
func (pk *PublicKey) xmssPkFromSig(leafIdx uint32, signature, m, tmpBuf []byte, adrs adrsOperations, out []byte) { func (pk *PublicKey) xmssPkFromSig(leafIdx uint32, signature, msg, tmpBuf []byte, adrs adrsOperations, out []byte) {
// compute WOTS pk from WOTS signature // compute WOTS pk from WOTS signature
adrs.setTypeAndClear(AddressTypeWOTSHash) adrs.setTypeAndClear(AddressTypeWOTSHash)
adrs.setKeyPairAddress(leafIdx) adrs.setKeyPairAddress(leafIdx)
pk.wotsPkFromSig(signature, m, tmpBuf, adrs, out) pk.wotsPkFromSig(signature, msg, tmpBuf, adrs, out)
// compute root from WOTS pk and AUTH path // compute root from WOTS pk and AUTH path
adrs.setTypeAndClear(AddressTypeTree) adrs.setTypeAndClear(AddressTypeTree)