aboutsummaryrefslogtreecommitdiff
path: root/cryptfs
diff options
context:
space:
mode:
Diffstat (limited to 'cryptfs')
-rw-r--r--cryptfs/cryptfs_content.go6
-rw-r--r--cryptfs/nonce.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/cryptfs/cryptfs_content.go b/cryptfs/cryptfs_content.go
index cb309ea..566288b 100644
--- a/cryptfs/cryptfs_content.go
+++ b/cryptfs/cryptfs_content.go
@@ -3,10 +3,10 @@ package cryptfs
// File content encryption / decryption
import (
- "encoding/binary"
"bytes"
"crypto/cipher"
"crypto/md5"
+ "encoding/binary"
"encoding/hex"
"errors"
"os"
@@ -90,7 +90,7 @@ func (be *CryptFS) DecryptBlock(ciphertext []byte, blockNo uint64) ([]byte, erro
}
// encryptBlock - Encrypt and add MAC using GCM
-func (be *CryptFS) EncryptBlock(plaintext []byte, blockNo uint64) []byte {
+func (be *CryptFS) EncryptBlock(plaintext []byte, blockNo uint64) []byte {
// Empty block?
if len(plaintext) == 0 {
@@ -197,7 +197,7 @@ func (be *CryptFS) CropPlaintext(plaintext []byte, blocks []intraBlock) []byte {
length := (last.BlockNo - blocks[0].BlockNo + 1) * be.plainBS
var cropped []byte
if offset+length > uint64(len(plaintext)) {
- cropped = plaintext[offset:len(plaintext)]
+ cropped = plaintext[offset:]
} else {
cropped = plaintext[offset : offset+length]
}
diff --git a/cryptfs/nonce.go b/cryptfs/nonce.go
index 0ba079b..9bdbb09 100644
--- a/cryptfs/nonce.go
+++ b/cryptfs/nonce.go
@@ -2,9 +2,9 @@ package cryptfs
import (
"bytes"
- "fmt"
"crypto/rand"
"encoding/hex"
+ "fmt"
)
// Get "n" random bytes from /dev/urandom or panic