Skip to content

Commit

Permalink
dkim: Don't pass hash function to Sign for ed25519
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp authored and emersion committed Oct 28, 2019
1 parent ca59a51 commit 100908a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dkim/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ func NewSigner(options *SignOptions) (*Signer, error) {
}
hashed := hasher.Sum(nil)

// Don't pass Hash to Sign for ed25519 as it doesn't support it
// and will return an error ("ed25519: cannot sign hashed message").
if keyAlgo == "ed25519" {
hash = crypto.Hash(0)
}

sig, err := options.Signer.Sign(randReader, hashed, hash)
if err != nil {
closeReadWithError(err)
Expand Down

0 comments on commit 100908a

Please sign in to comment.