diff options
| -rw-r--r-- | .travis.yml | 5 | ||||
| -rw-r--r-- | CONTRIBUTING.md | 5 | ||||
| -rw-r--r-- | Makefile | 25 | ||||
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | crypto/crypto_test.go | 25 |
5 files changed, 48 insertions, 16 deletions
diff --git a/.travis.yml b/.travis.yml index 2a186aa..f530e1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,7 @@ addons: - git # Needed to stop git from getting deleted install: - - make go-tools - - make test-setup + - make travis-install script: - - make check + - make travis-script diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 45c5487..1470fa4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,8 +96,9 @@ be older than v3.0.0. In that case, just get the build [directly from GitHub](https://github.com/google/protobuf/releases/latest). After installing everything, running `make all` will run all the commands -mentioned above. As with `make test`, you can run the integration tests by -either using `make all MOUNT=/path/to/my/filesystem` or using the +mentioned above (except for `make gen` as different versions of protoc can +rearrange things differently). As with `make test`, you can run the integration +tests by either using `make all MOUNT=/path/to/my/filesystem` or using the `make test-setup` and `make test-teardown` commands. `make all` should always be run before submitting a pull request. @@ -82,7 +82,7 @@ override GO_FLAGS += --ldflags '$(GO_LINK_FLAGS)' .PHONY: default all default: $(NAME) -all: gen update format lint default test +all: update format lint default test $(NAME): $(SRC_FILES) go build $(GO_FLAGS) -o $(NAME) $(CMD_PKG) @@ -110,11 +110,18 @@ update: @govendor remove +unused # Format all the Go and C code -.PHONY: format +.PHONY: format format-check format: @gofmt -l -s -w $(GO_FILES) @clang-format -i -style=Google $(C_FILES) +format-check: + @gofmt -s -d $(GO_FILES) \ + | ./input_fail.py "Incorrectly formatted Go files. Run \"make format\"." + @clang-format -i -style=Google -output-replacements-xml $(C_FILES) \ + | grep "<replacement " \ + | ./input_fail.py "Incorrectly formatted C files. Run \"make format\"." + # Run lint rules (skipping generated files) .PHONY: lint lint: @@ -155,14 +162,12 @@ test-teardown: sudo rmdir $(MOUNT) rm -f $(IMAGE) -##### Commands for Travis CI ##### +##### Travis CI Commands +.PHONY: travis-setup travis-script +travis-install: go-tools test-setup + go get -u github.com/mattn/goveralls -.PHONY: check -check: lint default test +travis-script: lint format-check default + goveralls -service=travis-ci @govendor list +missing +external +unused \ | ./input_fail.py "Incorrect vendored dependencies. Run \"make update\"." - @gofmt -s -d $(GO_FILES) \ - | ./input_fail.py "Incorrectly formatted Go files. Run \"make format\"." - @clang-format -i -style=Google -output-replacements-xml $(C_FILES) \ - | grep "<replacement " \ - | ./input_fail.py "Incorrectly formatted C files. Run \"make format\"." @@ -1,9 +1,11 @@ # fscrypt [](https://github.com/google/fscrypt/releases) -[](https://godoc.org/github.com/google/fscrypt) [](https://travis-ci.org/google/fscrypt) +[](https://coveralls.io/github/google/fscrypt?branch=master) +[](https://godoc.org/github.com/google/fscrypt) [](https://goreportcard.com/report/github.com/google/fscrypt) +[](http://www.apache.org/licenses/LICENSE-2.0.html) fscrypt is a high-level tool for the management of [Linux filesystem encryption](https://lwn.net/Articles/639427). diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index a154fbf..58aca9e 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -423,6 +423,18 @@ func TestWrongWrappingKeyLength(t *testing.T) { } } +// Wrong length of unwrapping key should fail +func TestWrongUnwrappingKeyLength(t *testing.T) { + data, err := Wrap(fakeWrappingKey, fakeWrappingKey) + if err != nil { + t.Fatal(err) + } + if k, err := Unwrap(fakeValidPolicyKey, data); err == nil { + k.Wipe() + t.Fatal("using a policy key for unwrapping should fail") + } +} + // Wraping twice with the same keys should give different components func TestWrapTwiceDistinct(t *testing.T) { data1, err := Wrap(fakeWrappingKey, fakeValidPolicyKey) @@ -546,6 +558,19 @@ func TestBadParallelism(t *testing.T) { } } +func TestBadSalt(t *testing.T) { + pk, err := fakePassphraseKey() + if err != nil { + t.Fatal(err) + } + defer pk.Wipe() + + _, err = PassphraseHash(pk, []byte{1, 2, 3, 4}, hashTestCases[0].costs) + if err == nil { + t.Error("too short of salt should be invalid") + } +} + func BenchmarkWrap(b *testing.B) { for n := 0; n < b.N; n++ { Wrap(fakeWrappingKey, fakeValidPolicyKey) |