Skip to content

Commit

Permalink
Re-enable Skipped PKCS11 Tests
Browse files Browse the repository at this point in the history
Many of the tests were gated by the short flag, causing them
to be skipped, which lead to breakages in the pkcs11 tests.
Re-enables tests to prevent breakages from occuring again in the
future.

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
  • Loading branch information
lindluni authored and mastersingh24 committed Sep 1, 2020
1 parent 80d3934 commit d308fbf
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 137 deletions.
3 changes: 0 additions & 3 deletions bccsp/pkcs11/ecdsakey_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import (
)

func TestX509PublicKeyImportOptsKeyImporter(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestX509PublicKeyImportOptsKeyImporter")
}
ki := currentBCCSP

_, err := ki.KeyImport("Hello World", &bccsp.X509PublicKeyImportOpts{})
Expand Down
115 changes: 0 additions & 115 deletions bccsp/pkcs11/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,6 @@ func TestInvalidAltId(t *testing.T) {
}

func TestKeyGenECDSAOpts(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestKeyGenECDSAOpts")
}
// Curve P256
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAP256KeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -311,9 +308,6 @@ func TestKeyGenECDSAOpts(t *testing.T) {
}

func TestKeyGenRSAOpts(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestKeyGenRSAOpts")
}
// 1024
k, err := currentBCCSP.KeyGen(&bccsp.RSA1024KeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -346,9 +340,6 @@ func TestKeyGenRSAOpts(t *testing.T) {
}

func TestKeyGenAESOpts(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestKeyGenAESOpts")
}
// AES 128
k, err := currentBCCSP.KeyGen(&bccsp.AES128KeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -396,9 +387,6 @@ func TestKeyGenAESOpts(t *testing.T) {
}

func TestHashOpts(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestHashOpts")
}
msg := []byte("abcd")

// SHA256
Expand Down Expand Up @@ -459,9 +447,6 @@ func TestHashOpts(t *testing.T) {
}

func TestECDSAKeyGenEphemeral(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAKeyGenEphemeral")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: true})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand Down Expand Up @@ -492,9 +477,6 @@ func TestECDSAKeyGenEphemeral(t *testing.T) {
}

func TestECDSAPrivateKeySKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAPrivateKeySKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand All @@ -507,9 +489,6 @@ func TestECDSAPrivateKeySKI(t *testing.T) {
}

func TestECDSAKeyGenNonEphemeral(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAKeyGenNonEphemeral")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand All @@ -526,9 +505,6 @@ func TestECDSAKeyGenNonEphemeral(t *testing.T) {
}

func TestECDSAGetKeyBySKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAGetKeyBySKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand All @@ -555,9 +531,6 @@ func TestECDSAGetKeyBySKI(t *testing.T) {
}

func TestECDSAPublicKeyFromPrivateKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAPublicKeyFromPrivateKey")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand All @@ -579,10 +552,6 @@ func TestECDSAPublicKeyFromPrivateKey(t *testing.T) {
}

func TestECDSAPublicKeyBytes(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAPublicKeyBytes")
}

k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand All @@ -603,9 +572,6 @@ func TestECDSAPublicKeyBytes(t *testing.T) {
}

func TestECDSAPublicKeySKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAPublicKeySKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand All @@ -623,9 +589,6 @@ func TestECDSAPublicKeySKI(t *testing.T) {
}

func TestECDSASign(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSASign")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand Down Expand Up @@ -656,9 +619,6 @@ func TestECDSASign(t *testing.T) {
}

func TestECDSAVerify(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAVerify")
}
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating ECDSA key [%s]", err)
Expand Down Expand Up @@ -736,9 +696,6 @@ func TestECDSAVerify(t *testing.T) {
}

func TestECDSAKeyImportFromExportedKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAKeyImportFromExportedKey")
}
// Generate an ECDSA key
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -788,9 +745,6 @@ func TestECDSAKeyImportFromExportedKey(t *testing.T) {
}

func TestECDSAKeyImportFromECDSAPublicKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSAKeyImportFromECDSAPublicKey")
}
// Generate an ECDSA key
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -845,9 +799,6 @@ func TestECDSAKeyImportFromECDSAPublicKey(t *testing.T) {
}

func TestKeyImportFromX509ECDSAPublicKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestKeyImportFromX509ECDSAPublicKey")
}
// Generate an ECDSA key
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -975,9 +926,6 @@ func TestKeyImportFromX509ECDSAPublicKey(t *testing.T) {
}

