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:
parent
f0e29d9b90
commit
4bd2c6736a
@ -102,10 +102,11 @@ func (be *ContentEnc) DecryptBlocks(ciphertext []byte, firstBlockNo uint64, file
|
|||||||
cBuf := bytes.NewBuffer(ciphertext)
|
cBuf := bytes.NewBuffer(ciphertext)
|
||||||
var err error
|
var err error
|
||||||
pBuf := bytes.NewBuffer(be.PReqPool.Get()[:0])
|
pBuf := bytes.NewBuffer(be.PReqPool.Get()[:0])
|
||||||
|
blockNo := firstBlockNo
|
||||||
for cBuf.Len() > 0 {
|
for cBuf.Len() > 0 {
|
||||||
cBlock := cBuf.Next(int(be.cipherBS))
|
cBlock := cBuf.Next(int(be.cipherBS))
|
||||||
var pBlock []byte
|
var pBlock []byte
|
||||||
pBlock, err = be.DecryptBlock(cBlock, firstBlockNo, fileID)
|
pBlock, err = be.DecryptBlock(cBlock, blockNo, fileID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if be.forceDecode && err == stupidgcm.ErrAuth {
|
if be.forceDecode && err == stupidgcm.ErrAuth {
|
||||||
tlog.Warn.Printf("DecryptBlocks: authentication failure in block #%d, overridden by forcedecode", firstBlockNo)
|
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)
|
pBuf.Write(pBlock)
|
||||||
be.pBlockPool.Put(pBlock)
|
be.pBlockPool.Put(pBlock)
|
||||||
firstBlockNo++
|
blockNo++
|
||||||
}
|
}
|
||||||
return pBuf.Bytes(), err
|
return pBuf.Bytes(), err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user