Skip to content

Commit

Permalink
hotfix: kopia-0.5.0 did not properly support 256-bit hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowalski committed Mar 13, 2020
1 parent 159d736 commit 69a8faa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion repo/content/content_manager_lock_free.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 69a8faa

Please sign in to comment.