hotfix: kopia-0.5.0 did not properly support 256-bit hashes

This commit is contained in:
Jarek Kowalski
2020-03-13 07:51:08 -07:00
parent 159d736b2e
commit 34a6644dfe

View File

@@ -384,10 +384,15 @@ func (bm *lockFreeManager) encryptAndWriteContentNotLocked(ctx context.Context,
hash := bm.hashData(data)
blobID := prefix + blob.ID(hex.EncodeToString(hash))
iv, err := getIndexBlobIV(blobID)
if err != nil {
return "", errors.Wrap(err, "unable to get IV from index blob")
}
// Encrypt the content in-place.
atomic.AddInt64(&bm.stats.EncryptedBytes, int64(len(data)))
data2, err := bm.encryptor.Encrypt(data, hash)
data2, err := bm.encryptor.Encrypt(data, iv)
if err != nil {
return "", err
}