diff options
| author | Jakob Unterwurzacher | 2016-02-06 20:22:45 +0100 | 
|---|---|---|
| committer | Jakob Unterwurzacher | 2016-02-06 20:22:45 +0100 | 
| commit | b0ee5258b1ac60b9a672d9db0816b17ae12d0e55 (patch) | |
| tree | 3decdec7e3abf5978c2e936693a034cf838a16ca /openssl_benchmark | |
| parent | 9078a77850dd680bfa938d9ed7c83600a60c0e7b (diff) | |
Fix tests - were broken by the refactoring
Diffstat (limited to 'openssl_benchmark')
| -rw-r--r-- | openssl_benchmark/openssl_test.go | 24 | 
1 files changed, 13 insertions, 11 deletions
| diff --git a/openssl_benchmark/openssl_test.go b/openssl_benchmark/openssl_test.go index 35abca7..1530f9b 100644 --- a/openssl_benchmark/openssl_test.go +++ b/openssl_benchmark/openssl_test.go @@ -12,15 +12,17 @@ import (  	"crypto/aes"  	"crypto/cipher"  	"fmt" -	"github.com/rfjakob/gocryptfs/cryptfs" -	"github.com/spacemonkeygo/openssl"  	"os"  	"testing" + +	"github.com/spacemonkeygo/openssl" + +	"github.com/rfjakob/gocryptfs/internal/cryptocore"  )  func TestMain(m *testing.M) { -	fmt.Printf("Benchmarking AES-GCM-%d with 4kB block size\n", cryptfs.KEY_LEN*8) +	fmt.Printf("Benchmarking AES-GCM-%d with 4kB block size\n", cryptocore.KeyLen*8)  	r := m.Run()  	os.Exit(r) @@ -30,7 +32,7 @@ func BenchmarkGoEnc4K(b *testing.B) {  	buf := make([]byte, 1024*4)  	b.SetBytes(int64(len(buf))) -	var key [cryptfs.KEY_LEN]byte +	var key [cryptocore.KeyLen]byte  	var nonce [12]byte  	aes, _ := aes.NewCipher(key[:])  	aesgcm, _ := cipher.NewGCM(aes) @@ -47,7 +49,7 @@ func BenchmarkGoDec4K(b *testing.B) {  	buf := make([]byte, 1024*4)  	b.SetBytes(int64(len(buf))) -	var key [cryptfs.KEY_LEN]byte +	var key [cryptocore.KeyLen]byte  	var nonce [12]byte  	aes, _ := aes.NewCipher(key[:])  	aesgcm, _ := cipher.NewGCM(aes) @@ -67,7 +69,7 @@ func BenchmarkOpensslEnc4K(b *testing.B) {  	buf := make([]byte, 1024*4)  	b.SetBytes(int64(len(buf))) -	var key [cryptfs.KEY_LEN]byte +	var key [cryptocore.KeyLen]byte  	var nonce [12]byte  	// This would be fileID + blockNo @@ -79,7 +81,7 @@ func BenchmarkOpensslEnc4K(b *testing.B) {  	b.ResetTimer()  	for i := 0; i < b.N; i++ {  		ciphertext.Reset() -		ectx, err := openssl.NewGCMEncryptionCipherCtx(cryptfs.KEY_LEN*8, nil, key[:], nonce[:]) +		ectx, err := openssl.NewGCMEncryptionCipherCtx(cryptocore.KeyLen*8, nil, key[:], nonce[:])  		if err != nil {  			b.FailNow()  		} @@ -112,7 +114,7 @@ func BenchmarkOpensslDec4K(b *testing.B) {  	tag := buf[4096:]  	buf = buf[0:4096] -	var key [cryptfs.KEY_LEN]byte +	var key [cryptocore.KeyLen]byte  	var nonce [12]byte  	var plaintext bytes.Buffer @@ -121,7 +123,7 @@ func BenchmarkOpensslDec4K(b *testing.B) {  	b.ResetTimer()  	for i := 0; i < b.N; i++ {  		plaintext.Reset() -		dctx, err := openssl.NewGCMDecryptionCipherCtx(cryptfs.KEY_LEN*8, nil, key[:], nonce[:]) +		dctx, err := openssl.NewGCMDecryptionCipherCtx(cryptocore.KeyLen*8, nil, key[:], nonce[:])  		if err != nil {  			b.FailNow()  		} @@ -144,12 +146,12 @@ func BenchmarkOpensslDec4K(b *testing.B) {  func makeOpensslCiphertext() []byte {  	buf := make([]byte, 1024*4) -	var key [cryptfs.KEY_LEN]byte +	var key [cryptocore.KeyLen]byte  	var nonce [12]byte  	var ciphertext bytes.Buffer  	var part []byte -	ectx, _ := openssl.NewGCMEncryptionCipherCtx(cryptfs.KEY_LEN*8, nil, key[:], nonce[:]) +	ectx, _ := openssl.NewGCMEncryptionCipherCtx(cryptocore.KeyLen*8, nil, key[:], nonce[:])  	part, _ = ectx.EncryptUpdate(buf)  	ciphertext.Write(part)  	part, _ = ectx.EncryptFinal() | 
