summaryrefslogtreecommitdiff
path: root/cryptfs/cryptfs.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-03 13:34:33 +0200
committerJakob Unterwurzacher2015-10-03 13:34:33 +0200
commit38bf8a2fcfe0b7260c08d49ed04c9667871f0992 (patch)
treef787ce0acc977ffb4e7fa2c034087f7df31911ee /cryptfs/cryptfs.go
parent3fef613591b6831d0ebc8bd2aff4264346a1d047 (diff)
Implement file hole passtrough
Fixes xfstests generic/010 Note that file holes are not authenticated,
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),
}
}