Skip to content

Commit

Permalink
[FAB-3176] Fixing staticcheck errors
Browse files Browse the repository at this point in the history
This change-set fixes staticcheck errors in bccsp/sw
package.

Change-Id: I48179b848f40a095fea8f545407a8146651e489f
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
  • Loading branch information
adecaro committed Apr 26, 2017
1 parent c5c60c3 commit a7225d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bccsp/sw/aes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"testing"

"github.com/hyperledger/fabric/bccsp/utils"
"github.com/stretchr/testify/assert"
)

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

ciphertext, encErr := aesCBCEncrypt(key, emptyPlaintext)
if encErr != nil {
}
assert.NoError(t, encErr)

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

Expand Down
3 changes: 3 additions & 0 deletions bccsp/sw/fileks.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ func (ks *fileBasedKeyStore) searchKeystoreForSKI(ski []byte) (k bccsp.Key, err
continue
}
raw, err := ioutil.ReadFile(filepath.Join(ks.path, f.Name()))
if err != nil {
continue
}

key, err := utils.PEMtoPrivateKey(raw, ks.pwd)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion bccsp/sw/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ func TestECDSALowS(t *testing.T) {
t.Fatalf("Failed generating ECDSA signature [%s]", err)
}

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

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

0 comments on commit a7225d1

Please sign in to comment.