mirror of
https://github.com/emmansun/gmsm.git
synced 2025-06-28 08:23:26 +08:00
slhdsa: align function parameter name
This commit is contained in:
parent
c467b22fb9
commit
08bf93c1b1
@ -47,10 +47,10 @@ func (sk *PrivateKey) wotsPkGen(out, tmpBuf []byte, addr adrsOperations) {
|
||||
// wotsSign generates a WOTS signature on an n-byte message.
|
||||
//
|
||||
// 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
|
||||
// convert message to base w=16
|
||||
bytes2nibbles(m, msgAndCsum[:])
|
||||
bytes2nibbles(msg, msgAndCsum[:])
|
||||
// compute checksum
|
||||
// checksum = 15 * len1 - sum(msgAndCsum)
|
||||
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
|
||||
//
|
||||
// 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
|
||||
// convert message to base w=16
|
||||
bytes2nibbles(m, msgAndCsum[:])
|
||||
bytes2nibbles(msg, msgAndCsum[:])
|
||||
// compute checksum
|
||||
// checksum = 15 * len1 - sum(msgAndCsum)
|
||||
var csum uint16
|
||||
|
@ -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
|
||||
// creating an authentication path and signing pkFors with the appropriate WORTS+ key.
|
||||
// xmssSign generates an XMSS signature on an n-byte message by
|
||||
// creating an authentication path and signing message with the appropriate WORTS+ key.
|
||||
//
|
||||
// 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
|
||||
authStart := sk.params.n * sk.params.len
|
||||
authPath := signature[authStart:]
|
||||
@ -44,17 +44,17 @@ func (sk *PrivateKey) xmssSign(pkFors, tmpBuf []byte, leafIdx uint32, adrs adrsO
|
||||
// compute WOTS+ signature
|
||||
adrs.setTypeAndClear(AddressTypeWOTSHash)
|
||||
adrs.setKeyPairAddress(leafIdxCopy)
|
||||
sk.wotsSign(pkFors, adrs, signature)
|
||||
sk.wotsSign(msg, adrs, signature)
|
||||
}
|
||||
|
||||
// xmssPkFromSig computes an XMSS public key from an XMSS signature.
|
||||
//
|
||||
// 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
|
||||
adrs.setTypeAndClear(AddressTypeWOTSHash)
|
||||
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
|
||||
adrs.setTypeAndClear(AddressTypeTree)
|
||||
|
Loading…
x
Reference in New Issue
Block a user