Skip to content

Commit

Permalink
Adding BCCSP to golinter script
Browse files Browse the repository at this point in the history
This change-set does the following:
1. It adds to the golinter.sh script also the bccsp folder
2. It fixes the goimports issues in the bccsp folder.

Change-Id: I299169cafca6b14253dbfadec7f101a93dca5049
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
  • Loading branch information
adecaro committed Feb 28, 2017
1 parent 0c23ac1 commit edcd48e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bccsp/pkcs11/pkcs11.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func getECKey(ski []byte) (pubKey *ecdsa.PublicKey, isPriv bool, err error) {
return nil, false, fmt.Errorf("Failed Unmarshaling Public Key")
}

pubKey = &ecdsa.PublicKey{curve, x, y}
pubKey = &ecdsa.PublicKey{Curve: curve, X: x, Y: y}
return pubKey, isPriv, nil
}

Expand Down Expand Up @@ -288,7 +288,7 @@ func generateECKey(curve asn1.ObjectIdentifier, ephemeral bool) (ski []byte, pub
return nil, nil, fmt.Errorf("Failed Unmarshaling Public Key")
}

pubGoKey := &ecdsa.PublicKey{nistCurve, x, y}
pubGoKey := &ecdsa.PublicKey{Curve: nistCurve, X: x, Y: y}

if logger.IsEnabledFor(logging.DEBUG) {
listAttrs(p11lib, session, prv)
Expand Down
16 changes: 8 additions & 8 deletions bccsp/pkcs11/pkcs11_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ func TestPKCS11ECKeySignVerify(t *testing.T) {

key, pubKey, err := generateECKey(oid, true)
if err != nil {
t.Fatal("Failed generating Key [%s]", err)
t.Fatalf("Failed generating Key [%s]", err)
}

R, S, err := signECDSA(key, hash1)

if err != nil {
t.Fatal("Failed signing message [%s]", err)
t.Fatalf("Failed signing message [%s]", err)
}

pass, err := verifyECDSA(key, hash1, R, S, currentTestConfig.securityLevel/8)
if err != nil {
t.Fatal("Error verifying message 1 [%s]", err)
t.Fatalf("Error verifying message 1 [%s]", err)
}
if pass == false {
t.Fatal("Signature should match!")
Expand All @@ -78,7 +78,7 @@ func TestPKCS11ECKeySignVerify(t *testing.T) {

pass, err = verifyECDSA(key, hash2, R, S, currentTestConfig.securityLevel/8)
if err != nil {
t.Fatal("Error verifying message 2 [%s]", err)
t.Fatalf("Error verifying message 2 [%s]", err)
}

if pass != false {
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestPKCS11ECKeyImportSignVerify(t *testing.T) {
R, S, err := signECDSA(ski, hash1)

if err != nil {
t.Fatal("Failed signing message [%s]", err)
t.Fatalf("Failed signing message [%s]", err)
}

pass, err := verifyECDSA(ski, hash1, R, S, currentTestConfig.securityLevel/8)
Expand All @@ -144,7 +144,7 @@ func TestPKCS11ECKeyImportSignVerify(t *testing.T) {

pass, err = verifyECDSA(ski, hash2, R, S, currentTestConfig.securityLevel/8)
if err != nil {
t.Fatal("Error verifying message 2 [%s]", err)
t.Fatalf("Error verifying message 2 [%s]", err)
}

if pass != false {
Expand Down Expand Up @@ -176,7 +176,7 @@ func TestPKCS11ECKeyExport(t *testing.T) {

key, pubKey, err := generateECKey(oid, false)
if err != nil {
t.Fatal("Failed generating Key [%s]", err)
t.Fatalf("Failed generating Key [%s]", err)
}

secret := getSecretValue(key)
Expand Down Expand Up @@ -221,7 +221,7 @@ func TestPKCS11ECKeyExport(t *testing.T) {

pass, err = verifyECDSA(key, hash2, R, S, currentTestConfig.securityLevel/8)
if err != nil {
t.Fatal("Error verifying message 3 [%s]", err)
t.Fatalf("Error verifying message 3 [%s]", err)
}

if pass != false {
Expand Down
2 changes: 1 addition & 1 deletion bccsp/sw/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type testConfig struct {
}

func TestMain(m *testing.M) {
ks, err := NewFileBasedKeyStore(nil, os.TempDir(), false);
ks, err := NewFileBasedKeyStore(nil, os.TempDir(), false)
if err != nil {
fmt.Printf("Failed initiliazing KeyStore [%s]", err)
os.Exit(-1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/golinter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

declare -a arr=("./core" "./events" "./examples" "./peer" "./protos" "./orderer" "./msp" "./gossip")
declare -a arr=("./core" "./events" "./examples" "./peer" "./protos" "./orderer" "./msp" "./gossip" "./bccsp")

for i in "${arr[@]}"
do
Expand Down

0 comments on commit edcd48e

Please sign in to comment.