aboutsummaryrefslogtreecommitdiff
path: root/internal/speed
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-02-29 21:26:28 +0100
committerJakob Unterwurzacher2020-02-29 21:26:28 +0100
commitf82b9caa9c8bcbfc814f14a30f3cf70af8154187 (patch)
tree2cdf8986d3ba29c280e5fb8cf6f472f4b5f78bac /internal/speed
parentfdfaa849f8ea2fc6687aa13a7057b5088e3c65e5 (diff)
speed: add code comments
Diffstat (limited to 'internal/speed')
-rw-r--r--internal/speed/speed.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/internal/speed/speed.go b/internal/speed/speed.go
index 43fea5d..2f1e0f6 100644
--- a/internal/speed/speed.go
+++ b/internal/speed/speed.go
@@ -16,6 +16,12 @@ import (
"github.com/rfjakob/gocryptfs/internal/stupidgcm"
)
+// 128-bit file ID + 64 bit block number = 192 bits = 24 bytes
+const adLen = 24
+
+// gocryptfs uses fixed-size 4 kiB blocks
+const blockSize = 4096
+
// Run - run the speed the test and print the results.
func Run() {
bTable := []struct {
@@ -60,14 +66,13 @@ func randBytes(n int) []byte {
return b
}
-const blockSize = 4096
-
+// bStupidGCM benchmarks stupidgcm's openssl GCM
func bStupidGCM(b *testing.B) {
if stupidgcm.BuiltWithoutOpenssl {
b.Skip("openssl has been disabled at compile-time")
}
key := randBytes(32)
- authData := randBytes(24)
+ authData := randBytes(adLen)
iv := randBytes(16)
in := make([]byte, blockSize)
b.SetBytes(int64(len(in)))
@@ -81,9 +86,10 @@ func bStupidGCM(b *testing.B) {
}
}
+// bGoGCM benchmarks Go stdlib GCM
func bGoGCM(b *testing.B) {
key := randBytes(32)
- authData := randBytes(24)
+ authData := randBytes(adLen)
iv := randBytes(16)
in := make([]byte, blockSize)
b.SetBytes(int64(len(in)))
@@ -104,9 +110,10 @@ func bGoGCM(b *testing.B) {
}
}
+// bAESSIV benchmarks AES-SIV from github.com/jacobsa/crypto/siv
func bAESSIV(b *testing.B) {
key := randBytes(64)
- authData := randBytes(24)
+ authData := randBytes(adLen)
iv := randBytes(16)
in := make([]byte, blockSize)
b.SetBytes(int64(len(in)))