diff options
Diffstat (limited to 'internal/speed/speed_test.go')
-rw-r--r-- | internal/speed/speed_test.go | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/internal/speed/speed_test.go b/internal/speed/speed_test.go index a6f3f30..4d09148 100644 --- a/internal/speed/speed_test.go +++ b/internal/speed/speed_test.go @@ -1,5 +1,16 @@ package speed +import ( + "crypto/aes" + "crypto/cipher" + "testing" + + "golang.org/x/crypto/chacha20poly1305" + + "github.com/rfjakob/gocryptfs/v2/internal/siv_aead" + "github.com/rfjakob/gocryptfs/v2/internal/stupidgcm" +) + /* Make the "-speed" benchmarks also accessible to the standard test system. Example run: @@ -12,26 +23,54 @@ PASS ok github.com/rfjakob/gocryptfs/v2/internal/speed 6.022s */ -import ( - "testing" -) - func BenchmarkStupidGCM(b *testing.B) { bStupidGCM(b) } +func BenchmarkStupidGCMDecrypt(b *testing.B) { + if stupidgcm.BuiltWithoutOpenssl { + b.Skip("openssl has been disabled at compile-time") + } + bDecrypt(b, stupidgcm.New(randBytes(32), false)) +} + func BenchmarkGoGCM(b *testing.B) { bGoGCM(b) } +func BenchmarkGoGCMDecrypt(b *testing.B) { + gAES, err := aes.NewCipher(randBytes(32)) + if err != nil { + b.Fatal(err) + } + gGCM, err := cipher.NewGCMWithNonceSize(gAES, 16) + if err != nil { + b.Fatal(err) + } + bDecrypt(b, gGCM) +} + func BenchmarkAESSIV(b *testing.B) { bAESSIV(b) } +func BenchmarkAESSIVDecrypt(b *testing.B) { + bEncrypt(b, siv_aead.New(randBytes(64))) +} + func BenchmarkXchacha(b *testing.B) { bXchacha20poly1305(b) } +func BenchmarkXchachaDecrypt(b *testing.B) { + c, _ := chacha20poly1305.NewX(randBytes(32)) + bDecrypt(b, c) +} + func BenchmarkStupidXchacha(b *testing.B) { bStupidXchacha(b) } + +func BenchmarkStupidXchachaDecrypt(b *testing.B) { + bDecrypt(b, stupidgcm.NewXchacha20poly1305(randBytes(32))) +} |