func TestECDSASignatureEncoding(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSASignatureEncoding")
}
v := []byte{0x30, 0x07, 0x02, 0x01, 0x8F, 0x02, 0x02, 0xff, 0xf1}
_, err := asn1.Unmarshal(v, &utils.ECDSASignature{})
if err == nil {
Expand Down Expand Up @@ -1016,9 +964,6 @@ func TestECDSASignatureEncoding(t *testing.T) {
}

func TestECDSALowS(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestECDSALowS")
}
// Ensure that signature with low-S are generated
k, err := currentBCCSP.KeyGen(&bccsp.ECDSAKeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -1081,9 +1026,6 @@ func TestECDSALowS(t *testing.T) {
}

func TestAESKeyGen(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestAESKeyGen")
}
k, err := currentBCCSP.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating AES_256 key [%s]", err)
Expand All @@ -1108,9 +1050,6 @@ func TestAESKeyGen(t *testing.T) {
}

func TestAESEncrypt(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestAESEncrypt")
}
k, err := currentBCCSP.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating AES_256 key [%s]", err)
Expand All @@ -1126,9 +1065,6 @@ func TestAESEncrypt(t *testing.T) {
}

func TestAESDecrypt(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestAESDecrypt")
}
k, err := currentBCCSP.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating AES_256 key [%s]", err)
Expand All @@ -1155,9 +1091,6 @@ func TestAESDecrypt(t *testing.T) {
}

func TestHMACTruncated256KeyDerivOverAES256Key(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestHMACTruncated256KeyDerivOverAES256Key")
}
k, err := currentBCCSP.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating AES_256 key [%s]", err)
Expand Down Expand Up @@ -1206,9 +1139,6 @@ func TestHMACTruncated256KeyDerivOverAES256Key(t *testing.T) {
}

func TestHMACKeyDerivOverAES256Key(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestHMACKeyDerivOverAES256Key")
}
k, err := currentBCCSP.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating AES_256 key [%s]", err)
Expand Down Expand Up @@ -1238,9 +1168,6 @@ func TestHMACKeyDerivOverAES256Key(t *testing.T) {
}

func TestAES256KeyImport(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestAES256KeyImport")
}
raw, err := sw.GetRandomBytes(32)
if err != nil {
t.Fatalf("Failed generating AES key [%s]", err)
Expand Down Expand Up @@ -1288,9 +1215,6 @@ func TestAES256KeyImport(t *testing.T) {
}

func TestAES256KeyImportBadPaths(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestAES256KeyImportBadPaths")
}
_, err := currentBCCSP.KeyImport(nil, &bccsp.AES256ImportKeyOpts{Temporary: false})
if err == nil {
t.Fatal("Failed importing key. Must fail on importing nil key")
Expand All @@ -1303,9 +1227,6 @@ func TestAES256KeyImportBadPaths(t *testing.T) {
}

func TestAES256KeyGenSKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestAES256KeyGenSKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.AESKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating AES_256 key [%s]", err)
Expand Down Expand Up @@ -1333,9 +1254,6 @@ func TestAES256KeyGenSKI(t *testing.T) {
}

func TestSHA(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestSHA")
}
for i := 0; i < 100; i++ {
b, err := sw.GetRandomBytes(i)
if err != nil {
Expand Down Expand Up @@ -1380,9 +1298,6 @@ func TestSHA(t *testing.T) {
}

func TestRSAKeyGenEphemeral(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAKeyGenEphemeral")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: true})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand Down Expand Up @@ -1416,9 +1331,6 @@ func TestRSAKeyGenEphemeral(t *testing.T) {
}

func TestRSAPrivateKeySKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAPrivateKeySKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1431,9 +1343,6 @@ func TestRSAPrivateKeySKI(t *testing.T) {
}

func TestRSAKeyGenNonEphemeral(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAKeyGenNonEphemeral")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1450,9 +1359,6 @@ func TestRSAKeyGenNonEphemeral(t *testing.T) {
}

func TestRSAGetKeyBySKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAGetKeyBySKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1479,9 +1385,6 @@ func TestRSAGetKeyBySKI(t *testing.T) {
}

func TestRSAPublicKeyFromPrivateKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAPublicKeyFromPrivateKey")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1503,9 +1406,6 @@ func TestRSAPublicKeyFromPrivateKey(t *testing.T) {
}

func TestRSAPublicKeyBytes(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAPublicKeyBytes")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1526,9 +1426,6 @@ func TestRSAPublicKeyBytes(t *testing.T) {
}

func TestRSAPublicKeySKI(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAPublicKeySKI")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1546,9 +1443,6 @@ func TestRSAPublicKeySKI(t *testing.T) {
}

func TestRSASign(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSASign")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand All @@ -1571,9 +1465,6 @@ func TestRSASign(t *testing.T) {
}

func TestRSAVerify(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAVerify")
}
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
t.Fatalf("Failed generating RSA key [%s]", err)
Expand Down Expand Up @@ -1634,9 +1525,6 @@ func TestRSAVerify(t *testing.T) {
}

func TestRSAKeyImportFromRSAPublicKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestRSAKeyImportFromRSAPublicKey")
}
// Generate an RSA key
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
Expand Down Expand Up @@ -1691,9 +1579,6 @@ func TestRSAKeyImportFromRSAPublicKey(t *testing.T) {
}

func TestKeyImportFromX509RSAPublicKey(t *testing.T) {
if testing.Short() {
t.Skip("Skipping TestKeyImportFromX509RSAPublicKey")
}
// Generate an RSA key
k, err := currentBCCSP.KeyGen(&bccsp.RSAKeyGenOpts{Temporary: false})
if err != nil {
Expand Down

0 comments on commit d308fbf

Please sign in to comment.