From 6b33db119a7af43cd711ede21843b4ed0c72f76e Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Wed, 19 Jul 2017 16:55:43 -0700 Subject: coveralls: Adding Travis CI integration --- .travis.yml | 5 ++--- Makefile | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 12 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/Makefile b/Makefile index e2f0bd9..24f37ee 100644 --- a/Makefile +++ b/Makefile @@ -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 " Date: Wed, 19 Jul 2017 17:42:44 -0700 Subject: README: add badges for license and code coverage --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59df8e4..bf66feb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # fscrypt [![GitHub version](https://badge.fury.io/gh/google%2Ffscrypt.svg)](https://github.com/google/fscrypt/releases) -[![GoDoc](https://godoc.org/github.com/google/fscrypt?status.svg)](https://godoc.org/github.com/google/fscrypt) [![Build Status](https://travis-ci.org/google/fscrypt.svg?branch=master)](https://travis-ci.org/google/fscrypt) +[![Coverage Status](https://coveralls.io/repos/github/google/fscrypt/badge.svg?branch=master)](https://coveralls.io/github/google/fscrypt?branch=master) +[![GoDoc](https://godoc.org/github.com/google/fscrypt?status.svg)](https://godoc.org/github.com/google/fscrypt) [![Go Report Card](https://goreportcard.com/badge/github.com/google/fscrypt)](https://goreportcard.com/report/github.com/google/fscrypt) +[![License](https://img.shields.io/badge/LICENSE-Apache2.0-ff69b4.svg)](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). -- cgit v1.2.3 From a7eb527485dfe8871f303740dec9e67c2ac6bda1 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Wed, 19 Jul 2017 17:54:12 -0700 Subject: crypto: Add more tests for bad key lengths --- crypto/crypto_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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) -- cgit v1.2.3 From 16ec9949f831efd21c78d5f0cb589c40cbbeea33 Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Wed, 19 Jul 2017 18:10:18 -0700 Subject: Build system: no longer run make gen for make all --- CONTRIBUTING.md | 5 +++-- Makefile | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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. diff --git a/Makefile b/Makefile index 24f37ee..4ebbe32 100644 --- a/Makefile +++ b/Makefile @@ -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) -- cgit v1.2.3