aboutsummaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
authorJoe Richey joerichey@google.com <joerichey@google.com>2017-06-28 13:57:55 -0700
committerJoe Richey joerichey@google.com <joerichey@google.com>2017-06-28 15:15:21 -0700
commit2c52eca8727df744d093703bbcbd87fc39d57d30 (patch)
treece733819f34baacbb67d5dabb5baaa01c6888e9d /filesystem/filesystem_test.go
parentabdd12ff9efa98af245b91517398ad84b42fd90e (diff)
Finalize import paths and documentationv0.1.00.1.0
This commit changes all the internal import paths from `fscrypt/foo` to `github.com/google/fscrypt/foo` so that it can be built once we release externaly. The documentation in README.md is updated accordingly. Also, the README has a note noting that we do not make any guarantees about project stability before 1.0 (when it ships with Ubuntu). Change-Id: I6ba86e442c74057c8a06ba32a42e17f94833e280
Diffstat (limited to 'filesystem/filesystem_test.go')
-rw-r--r--filesystem/filesystem_test.go44
1 files changed, 22 insertions, 22 deletions
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index bcf4f38..16bf82b 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -27,43 +27,43 @@ import (
"github.com/pkg/errors"
- . "fscrypt/crypto"
- . "fscrypt/metadata"
- . "fscrypt/util"
+ "github.com/google/fscrypt/crypto"
+ "github.com/google/fscrypt/metadata"
+ "github.com/google/fscrypt/util"
)
var (
- fakeProtectorKey, _ = NewRandomKey(InternalKeyLen)
- fakePolicyKey, _ = NewRandomKey(PolicyKeyLen)
- wrappedProtectorKey, _ = Wrap(fakeProtectorKey, fakeProtectorKey)
- wrappedPolicyKey, _ = Wrap(fakeProtectorKey, fakePolicyKey)
+ fakeProtectorKey, _ = crypto.NewRandomKey(metadata.InternalKeyLen)
+ fakePolicyKey, _ = crypto.NewRandomKey(metadata.PolicyKeyLen)
+ wrappedProtectorKey, _ = crypto.Wrap(fakeProtectorKey, fakeProtectorKey)
+ wrappedPolicyKey, _ = crypto.Wrap(fakeProtectorKey, fakePolicyKey)
)
// Gets the mount corresponding to the integration test path.
func getTestMount() (*Mount, error) {
- mountpoint, err := TestPath()
+ mountpoint, err := util.TestPath()
if err != nil {
return nil, err
}
mnt, err := GetMount(mountpoint)
- return mnt, errors.Wrapf(err, TestEnvVarName)
+ return mnt, errors.Wrapf(err, util.TestEnvVarName)
}
-func getFakeProtector() *ProtectorData {
- return &ProtectorData{
+func getFakeProtector() *metadata.ProtectorData {
+ return &metadata.ProtectorData{
ProtectorDescriptor: "fedcba9876543210",
Name: "goodProtector",
- Source: SourceType_raw_key,
+ Source: metadata.SourceType_raw_key,
WrappedKey: wrappedProtectorKey,
}
}
-func getFakePolicy() *PolicyData {
- return &PolicyData{
+func getFakePolicy() *metadata.PolicyData {
+ return &metadata.PolicyData{
KeyDescriptor: "0123456789abcdef",
- Options: DefaultOptions,
- WrappedPolicyKeys: []*WrappedPolicyKey{
- &WrappedPolicyKey{
+ Options: metadata.DefaultOptions,
+ WrappedPolicyKeys: []*metadata.WrappedPolicyKey{
+ &metadata.WrappedPolicyKey{
ProtectorDescriptor: "fedcba9876543210",
WrappedKey: wrappedPolicyKey,
},
@@ -124,15 +124,15 @@ func TestAddProtector(t *testing.T) {
}
// Change the source to bad one, or one that requires hashing costs
- protector.Source = SourceType_default
+ protector.Source = metadata.SourceType_default
if mnt.AddProtector(protector) == nil {
t.Error("bad source for a descriptor should make metadata invalid")
}
- protector.Source = SourceType_custom_passphrase
+ protector.Source = metadata.SourceType_custom_passphrase
if mnt.AddProtector(protector) == nil {
t.Error("protectors using passphrases should require hashing costs")
}
- protector.Source = SourceType_raw_key
+ protector.Source = metadata.SourceType_raw_key
// Use a bad wrapped key
protector.WrappedKey = wrappedPolicyKey
@@ -168,11 +168,11 @@ func TestAddPolicy(t *testing.T) {
t.Error("padding not a power of 2 should make metadata invalid")
}
policy.Options.Padding = 16
- policy.Options.Filenames = EncryptionOptions_default
+ policy.Options.Filenames = metadata.EncryptionOptions_default
if mnt.AddPolicy(policy) == nil {
t.Error("encryption mode not set should make metadata invalid")
}
- policy.Options.Filenames = EncryptionOptions_AES_256_CTS
+ policy.Options.Filenames = metadata.EncryptionOptions_AES_256_CTS
// Use a bad wrapped key
policy.WrappedPolicyKeys[0].WrappedKey = wrappedProtectorKey