From c6a6641b58d4bd8fd9e64ad7a653eff9886ee6e2 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Tue, 8 Dec 2015 13:19:19 +0100 Subject: tests: add encryption benchmarks to cryptfs --- openssl_benchmark/openssl_test.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'openssl_benchmark/openssl_test.go') 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() -- cgit v1.2.3