From abd61d968d80a54b366bf65b9dc1fcf2c5bfa1e1 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 25 Sep 2016 18:04:44 +0200 Subject: contentenc: rename constant "IVBitLen" to "DefaultIVBits" and clarify comment 128-bit IVs are NOT used everywhere. --- internal/contentenc/content.go | 5 +++-- internal/contentenc/content_test.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'internal/contentenc') diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go index 5a628c8..7561859 100644 --- a/internal/contentenc/content.go +++ b/internal/contentenc/content.go @@ -16,8 +16,9 @@ type NonceMode int const ( // Default plaintext block size DefaultBS = 4096 - // We always use 128-bit IVs for file content encryption - IVBitLen = 128 + // We always use 128-bit IVs for file content, but the + // key in the config file is encrypted with a 96-bit IV. + DefaultIVBits = 128 _ = iota // skip zero RandomNonce NonceMode = iota diff --git a/internal/contentenc/content_test.go b/internal/contentenc/content_test.go index faa2780..70b71fe 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, IVBitLen) + cc := cryptocore.New(key, cryptocore.BackendOpenSSL, DefaultIVBits) f := New(cc, DefaultBS) 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, IVBitLen) + cc := cryptocore.New(key, cryptocore.BackendOpenSSL, DefaultIVBits) f := New(cc, DefaultBS) 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, IVBitLen) + cc := cryptocore.New(key, cryptocore.BackendOpenSSL, DefaultIVBits) f := New(cc, DefaultBS) b := f.CipherOffToBlockNo(788) -- cgit v1.2.3