mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
parent
34f0feb13a
commit
0dcd9794d4
@ -15,7 +15,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"github.com/miscreant/miscreant.go"
|
"github.com/miscreant/miscreant.go"
|
||||||
@ -254,21 +253,26 @@ func encryptFileInfo(fi FileInfo, folderKey *[keySize]byte) FileInfo {
|
|||||||
encryptedFI := encryptBytes(bs, fileKey)
|
encryptedFI := encryptBytes(bs, fileKey)
|
||||||
|
|
||||||
// The vector is set to something that is higher than any other version sent
|
// The vector is set to something that is higher than any other version sent
|
||||||
// previously, assuming people's clocks are correct. We do this because
|
// previously. We do this because
|
||||||
// there is no way for the insecure device on the other end to do proper
|
// there is no way for the insecure device on the other end to do proper
|
||||||
// conflict resolution, so they will simply accept and keep whatever is the
|
// conflict resolution, so they will simply accept and keep whatever is the
|
||||||
// latest version they see. The secure devices will decrypt the real
|
// latest version they see. The secure devices will decrypt the real
|
||||||
// FileInfo, see the real Version, and act appropriately regardless of what
|
// FileInfo, see the real Version, and act appropriately regardless of what
|
||||||
// this fake version happens to be.
|
// this fake version happens to be.
|
||||||
|
// The vector also needs to be deterministic/the same among all trusted
|
||||||
|
// devices with the same vector, such that the pulling/remote completion
|
||||||
|
// works correctly on the untrusted device(s).
|
||||||
|
|
||||||
version := Vector{
|
version := Vector{
|
||||||
Counters: []Counter{
|
Counters: []Counter{
|
||||||
{
|
{
|
||||||
ID: 1,
|
ID: 1,
|
||||||
Value: uint64(time.Now().UnixNano()),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
for _, counter := range fi.Version.Counters {
|
||||||
|
version.Counters[0].Value += counter.Value
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the fake block list. Each block will be blockOverhead bytes
|
// Construct the fake block list. Each block will be blockOverhead bytes
|
||||||
// larger than the corresponding real one and have an encrypted hash.
|
// larger than the corresponding real one and have an encrypted hash.
|
||||||
|
Loading…
Reference in New Issue
Block a user