diff options
author | Jakob Unterwurzacher | 2015-12-19 14:41:39 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2015-12-19 15:02:29 +0100 |
commit | 1caa9258685fa5fad8935d3bfcd0eac7d7f84f1e (patch) | |
tree | abc1e46f269f9ef8f05d812e13fcdf2bae68d298 /cryptfs/cryptfs_content.go | |
parent | 88826dc51d7919ef8b190c079955230e653323e2 (diff) |
Increase GCM IV size from 96 to 128 bits
This pushes back the birthday bound for collisions to make it virtually
irrelevant.
Diffstat (limited to 'cryptfs/cryptfs_content.go')
-rw-r--r-- | cryptfs/cryptfs_content.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cryptfs/cryptfs_content.go b/cryptfs/cryptfs_content.go index 25293a7..9a79db4 100644 --- a/cryptfs/cryptfs_content.go +++ b/cryptfs/cryptfs_content.go @@ -59,15 +59,15 @@ func (be *CryptFS) DecryptBlock(ciphertext []byte, blockNo uint64, fileId []byte return make([]byte, be.plainBS), nil } - if len(ciphertext) < NONCE_LEN { + if len(ciphertext) < be.gcmIVLen { Warn.Printf("DecryptBlock: Block is too short: %d bytes\n", len(ciphertext)) return nil, errors.New("Block is too short") } // Extract nonce - nonce := ciphertext[:NONCE_LEN] + nonce := ciphertext[:be.gcmIVLen] ciphertextOrig := ciphertext - ciphertext = ciphertext[NONCE_LEN:] + ciphertext = ciphertext[be.gcmIVLen:] // Decrypt var plaintext []byte @@ -94,7 +94,7 @@ func (be *CryptFS) EncryptBlock(plaintext []byte, blockNo uint64, fileID []byte) } // Get fresh nonce - nonce := gcmNonce.Get() + nonce := be.gcmIVGen.Get() // Authenticate block with block number and file ID aData := make([]byte, 8) |