Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lint warnings #462

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkcs11/ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func getPublic(point []byte, curve elliptic.Curve) (pub crypto.PublicKey, err er
}
ecdsaPub.X, ecdsaPub.Y = elliptic.Unmarshal(ecdsaPub.Curve, point[:pointLength])
if ecdsaPub.X == nil {
err = fmt.Errorf("failed to decode CKA_EC_POINT")
err = errors.New("failed to decode CKA_EC_POINT")
return
}
if !ecdsaPub.Curve.IsOnCurve(ecdsaPub.X, ecdsaPub.Y) {
err = fmt.Errorf("public key is not on curve")
err = errors.New("public key is not on curve")
return
}

Expand Down
2 changes: 1 addition & 1 deletion pkcs11/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func openLoginSession(context PKCS11Ctx, slot uint, userPin string) (p11.Session
err2 := context.CloseSession(session)
// append CloseSession error to Login error
if err2 != nil {
return 0, fmt.Errorf(err.Error() + ", CloseSession: " + err2.Error())
return 0, errors.New(err.Error() + ", CloseSession: " + err2.Error())
}
return 0, err
}
Expand Down
5 changes: 2 additions & 3 deletions pkcs11/p11signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"crypto"
"crypto/x509"
"errors"
"fmt"
"io"

p11 "github.com/miekg/pkcs11"
Expand All @@ -34,7 +33,7 @@ func makeSigner(context PKCS11Ctx, slot uint, tokenLabel string, keyType x509.Pu
err2 := context.CloseSession(session)
// append CloseSession error to getPrivateKey error
if err2 != nil {
return nil, fmt.Errorf(err.Error() + ", CloseSession: " + err2.Error())
return nil, errors.New(err.Error() + ", CloseSession: " + err2.Error())
}
return nil, err
}
Expand All @@ -45,7 +44,7 @@ func makeSigner(context PKCS11Ctx, slot uint, tokenLabel string, keyType x509.Pu
err2 := context.CloseSession(session)
// append CloseSession error to getPublicKey error
if err2 != nil {
return nil, fmt.Errorf(err.Error() + ", CloseSession: " + err2.Error())
return nil, errors.New(err.Error() + ", CloseSession: " + err2.Error())
}
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkcs11/pkcs11.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func initPKCS11Context(modulePath string) (*p11.Ctx, error) {
context := p11.New(modulePath)

if context == nil {
return nil, fmt.Errorf("unable to load PKCS#11 module:" + modulePath)
return nil, errors.New("unable to load PKCS#11 module:" + modulePath)
}

err := context.Initialize()
Expand Down
2 changes: 1 addition & 1 deletion pkcs11/work.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (s *signerBlob) signData(ctx context.Context, signer signerWithSignAlgorith
pool.put(signer)
}()
if s.digest == nil {
e = fmt.Errorf("signBlob: cannot sign empty digest")
e = errors.New("signBlob: cannot sign empty digest")
return
}

Expand Down
Loading