Skip to content

Commit a7225d1

Browse files
committed
[FAB-3176] Fixing staticcheck errors
This change-set fixes staticcheck errors in bccsp/sw package. Change-Id: I48179b848f40a095fea8f545407a8146651e489f Signed-off-by: Angelo De Caro <[email protected]>
1 parent c5c60c3 commit a7225d1

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

bccsp/sw/aes_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"testing"
2424

2525
"github.com/hyperledger/fabric/bccsp/utils"
26+
"github.com/stretchr/testify/assert"
2627
)
2728

2829
// TestCBCPKCS7EncryptCBCPKCS7Decrypt encrypts using CBCPKCS7Encrypt and decrypts using CBCPKCS7Decrypt.
@@ -288,8 +289,7 @@ func TestCBCEncrypt_EmptyPlaintext(t *testing.T) {
288289
t.Log("Message length: ", len(emptyPlaintext))
289290

290291
ciphertext, encErr := aesCBCEncrypt(key, emptyPlaintext)
291-
if encErr != nil {
292-
}
292+
assert.NoError(t, encErr)
293293

294294
t.Log("Ciphertext length: ", len(ciphertext))
295295

bccsp/sw/fileks.go

+3
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ func (ks *fileBasedKeyStore) searchKeystoreForSKI(ski []byte) (k bccsp.Key, err
230230
continue
231231
}
232232
raw, err := ioutil.ReadFile(filepath.Join(ks.path, f.Name()))
233+
if err != nil {
234+
continue
235+
}
233236

234237
key, err := utils.PEMtoPrivateKey(raw, ks.pwd)
235238
if err != nil {

bccsp/sw/impl_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ func TestECDSALowS(t *testing.T) {
10951095
t.Fatalf("Failed generating ECDSA signature [%s]", err)
10961096
}
10971097

1098-
R, S, err := unmarshalECDSASignature(signature)
1098+
_, S, err := unmarshalECDSASignature(signature)
10991099
if err != nil {
11001100
t.Fatalf("Failed unmarshalling signature [%s]", err)
11011101
}
@@ -1113,6 +1113,7 @@ func TestECDSALowS(t *testing.T) {
11131113
}
11141114

11151115
// Ensure that signature with high-S are rejected.
1116+
var R *big.Int
11161117
for {
11171118
R, S, err = ecdsa.Sign(rand.Reader, k.(*ecdsaPrivateKey).privKey, digest)
11181119
if err != nil {

0 commit comments

Comments
 (0)