summaryrefslogtreecommitdiff
path: root/internal/stupidgcm
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-02-22 23:55:43 +0100
committerJakob Unterwurzacher2017-02-22 23:56:34 +0100
commit1e03e059fa0980db8d527f1c01094999d8813b95 (patch)
tree950f537f1fa58e9f0506a540b31d790030e69a1d /internal/stupidgcm
parentb056776a013813e251aa37027c3aaa3f1e22d7c8 (diff)
Implement "gocryptfs -speed"
A crypto benchmark mode like "openssl speed". Example run: $ ./gocryptfs -speed AES-GCM-256-OpenSSL 180.89 MB/s (selected in auto mode) AES-GCM-256-Go 48.19 MB/s AES-SIV-512-Go 37.40 MB/s
Diffstat (limited to 'internal/stupidgcm')
-rw-r--r--internal/stupidgcm/stupidgcm_test.go58
1 files changed, 0 insertions, 58 deletions
diff --git a/internal/stupidgcm/stupidgcm_test.go b/internal/stupidgcm/stupidgcm_test.go
index d6c0714..ba25855 100644
--- a/internal/stupidgcm/stupidgcm_test.go
+++ b/internal/stupidgcm/stupidgcm_test.go
@@ -15,9 +15,6 @@ import (
"encoding/hex"
"log"
"testing"
-
- // For benchmark comparison
- "github.com/rfjakob/gocryptfs/internal/siv_aead"
)
// Get "n" random bytes from /dev/urandom or panic
@@ -121,58 +118,3 @@ func TestCorruption(t *testing.T) {
t.Fatalf("Should have gotten error")
}
}
-
-// $ go test -bench .
-// PASS
-// Benchmark4kEncStupidGCM-2 50000 25622 ns/op 159.86 MB/s
-// Benchmark4kEncGoGCM-2 10000 116544 ns/op 35.15 MB/s
-// ok github.com/rfjakob/gocryptfs/internal/stupidgcm 3.775s
-func Benchmark4kEncStupidGCM(b *testing.B) {
- key := randBytes(32)
- authData := randBytes(24)
- iv := randBytes(16)
- in := make([]byte, 4096)
- b.SetBytes(int64(len(in)))
-
- sGCM := New(key)
-
- for i := 0; i < b.N; i++ {
- // Encrypt and append to nonce
- sGCM.Seal(iv, iv, in, authData)
- }
-}
-
-func Benchmark4kEncGoGCM(b *testing.B) {
- key := randBytes(32)
- authData := randBytes(24)
- iv := randBytes(16)
- in := make([]byte, 4096)
- b.SetBytes(int64(len(in)))
-
- gAES, err := aes.NewCipher(key)
- if err != nil {
- b.Fatal(err)
- }
- gGCM, err := cipher.NewGCMWithNonceSize(gAES, 16)
- if err != nil {
- b.Fatal(err)
- }
-
- for i := 0; i < b.N; i++ {
- // Encrypt and append to nonce
- gGCM.Seal(iv, iv, in, authData)
- }
-}
-
-func Benchmark4kEncAESSIV(b *testing.B) {
- key := randBytes(32)
- authData := randBytes(24)
- iv := randBytes(16)
- in := make([]byte, 4096)
- b.SetBytes(int64(len(in)))
- gGCM := siv_aead.New(key)
- for i := 0; i < b.N; i++ {
- // Encrypt and append to nonce
- gGCM.Seal(iv, iv, in, authData)
- }
-}