diff options
| author | Joseph Richey <joerichey@google.com> | 2018-02-09 04:01:32 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-09 04:01:32 -0800 |
| commit | aebae1aae2fc61185a8bbc96313d8462727ad202 (patch) | |
| tree | 1307c7cccaede948a53be45343d4df711eb508b3 /crypto/crypto_test.go | |
| parent | f4ccce6f486c26fdfa8d3d09929d464fc9368ab3 (diff) | |
| parent | 575618f02ea7ed3edc53b4bcd24ecbfc6ef00e77 (diff) | |
Merge pull request #84 from google/argon2
Move to x/crypto/argon2
Diffstat (limited to 'crypto/crypto_test.go')
| -rw-r--r-- | crypto/crypto_test.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 444f847..2946a59 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -533,65 +533,6 @@ func TestPassphraseHashing(t *testing.T) { } } -func TestBadTime(t *testing.T) { - pk, err := fakePassphraseKey() - if err != nil { - t.Fatal(err) - } - defer pk.Wipe() - - costs := *hashTestCases[0].costs - costs.Time = 0 - _, err = PassphraseHash(pk, fakeSalt, &costs) - if err == nil { - t.Errorf("time cost of %d should be invalid", costs.Time) - } -} - -func TestBadMemory(t *testing.T) { - pk, err := fakePassphraseKey() - if err != nil { - t.Fatal(err) - } - defer pk.Wipe() - - costs := *hashTestCases[0].costs - costs.Memory = 7 - _, err = PassphraseHash(pk, fakeSalt, &costs) - if err == nil { - t.Errorf("memory cost of %d should be invalid", costs.Memory) - } -} - -func TestBadParallelism(t *testing.T) { - pk, err := fakePassphraseKey() - if err != nil { - t.Fatal(err) - } - defer pk.Wipe() - - costs := *hashTestCases[0].costs - costs.Parallelism = 1 << 24 - costs.Memory = 1 << 27 // Running n threads requires at least 8*n memory - _, err = PassphraseHash(pk, fakeSalt, &costs) - if err == nil { - t.Errorf("parallelism cost of %d should be invalid", costs.Parallelism) - } -} - -func TestBadSalt(t *testing.T) { - pk, err := fakePassphraseKey() - if err != nil { - t.Fatal(err) - } - defer pk.Wipe() - - _, err = PassphraseHash(pk, []byte{1, 2, 3, 4}, hashTestCases[0].costs) - if err == nil { - t.Error("too short of salt should be invalid") - } -} - func BenchmarkWrap(b *testing.B) { for n := 0; n < b.N; n++ { Wrap(fakeWrappingKey, fakeValidPolicyKey) |