Skip to content

Commit

Permalink
fix: Move nil check to context verification
Browse files Browse the repository at this point in the history
  • Loading branch information
lubux committed Oct 29, 2024
1 parent 845577c commit 274f525
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crypto/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ func createVerifyResult(
signatureError = newSignatureNoVerifier()
case signature.SignatureError != nil:
signatureError = newSignatureFailed(signature.SignatureError)
case signature.CorrespondingSig == nil:
signatureError = newSignatureInsecure()
case verificationContext != nil:
err := verificationContext.verifyContext(signature.CorrespondingSig)
if err != nil {
Expand Down Expand Up @@ -386,6 +384,9 @@ func findContext(notations []*packet.Notation) (string, error) {
}

func (context *VerificationContext) verifyContext(sig *packet.Signature) error {
if sig == nil {
return errors.New("gopenpgp: no signature packet found for signature")
}
signatureContext, err := findContext(sig.Notations)
if err != nil {
return err
Expand Down

0 comments on commit 274f525

Please sign in to comment.