summaryrefslogtreecommitdiff
path: root/cryptfs/cryptfs.go
diff options
context:
space:
mode:
Diffstat (limited to 'cryptfs/cryptfs.go')
-rw-r--r--cryptfs/cryptfs.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/cryptfs/cryptfs.go b/cryptfs/cryptfs.go
index 6380a92..71ec996 100644
--- a/cryptfs/cryptfs.go
+++ b/cryptfs/cryptfs.go
@@ -20,6 +20,8 @@ type CryptFS struct {
gcm cipher.AEAD
plainBS uint64
cipherBS uint64
+ // Stores an all-zero block of size cipherBS
+ allZeroBlock []byte
}
func NewCryptFS(key []byte, useOpenssl bool) *CryptFS {
@@ -45,11 +47,14 @@ func NewCryptFS(key []byte, useOpenssl bool) *CryptFS {
}
}
+ cipherBS := DEFAULT_PLAINBS + NONCE_LEN + AUTH_TAG_LEN
+
return &CryptFS{
blockCipher: b,
gcm: gcm,
plainBS: DEFAULT_PLAINBS,
- cipherBS: DEFAULT_PLAINBS + NONCE_LEN + AUTH_TAG_LEN,
+ cipherBS: uint64(cipherBS),
+ allZeroBlock: make([]byte, cipherBS),
}
}