contentenc: DecryptBlocks: give block number counter a clearer name

Using firstBlockNo as the counter is confusing, create a
copy named "blockNo" and use that.
This commit is contained in:
Jakob Unterwurzacher 2017-09-17 10:59:04 +02:00
parent f0e29d9b90
commit 4bd2c6736a

View File

@ -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
}