diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/contentenc/content_test.go | 6 | ||||
| -rw-r--r-- | internal/cryptocore/cryptocore_test.go | 15 | ||||
| -rw-r--r-- | internal/stupidgcm/stupidgcm_test.go | 2 | 
3 files changed, 15 insertions, 8 deletions
| diff --git a/internal/contentenc/content_test.go b/internal/contentenc/content_test.go index e4d4a3e..998e9b8 100644 --- a/internal/contentenc/content_test.go +++ b/internal/contentenc/content_test.go @@ -23,7 +23,7 @@ func TestSplitRange(t *testing.T) {  		testRange{6654, 8945})  	key := make([]byte, cryptocore.KeyLen) -	cc := cryptocore.New(key, cryptocore.BackendOpenSSL, DefaultIVBits, true, false) +	cc := cryptocore.New(key, cryptocore.BackendGoGCM, DefaultIVBits, true, false)  	f := New(cc, DefaultBS, false)  	for _, r := range ranges { @@ -51,7 +51,7 @@ func TestCiphertextRange(t *testing.T) {  		testRange{6654, 8945})  	key := make([]byte, cryptocore.KeyLen) -	cc := cryptocore.New(key, cryptocore.BackendOpenSSL, DefaultIVBits, true, false) +	cc := cryptocore.New(key, cryptocore.BackendGoGCM, DefaultIVBits, true, false)  	f := New(cc, DefaultBS, false)  	for _, r := range ranges { @@ -74,7 +74,7 @@ func TestCiphertextRange(t *testing.T) {  func TestBlockNo(t *testing.T) {  	key := make([]byte, cryptocore.KeyLen) -	cc := cryptocore.New(key, cryptocore.BackendOpenSSL, DefaultIVBits, true, false) +	cc := cryptocore.New(key, cryptocore.BackendGoGCM, DefaultIVBits, true, false)  	f := New(cc, DefaultBS, false)  	b := f.CipherOffToBlockNo(788) diff --git a/internal/cryptocore/cryptocore_test.go b/internal/cryptocore/cryptocore_test.go index 4c34652..e595ef6 100644 --- a/internal/cryptocore/cryptocore_test.go +++ b/internal/cryptocore/cryptocore_test.go @@ -2,17 +2,15 @@ package cryptocore  import (  	"testing" + +	"github.com/rfjakob/gocryptfs/internal/stupidgcm"  )  // "New" should accept at least these param combinations  func TestCryptoCoreNew(t *testing.T) {  	key := make([]byte, 32)  	for _, useHKDF := range []bool{true, false} { -		c := New(key, BackendOpenSSL, 128, useHKDF, false) -		if c.IVLen != 16 { -			t.Fail() -		} -		c = New(key, BackendGoGCM, 96, useHKDF, false) +		c := New(key, BackendGoGCM, 96, useHKDF, false)  		if c.IVLen != 12 {  			t.Fail()  		} @@ -20,6 +18,13 @@ func TestCryptoCoreNew(t *testing.T) {  		if c.IVLen != 16 {  			t.Fail()  		} +		if stupidgcm.BuiltWithoutOpenssl { +			continue +		} +		c = New(key, BackendOpenSSL, 128, useHKDF, false) +		if c.IVLen != 16 { +			t.Fail() +		}  	}  } diff --git a/internal/stupidgcm/stupidgcm_test.go b/internal/stupidgcm/stupidgcm_test.go index f652c45..b340179 100644 --- a/internal/stupidgcm/stupidgcm_test.go +++ b/internal/stupidgcm/stupidgcm_test.go @@ -1,3 +1,5 @@ +// +build !without_openssl +  // We compare against Go's built-in GCM implementation. Since stupidgcm only  // supports 128-bit IVs and Go only supports that from 1.5 onward, we cannot  // run these tests on older Go versions. | 
