Skip to content

Commit

Permalink
add gosec comment and lints
Browse files Browse the repository at this point in the history
Signed-off-by: hectorj2f <[email protected]>
  • Loading branch information
hectorj2f committed Sep 25, 2024
1 parent 58a4ef3 commit 74c3758
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/signer/tink.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func getPrimaryKey(ks *tinkpb.Keyset) *tinkpb.KeyData {
// validateEcdsaPrivKey validates the given ECDSAPrivateKey.
// https://github.com/google/tink/blob/9753ffddd4d04aa56e0605ff4a0db46f2fb80529/go/signature/ecdsa_signer_key_manager.go#L139
func validateEcdsaPrivKey(key *ecdsapb.EcdsaPrivateKey) error {
if err := keyset.ValidateKeyVersion(key.Version, uint32(ecdsaSignerKeyVersion)); err != nil {
if err := keyset.ValidateKeyVersion(key.Version, uint32(ecdsaSignerKeyVersion)); err != nil { //nolint:gosec
return fmt.Errorf("ecdsa_signer_key_manager: invalid key: %w", err)
}
hash, curve, encoding := getECDSAParamNames(key.PublicKey.Params)
Expand All @@ -178,7 +178,7 @@ func getECDSAParamNames(params *ecdsapb.EcdsaParams) (string, string, string) {
// validateEd25519PrivKey validates the given ED25519PrivateKey.
// https://github.com/google/tink/blob/9753ffddd4d04aa56e0605ff4a0db46f2fb80529/go/signature/ed25519_signer_key_manager.go#L132
func validateEd25519PrivKey(key *ed25519pb.Ed25519PrivateKey) error {
if err := keyset.ValidateKeyVersion(key.Version, uint32(ed25519SignerKeyVersion)); err != nil {
if err := keyset.ValidateKeyVersion(key.Version, uint32(ed25519SignerKeyVersion)); err != nil { //nolint:gosec
return fmt.Errorf("ed25519_signer_key_manager: invalid key: %w", err)
}
if len(key.KeyValue) != ed25519.SeedSize {
Expand Down
2 changes: 1 addition & 1 deletion pkg/verification/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func verifyTSRWithChain(ts *timestamp.Timestamp, opts VerifyOpts) error {
return fmt.Errorf("error parsing hashed message: %w", err)
}

if opts.Roots == nil || len(opts.Roots) == 0 {
if len(opts.Roots) == 0 {
return fmt.Errorf("no root certificates provided for verifying the certificate chain")
}

Expand Down

0 comments on commit 74c3758

Please sign in to comment.