aboutsummaryrefslogtreecommitdiff
path: root/internal/contentenc/content.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-09-17 10:59:04 +0200
committerJakob Unterwurzacher2017-09-17 10:59:04 +0200
commit4bd2c6736afbe20d6aa7d94758082d8c8752af4b (patch)
tree0c8f75837b4364a47d4b8fd7052f571e5d5270f5 /internal/contentenc/content.go
parentf0e29d9b90b63d5fbe4164161ecb0e1035bb4af4 (diff)
contentenc: DecryptBlocks: give block number counter a clearer name
Using firstBlockNo as the counter is confusing, create a copy named "blockNo" and use that.
Diffstat (limited to 'internal/contentenc/content.go')
-rw-r--r--internal/contentenc/content.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go
index 6524ad4..e841ad0 100644
--- a/internal/contentenc/content.go
+++ b/internal/contentenc/content.go
@@ -102,10 +102,11 @@ func (be *ContentEnc) DecryptBlocks(ciphertext []byte, firstBlockNo uint64, file
cBuf := bytes.NewBuffer(ciphertext)
var err error
pBuf := bytes.NewBuffer(be.PReqPool.Get()[:0])
+ blockNo := firstBlockNo
for cBuf.Len() > 0 {
cBlock := cBuf.Next(int(be.cipherBS))
var pBlock []byte
- pBlock, err = be.DecryptBlock(cBlock, firstBlockNo, fileID)
+ pBlock, err = be.DecryptBlock(cBlock, blockNo, fileID)
if err != nil {
if be.forceDecode && err == stupidgcm.ErrAuth {
tlog.Warn.Printf("DecryptBlocks: authentication failure in block #%d, overridden by forcedecode", firstBlockNo)
@@ -115,7 +116,7 @@ func (be *ContentEnc) DecryptBlocks(ciphertext []byte, firstBlockNo uint64, file
}
pBuf.Write(pBlock)
be.pBlockPool.Put(pBlock)
- firstBlockNo++
+ blockNo++
}
return pBuf.Bytes(), err
}