fix: openssl-specific verification of digest

This commit is contained in:
Cassandra Heart 2024-10-15 13:26:18 -07:00
parent 048b6459c3
commit 22e9398dd6
No known key found for this signature in database
GPG Key ID: 6352152859385958
2 changed files with 6 additions and 4 deletions

View File

@ -102,6 +102,7 @@ type Signature struct {
PublicKeyHex string `json:"publicKeyHex"`
SignatureHex string `json:"signatureHex"`
}
type SignedGenesisUnlock struct {
GenesisSeedHex string `json:"genesisSeedHex"`
Signatures []Signature `json:"signatures"`
@ -167,7 +168,7 @@ func DownloadAndVerifyGenesis() (*SignedGenesisUnlock, error) {
checksig := ""
for _, sig := range checkUnlock.Signatures {
if sig.PublicKeyHex == Signatories[i-1] {
checksig = sig.PublicKeyHex
checksig = sig.SignatureHex
break
}
}
@ -176,12 +177,13 @@ func DownloadAndVerifyGenesis() (*SignedGenesisUnlock, error) {
continue
}
sig, err := hex.DecodeString(Signatories[i-1])
sig, err := hex.DecodeString(checksig)
if err != nil {
return nil, err
}
if !ed448.Verify(pubkey, digest[:], sig, "") {
opensslMsg := "SHA3-256(genesis)= " + hex.EncodeToString(digest[:])
if !ed448.Verify(pubkey, append([]byte(opensslMsg), 0x0a), sig, "") {
fmt.Printf("Failed signature check for signatory #%d\n", i)
return nil, err
}

View File

@ -36,5 +36,5 @@ func FormatVersion(version []byte) string {
}
func GetPatchNumber() byte {
return 0x03
return 0x04
}