diff options
author | Jakob Unterwurzacher | 2015-12-08 13:19:19 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2015-12-08 13:19:19 +0100 |
commit | c6a6641b58d4bd8fd9e64ad7a653eff9886ee6e2 (patch) | |
tree | 41f69679a578323bc0f247b2e4abfbec191a5b85 /openssl_benchmark | |
parent | 21abf57abbfc6ad818df623f007cac1aa1945682 (diff) |
tests: add encryption benchmarks to cryptfs
Diffstat (limited to 'openssl_benchmark')
-rw-r--r-- | openssl_benchmark/openssl_test.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/openssl_benchmark/openssl_test.go b/openssl_benchmark/openssl_test.go index 76c68a8..35abca7 100644 --- a/openssl_benchmark/openssl_test.go +++ b/openssl_benchmark/openssl_test.go @@ -2,6 +2,8 @@ package benchmark // Benchmark go built-int GCM against spacemonkey openssl bindings // +// Note: This is deprecated in favor of the benchmarks integrated in cryptfs. +// // Run benchmark: // go test -bench=. @@ -33,10 +35,11 @@ func BenchmarkGoEnc4K(b *testing.B) { aes, _ := aes.NewCipher(key[:]) aesgcm, _ := cipher.NewGCM(aes) var out []byte - + // This would be fileID + blockNo + aData := make([]byte, 24) b.ResetTimer() for i := 0; i < b.N; i++ { - out = aesgcm.Seal(out[:0], nonce[:], buf, nil) + out = aesgcm.Seal(out[:0], nonce[:], buf, aData) } } @@ -67,6 +70,9 @@ func BenchmarkOpensslEnc4K(b *testing.B) { var key [cryptfs.KEY_LEN]byte var nonce [12]byte + // This would be fileID + blockNo + aData := make([]byte, 24) + var ciphertext bytes.Buffer var part []byte @@ -77,6 +83,10 @@ func BenchmarkOpensslEnc4K(b *testing.B) { if err != nil { b.FailNow() } + err = ectx.ExtraData(aData) + if err != nil { + b.FailNow() + } part, err = ectx.EncryptUpdate(buf) if err != nil { b.FailNow() |