aboutsummaryrefslogtreecommitdiff
path: root/cryptfs/file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-09-04 20:31:06 +0200
committerJakob Unterwurzacher2015-09-04 20:37:37 +0200
commit6f90ec716a0e486628297a8d74e9f4d8d895e744 (patch)
tree66261a242910310edd4db12455de3970ed23e2fb /cryptfs/file.go
parent779ad6dda3d7926c1f68e72600a5db3764e6039d (diff)
Rebase to cluefs
https://github.com/airnandez/cluefs
Diffstat (limited to 'cryptfs/file.go')
-rw-r--r--cryptfs/file.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/cryptfs/file.go b/cryptfs/file.go
index 77262d4..5645f3c 100644
--- a/cryptfs/file.go
+++ b/cryptfs/file.go
@@ -8,7 +8,7 @@ import (
"crypto/cipher"
)
-type File struct {
+type CryptFile struct {
file *os.File
gcm cipher.AEAD
plainBS int64
@@ -17,7 +17,7 @@ type File struct {
// readCipherBlock - Read ciphertext block number "blockNo", decrypt,
// return plaintext
-func (be *File) readCipherBlock(blockNo int64) ([]byte, error) {
+func (be *CryptFile) readCipherBlock(blockNo int64) ([]byte, error) {
off := blockNo * int64(be.cipherBS)
buf := make([]byte, be.cipherBS)
@@ -64,7 +64,7 @@ type intraBlock struct {
}
// Split a plaintext byte range into (possible partial) blocks
-func (be *File) splitRange(offset int64, length int64) []intraBlock {
+func (be *CryptFile) splitRange(offset int64, length int64) []intraBlock {
var b intraBlock
var parts []intraBlock
@@ -79,7 +79,7 @@ func (be *File) splitRange(offset int64, length int64) []intraBlock {
return parts
}
-func (be *File) min64(x int64, y int64) int64 {
+func (be *CryptFile) min64(x int64, y int64) int64 {
if x < y {
return x
}
@@ -87,7 +87,7 @@ func (be *File) min64(x int64, y int64) int64 {
}
// writeCipherBlock - Encrypt plaintext and write it to file block "blockNo"
-func (be *File) writeCipherBlock(blockNo int64, plain []byte) error {
+func (be *CryptFile) writeCipherBlock(blockNo int64, plain []byte) error {
if int64(len(plain)) > be.plainBS {
panic("writeCipherBlock: Cannot write block that is larger than plainBS")
@@ -109,7 +109,7 @@ func (be *File) writeCipherBlock(blockNo int64, plain []byte) error {
// Perform RMW cycle on block
// Write "data" into file location specified in "b"
-func (be *File) rmwWrite(b intraBlock, data []byte, f *os.File) error {
+func (be *CryptFile) rmwWrite(b intraBlock, data []byte, f *os.File) error {
if b.length != int64(len(data)) {
panic("Length mismatch")
}