diff options
Diffstat (limited to 'actions')
| -rw-r--r-- | actions/config.go | 5 | ||||
| -rw-r--r-- | actions/policy.go | 2 | ||||
| -rw-r--r-- | actions/recovery.go | 6 |
3 files changed, 8 insertions, 5 deletions
diff --git a/actions/config.go b/actions/config.go index a8eb029..03d6b04 100644 --- a/actions/config.go +++ b/actions/config.go @@ -29,6 +29,7 @@ import ( "time" "golang.org/x/sys/unix" + "google.golang.org/protobuf/proto" "github.com/google/fscrypt/crypto" "github.com/google/fscrypt/filesystem" @@ -210,7 +211,7 @@ func getHashingCosts(target time.Duration) (*metadata.HashingCosts, error) { memoryKiBLimit := memoryBytesLimit() / 1024 for { // Store a copy of the previous costs - costsPrev := *costs + costsPrev := proto.Clone(costs).(*metadata.HashingCosts) tPrev := t // Double the memory up to the max, then double the time. @@ -223,7 +224,7 @@ func getHashingCosts(target time.Duration) (*metadata.HashingCosts, error) { // If our hashing failed, return the last good set of costs. if t, err = timeHashingCosts(costs); err != nil { log.Printf("Hashing with costs={%v} failed: %v\n", costs, err) - return &costsPrev, nil + return costsPrev, nil } log.Printf("Costs={%v}\t-> %v\n", costs, t) diff --git a/actions/policy.go b/actions/policy.go index 3b20176..c621725 100644 --- a/actions/policy.go +++ b/actions/policy.go @@ -25,8 +25,8 @@ import ( "os" "os/user" - "github.com/golang/protobuf/proto" "github.com/pkg/errors" + "google.golang.org/protobuf/proto" "github.com/google/fscrypt/crypto" "github.com/google/fscrypt/filesystem" diff --git a/actions/recovery.go b/actions/recovery.go index 8a769cc..2bb8a23 100644 --- a/actions/recovery.go +++ b/actions/recovery.go @@ -23,6 +23,8 @@ import ( "os" "strconv" + "google.golang.org/protobuf/proto" + "github.com/google/fscrypt/crypto" "github.com/google/fscrypt/metadata" "github.com/google/fscrypt/util" @@ -31,10 +33,10 @@ import ( // modifiedContextWithSource returns a copy of ctx with the protector source // replaced by source. func modifiedContextWithSource(ctx *Context, source metadata.SourceType) *Context { - modifiedConfig := *ctx.Config + modifiedConfig := proto.Clone(ctx.Config).(*metadata.Config) modifiedConfig.Source = source modifiedCtx := *ctx - modifiedCtx.Config = &modifiedConfig + modifiedCtx.Config = modifiedConfig return &modifiedCtx } |