diff options
Diffstat (limited to 'internal/contentenc')
-rw-r--r-- | internal/contentenc/content.go | 2 | ||||
-rw-r--r-- | internal/contentenc/content_api.go | 11 | ||||
-rw-r--r-- | internal/contentenc/file_header.go | 6 |
3 files changed, 9 insertions, 10 deletions
diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go index 14135a2..dd6aa26 100644 --- a/internal/contentenc/content.go +++ b/internal/contentenc/content.go @@ -3,8 +3,8 @@ package contentenc // File content encryption / decryption import ( - "encoding/binary" "bytes" + "encoding/binary" "encoding/hex" "errors" diff --git a/internal/contentenc/content_api.go b/internal/contentenc/content_api.go index 4c6aa00..cf482b6 100644 --- a/internal/contentenc/content_api.go +++ b/internal/contentenc/content_api.go @@ -11,9 +11,9 @@ type ContentEnc struct { // Cryptographic primitives cryptoCore *cryptocore.CryptoCore // Plaintext block size - plainBS uint64 + plainBS uint64 // Ciphertext block size - cipherBS uint64 + cipherBS uint64 // All-zero block of size cipherBS, for fast compares allZeroBlock []byte } @@ -23,14 +23,13 @@ func New(cc *cryptocore.CryptoCore, plainBS uint64) *ContentEnc { cipherBS := plainBS + uint64(cc.IVLen) + cryptocore.AuthTagLen return &ContentEnc{ - cryptoCore: cc, - plainBS: plainBS, - cipherBS: cipherBS, + cryptoCore: cc, + plainBS: plainBS, + cipherBS: cipherBS, allZeroBlock: make([]byte, cipherBS), } } - func (be *ContentEnc) PlainBS() uint64 { return be.plainBS } diff --git a/internal/contentenc/file_header.go b/internal/contentenc/file_header.go index 8a9dd2c..1463773 100644 --- a/internal/contentenc/file_header.go +++ b/internal/contentenc/file_header.go @@ -15,9 +15,9 @@ const ( // Current On-Disk-Format version CurrentVersion = 2 - HEADER_VERSION_LEN = 2 // uint16 - HEADER_ID_LEN = 16 // 128 bit random file id - HEADER_LEN = HEADER_VERSION_LEN + HEADER_ID_LEN // Total header length + HEADER_VERSION_LEN = 2 // uint16 + HEADER_ID_LEN = 16 // 128 bit random file id + HEADER_LEN = HEADER_VERSION_LEN + HEADER_ID_LEN // Total header length ) type FileHeader struct { |