summaryrefslogtreecommitdiff
path: root/cryptfs
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-10-20 20:26:52 +0200
committerJakob Unterwurzacher2015-11-01 01:36:19 +0100
commiteac1f5421375913b871132d389dc69393a9ac232 (patch)
tree217e90eaf91268733003277142175421e2289e27 /cryptfs
parenta5b907b42fa0960582b5fa2eae6a3a939a577c3d (diff)
Activate block number authentication
Diffstat (limited to 'cryptfs')
-rw-r--r--cryptfs/cryptfs_content.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cryptfs/cryptfs_content.go b/cryptfs/cryptfs_content.go
index 566288b..7a1859a 100644
--- a/cryptfs/cryptfs_content.go
+++ b/cryptfs/cryptfs_content.go
@@ -78,7 +78,7 @@ func (be *CryptFS) DecryptBlock(ciphertext []byte, blockNo uint64) ([]byte, erro
var plaintext []byte
aData := make([]byte, 8)
binary.BigEndian.PutUint64(aData, blockNo)
- plaintext, err := be.gcm.Open(plaintext, nonce, ciphertext, nil)
+ plaintext, err := be.gcm.Open(plaintext, nonce, ciphertext, aData)
if err != nil {
Warn.Printf("DecryptBlock: %s, len=%d, md5=%s\n", err.Error(), len(ciphertextOrig), Warn.Md5sum(ciphertextOrig))
@@ -103,7 +103,7 @@ func (be *CryptFS) EncryptBlock(plaintext []byte, blockNo uint64) []byte {
// Encrypt plaintext and append to nonce
aData := make([]byte, 8)
binary.BigEndian.PutUint64(aData, blockNo)
- ciphertext := be.gcm.Seal(nonce, nonce, plaintext, nil)
+ ciphertext := be.gcm.Seal(nonce, nonce, plaintext, aData)
return ciphertext
}