]> git.apps.os.sepia.ceph.com Git - fscrypt.git/log
fscrypt.git
8 years agoMerge pull request #49 from google/misc
Joseph Richey [Wed, 30 Aug 2017 02:06:26 +0000 (19:06 -0700)]
Merge pull request #49 from google/misc

Fix a wide variety of small issues and update documentation

8 years agoMerge pull request #48 from google/contrib
Joseph Richey [Tue, 29 Aug 2017 23:53:16 +0000 (16:53 -0700)]
Merge pull request #48 from google/contrib

Update CONTRIBUTING.md to explain how issues will work

8 years agoMerge pull request #47 from google/build_tags
Joseph Richey [Tue, 29 Aug 2017 23:47:19 +0000 (16:47 -0700)]
Merge pull request #47 from google/build_tags

Makefile: Build version flag no longer needs repo

8 years agoREADME: Clarified boot related encryption issues
Joe Richey [Tue, 29 Aug 2017 18:57:34 +0000 (11:57 -0700)]
README: Clarified boot related encryption issues

8 years agoCONTRIBUTING: typo
Joe Richey [Tue, 29 Aug 2017 18:23:26 +0000 (11:23 -0700)]
CONTRIBUTING: typo

8 years agocrypto: Handle when "ulimit -l" is too low
Joe Richey [Tue, 29 Aug 2017 18:17:10 +0000 (11:17 -0700)]
crypto: Handle when "ulimit -l" is too low

8 years agoFixed typos
Joe Richey [Tue, 29 Aug 2017 17:25:53 +0000 (10:25 -0700)]
Fixed typos

8 years agoAdded +build linux,cgo flags
Joe Richey [Tue, 29 Aug 2017 17:23:54 +0000 (10:23 -0700)]
Added +build linux,cgo flags

8 years agoCONTRIBUTING: Make it clear how issues work
Joe Richey [Tue, 29 Aug 2017 16:46:12 +0000 (09:46 -0700)]
CONTRIBUTING: Make it clear how issues work

8 years agoMakefile: Build version flag no longer needs repo
Joe Richey [Tue, 29 Aug 2017 16:05:02 +0000 (09:05 -0700)]
Makefile: Build version flag no longer needs repo

8 years agoMerge pull request #44 from mhalcrow/master
Joseph Richey [Mon, 28 Aug 2017 20:02:18 +0000 (13:02 -0700)]
Merge pull request #44 from mhalcrow/master

Fix typo (once -> one).

8 years agoFix typo (once -> one).
Michael Halcrow [Fri, 25 Aug 2017 21:45:09 +0000 (14:45 -0700)]
Fix typo (once -> one).

8 years agoMerge pull request #25 from google/fix
Joseph Richey [Thu, 24 Aug 2017 07:53:11 +0000 (00:53 -0700)]
Merge pull request #25 from google/fix

fscrypt PAM module

8 years agoUpdated documentation for PAM module help
Joseph Richey [Thu, 24 Aug 2017 07:29:54 +0000 (00:29 -0700)]
Updated documentation for PAM module help

8 years agosecurity: fscrypt now possesses the user keyring
Joseph Richey [Thu, 24 Aug 2017 06:46:54 +0000 (23:46 -0700)]
security: fscrypt now possesses the user keyring

8 years agopam_fscrypt: Session accounting completed
Joe Richey joerichey@google.com [Thu, 24 Aug 2017 01:51:23 +0000 (18:51 -0700)]
pam_fscrypt: Session accounting completed

8 years agoAdded some documentation and improved security API
Joe Richey joerichey@google.com [Wed, 23 Aug 2017 19:29:10 +0000 (12:29 -0700)]
Added some documentation and improved security API

8 years agopam_fscrypt: lock all PAM policies w/ flag
Joe Richey joerichey@google.com [Tue, 22 Aug 2017 22:41:18 +0000 (15:41 -0700)]
pam_fscrypt: lock all PAM policies w/ flag

8 years agopam_fscrypt: Updated module to use new APIs
Joe Richey joerichey@google.com [Tue, 22 Aug 2017 21:15:58 +0000 (14:15 -0700)]
pam_fscrypt: Updated module to use new APIs

8 years agosecurity: Moved cache dropping function
Joe Richey joerichey@google.com [Tue, 22 Aug 2017 19:52:41 +0000 (12:52 -0700)]
security: Moved cache dropping function

8 years agoUpdated documentation and build system for PAM
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 22:42:31 +0000 (15:42 -0700)]
Updated documentation and build system for PAM

8 years agopam_fscrypt: The actual PAM module and config
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 22:41:23 +0000 (15:41 -0700)]
pam_fscrypt: The actual PAM module and config

8 years agoVarious small nits a helper functions for PAM
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 22:40:35 +0000 (15:40 -0700)]
Various small nits a helper functions for PAM

8 years agoMerge pull request #39 from google/purge
Joseph Richey [Tue, 22 Aug 2017 18:46:39 +0000 (11:46 -0700)]
Merge pull request #39 from google/purge

Purge command now clears cache

8 years agosecurity: Fixed typo and improved error handling
Joe Richey joerichey@google.com [Tue, 22 Aug 2017 18:32:03 +0000 (11:32 -0700)]
security: Fixed typo and improved error handling

8 years agocmd/fscrypt: purge command now clears cache
Joe Richey joerichey@google.com [Wed, 16 Aug 2017 01:11:29 +0000 (18:11 -0700)]
cmd/fscrypt: purge command now clears cache

8 years agoMerge pull request #37 from google/keyring
Joseph Richey [Tue, 15 Aug 2017 20:46:32 +0000 (13:46 -0700)]
Merge pull request #37 from google/keyring

crypto: Switch from session to user keyring

8 years agoMerge pull request #36 from google/memory
Joseph Richey [Tue, 15 Aug 2017 20:46:04 +0000 (13:46 -0700)]
Merge pull request #36 from google/memory

util: Slice/Pointer conversion fits in MatInt32

8 years agocrypto: Switch from session to user keyring
Joe Richey joerichey@google.com [Tue, 15 Aug 2017 19:06:11 +0000 (12:06 -0700)]
crypto: Switch from session to user keyring

8 years agoutil: Slice/Pointer conversion fits in MatInt32
Joseph Richey [Mon, 14 Aug 2017 00:40:15 +0000 (17:40 -0700)]
util: Slice/Pointer conversion fits in MatInt32

8 years agoMerge pull request #33 from ebiggers/fix_hashing_calibration
Joseph Richey [Mon, 7 Aug 2017 18:21:13 +0000 (11:21 -0700)]
Merge pull request #33 from ebiggers/fix_hashing_calibration

actions: calculate password hash difficulty correctly

8 years agoMerge pull request #32 from ebiggers/ErrKeyFileLength_fix
Joseph Richey [Mon, 7 Aug 2017 17:29:58 +0000 (10:29 -0700)]
Merge pull request #32 from ebiggers/ErrKeyFileLength_fix

cmd/fscrypt: fix help message for ErrKeyFileLength

8 years agoactions: calculate password hash difficulty correctly
Eric Biggers [Mon, 7 Aug 2017 17:05:53 +0000 (10:05 -0700)]
actions: calculate password hash difficulty correctly

'fscrypt setup' is supposed to calibrate the Argon2 password hashing
difficulty to 1s by default, but actually it was setting it to only 1s /
num_cpus because the hashing is done with all CPUs and it is timed using
the CLOCK_PROCESS_CPUTIME_ID clock, which measures the time spent by all
threads in the process.  Fix this by dividing the elapsed time by
HashingCosts.Parallelism, which is used as the number of threads.

8 years agocmd/fscrypt: fix help message for ErrKeyFileLength
Eric Biggers [Mon, 7 Aug 2017 16:51:20 +0000 (09:51 -0700)]
cmd/fscrypt: fix help message for ErrKeyFileLength

The key file for the raw_key source is required to contain a wrapping
key (32 bytes), not a policy key (64 bytes).

8 years agoMerge pull request #30 from google/josephlr-patch-1
Joseph Richey [Tue, 25 Jul 2017 09:54:25 +0000 (02:54 -0700)]
Merge pull request #30 from google/josephlr-patch-1

README reformatting

8 years agoREADME reformatting
Joseph Richey [Tue, 25 Jul 2017 09:53:13 +0000 (02:53 -0700)]
README reformatting

The version badge was broken. This fixes it and inlines the version in the top line.

8 years agoMerge pull request #29 from google/docs
Joseph Richey [Sun, 23 Jul 2017 09:21:16 +0000 (02:21 -0700)]
Merge pull request #29 from google/docs

Fixed cloning instructions

8 years agoREADME: Fixed cloning documentation
Joseph Richey [Sun, 23 Jul 2017 09:10:36 +0000 (02:10 -0700)]
README: Fixed cloning documentation

8 years agoMerge pull request #27 from google/tests
Joseph Richey [Thu, 20 Jul 2017 01:17:29 +0000 (18:17 -0700)]
Merge pull request #27 from google/tests

coveralls: Adding Travis CI integration

8 years agoBuild system: no longer run make gen for make all
Joe Richey joerichey@google.com [Thu, 20 Jul 2017 01:10:18 +0000 (18:10 -0700)]
Build system: no longer run make gen for make all

8 years agocrypto: Add more tests for bad key lengths
Joe Richey joerichey@google.com [Thu, 20 Jul 2017 00:54:12 +0000 (17:54 -0700)]
crypto: Add more tests for bad key lengths

8 years agoREADME: add badges for license and code coverage
Joe Richey joerichey@google.com [Thu, 20 Jul 2017 00:42:44 +0000 (17:42 -0700)]
README: add badges for license and code coverage

8 years agocoveralls: Adding Travis CI integration
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 23:55:43 +0000 (16:55 -0700)]
coveralls: Adding Travis CI integration

8 years agoMerge pull request #23 from google/fix
Joseph Richey [Wed, 19 Jul 2017 04:51:15 +0000 (21:51 -0700)]
Merge pull request #23 from google/fix

travis CI: Test config file

8 years agoMakefile: typo
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 04:18:22 +0000 (21:18 -0700)]
Makefile: typo

8 years agoUpdate documentation about new build system
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 04:09:55 +0000 (21:09 -0700)]
Update documentation about new build system

8 years agometadata: Remove "go generate" and regenerate
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 04:09:24 +0000 (21:09 -0700)]
metadata: Remove "go generate" and regenerate

8 years agotests: Unit tests and Integration tests work
Joe Richey joerichey@google.com [Wed, 19 Jul 2017 04:08:02 +0000 (21:08 -0700)]
tests: Unit tests and Integration tests work

Now the testing functions will skip the integration tests if a testing
filesystem is not specified.

8 years agoTravis.yml and Makefile now run integration tests.
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 18:04:50 +0000 (11:04 -0700)]
Travis.yml and Makefile now run integration tests.

8 years agoMerge pull request #22 from google/fix
Joseph Richey [Tue, 18 Jul 2017 17:59:40 +0000 (10:59 -0700)]
Merge pull request #22 from google/fix

Fixing fscrypt build system

8 years agoactions: Fixed flaky hashing test
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 06:29:27 +0000 (23:29 -0700)]
actions: Fixed flaky hashing test

8 years agoBetter output for input_fail.py
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 06:25:48 +0000 (23:25 -0700)]
Better output for input_fail.py

8 years agocmd/fscrypt: more nits to fix "make lint"
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 06:18:49 +0000 (23:18 -0700)]
cmd/fscrypt: more nits to fix "make lint"

8 years agoSmall fixes so "make lint" doesn't complain.
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 06:16:00 +0000 (23:16 -0700)]
Small fixes so "make lint" doesn't complain.

8 years agopam: Added missing documentation (fix "make lint")
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 06:04:47 +0000 (23:04 -0700)]
pam: Added missing documentation (fix "make lint")

8 years agoChanges from "make format"
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 05:52:51 +0000 (22:52 -0700)]
Changes from "make format"

8 years agoMakefile: Rewrite for presubmit checks
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 05:51:23 +0000 (22:51 -0700)]
Makefile: Rewrite for presubmit checks

The commit reorganizes the Makefile, so that "make check" can run on
each PR to detect any errors.

8 years agoMerge pull request #21 from google/fix
Joseph Richey [Tue, 18 Jul 2017 01:26:19 +0000 (18:26 -0700)]
Merge pull request #21 from google/fix

Add PAM package

8 years agocmd/fscrypt: username and login token fix
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 00:30:46 +0000 (17:30 -0700)]
cmd/fscrypt: username and login token fix

The commit changes how we get the username representation, and uses the
new pam API for checking the proposed login token.

8 years agopam: IsUserLoginToken now uses PAM library
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 00:27:06 +0000 (17:27 -0700)]
pam: IsUserLoginToken now uses PAM library

8 years agopam: Add Go wrappers around PAM functions
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 00:22:54 +0000 (17:22 -0700)]
pam: Add Go wrappers around PAM functions

This commit provides a Go interface to the PAM functions.

8 years agopam: C implementation for conversation and cleanup
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 00:19:37 +0000 (17:19 -0700)]
pam: C implementation for conversation and cleanup

This commit adds in a C implementation for the pam_conv we will use in
login.go as well as adding three CleanupFuncs that will be used with
pam_set_data(). It also adds copyInfoSecret() which should be paired
with freeSecret().

8 years agocrypto: Conversion to/from C strings
Joe Richey joerichey@google.com [Tue, 18 Jul 2017 00:15:15 +0000 (17:15 -0700)]
crypto: Conversion to/from C strings

8 years agopam: Add PAM Items and Flags
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 22:44:57 +0000 (15:44 -0700)]
pam: Add PAM Items and Flags

Code pulled from github.com/msteinert/pam

8 years agoutil: Add conversions for byte/pointer arrays
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 22:40:02 +0000 (15:40 -0700)]
util: Add conversions for byte/pointer arrays

8 years agoMerge pull request #20 from google/fix
Joseph Richey [Mon, 17 Jul 2017 22:12:28 +0000 (15:12 -0700)]
Merge pull request #20 from google/fix

Refactor ReadLine functions

8 years agocmd/fscrypt: prompts now use command functions
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 22:08:19 +0000 (15:08 -0700)]
cmd/fscrypt: prompts now use command functions

8 years agoutil: Move line reading into common package
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 22:01:38 +0000 (15:01 -0700)]
util: Move line reading into common package

8 years agoMerge pull request #19 from google/fix
Joseph Richey [Mon, 17 Jul 2017 20:28:16 +0000 (13:28 -0700)]
Merge pull request #19 from google/fix

Separate encryption support from metadata support

8 years agocmd/fscrypt: Improve "fscrypt status"
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 20:21:11 +0000 (13:21 -0700)]
cmd/fscrypt: Improve "fscrypt status"

Now that we can distinguish between lacking encryption support and
lacking fscrypt metadata, "fscrypt status" can now display this
additional information.

8 years agocmd/fscrypt: Check support before encrypting
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 20:19:43 +0000 (13:19 -0700)]
cmd/fscrypt: Check support before encrypting

Almost all actions only need to to check that the fscrypt metadata
exists (this is handled by the Mount methods). Only "fscrypt encrypt"
need to be sure the filesystem also supports encryption, so this check
is added.

8 years agofilesystem: Distinguish support and setup for fs
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 20:16:03 +0000 (13:16 -0700)]
filesystem: Distinguish support and setup for fs

This commit splits two pieces of functionality. Detecting if the fscrypt
metadata exists is now in CheckSetup() and checking if the filesystem
supports encryption is now in CheckSupport().

8 years agoMerge pull request #18 from google/fix
Joseph Richey [Mon, 17 Jul 2017 20:06:15 +0000 (13:06 -0700)]
Merge pull request #18 from google/fix

Polices can now be directly unlocked with Protectors

8 years agoactions: Add tests for policy unlocking
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 19:32:03 +0000 (12:32 -0700)]
actions: Add tests for policy unlocking

8 years agoactions: Protectors can directly unlock Policies
Joe Richey joerichey@google.com [Mon, 17 Jul 2017 19:15:20 +0000 (12:15 -0700)]
actions: Protectors can directly unlock Policies

In addition to using callbacks, unlocked Protectors can now directly
unlock a policy. The error codes are updated to make more sense.

8 years agoMerge pull request #16 from google/fix
Joseph Richey [Fri, 14 Jul 2017 19:07:33 +0000 (12:07 -0700)]
Merge pull request #16 from google/fix

Use Description when placing keys in the keyring

8 years agoactions: Policies now have Description method
Joe Richey joerichey@google.com [Fri, 14 Jul 2017 19:04:21 +0000 (12:04 -0700)]
actions: Policies now have Description method

8 years agocrypto: Use single description parameter
Joe Richey joerichey@google.com [Fri, 14 Jul 2017 18:43:24 +0000 (11:43 -0700)]
crypto: Use single description parameter

Instead of using the service+descriptor parameters (which are always
combined in the same way), use a single description parameter.

8 years agoMerge pull request #15 from google/fix
Joseph Richey [Fri, 14 Jul 2017 18:38:20 +0000 (11:38 -0700)]
Merge pull request #15 from google/fix

Bug fixing for "fscrypt encrypt"

8 years agocmd/fscrypt: fix protector and policy cleanup
Joe Richey joerichey@google.com [Fri, 14 Jul 2017 18:32:41 +0000 (11:32 -0700)]
cmd/fscrypt: fix protector and policy cleanup

Protectors are only reverted if they were created, and Policies are only
depovisioned on failure.

8 years agovendor: Fixed package list so "make all" will work
Joe Richey joerichey@google.com [Fri, 14 Jul 2017 18:27:06 +0000 (11:27 -0700)]
vendor: Fixed package list so "make all" will work

During an earlier commit the vendor directory was self-referencing
various "fscrypt/<pkg>" packages. This no longer occurs.

8 years agoMerge pull request #14 from google/docs
Joseph Richey [Fri, 14 Jul 2017 03:19:49 +0000 (20:19 -0700)]
Merge pull request #14 from google/docs

Version now uses git tags and releases

8 years agoMakefile: version and data now pulled in directly
Joe Richey joerichey@google.com [Fri, 14 Jul 2017 01:46:18 +0000 (18:46 -0700)]
Makefile: version and data now pulled in directly

8 years agoREADME: Fixed version badge to pull from Git tags
Joseph Richey [Thu, 13 Jul 2017 22:47:40 +0000 (15:47 -0700)]
README: Fixed version badge to pull from Git tags

8 years agoMerge pull request #12 from google/docs
Joseph Richey [Thu, 13 Jul 2017 21:58:07 +0000 (14:58 -0700)]
Merge pull request #12 from google/docs

Cleanup README.md

8 years agoREADME: Add badges for protect, docs, report card
Joseph Richey [Thu, 13 Jul 2017 21:51:38 +0000 (14:51 -0700)]
README: Add badges for protect, docs, report card

8 years agoREADME: fix typos and formatting
Joseph Richey [Thu, 13 Jul 2017 21:50:54 +0000 (14:50 -0700)]
README: fix typos and formatting

Some of the documentation was misspelled or incorrectly formatted.

8 years agoFinalize import paths and documentation
Joe Richey joerichey@google.com [Wed, 28 Jun 2017 20:57:55 +0000 (13:57 -0700)]
Finalize import paths and documentation

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

8 years agoUpdate Makefile and README
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 19:52:21 +0000 (12:52 -0700)]
Update Makefile and README

This commit updates the README and Makefile to get them ready for
external release. This includes adding some common pitfalls, including
example usage, and allowing for tarball creation.

Change-Id: I442338c7aff613a14bae449dbf091bfcaf73ed9d

8 years agocmd/fscrypt: commands to add/remove protectors
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 19:50:11 +0000 (12:50 -0700)]
cmd/fscrypt: commands to add/remove protectors

This commit adds in the "fscrypt metadata add-protector-to-policy" and
the "fscrypt metadata remove-protector-from-policy" subcommands. These
commands allow for the creating of policies protected by multiple
protectors.

Change-Id: Id7e6c057448d15757c838a82d487a1b9806f585d

8 years agocmd/fscrypt: add metadata command
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 17:27:59 +0000 (10:27 -0700)]
cmd/fscrypt: add metadata command

This command adds in the "fscrypt metadata" command. This command allows
advanced users to manipulate the metadata directly instead of just
creating a policy or protector as an option when encrypting a directory.

As some of these methods will require certain flags, error handling for
this case is also added. As the change passphrase method must indicate
when a old vs new password is necessary, additional KeyFuncs are added
which add this indicator.

Change-Id: Ibc92872088fae078df3c0eebd4f0cfcb7252d781

8 years agocmd/fscrypt: add in status and purge commands
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 17:25:01 +0000 (10:25 -0700)]
cmd/fscrypt: add in status and purge commands

This commit adds in the status command, which has 2 functions, allowing
the user to query the state of the entire system or a specific
filesystem.

This commit also adds in the purge command to remove all policy keys
corresponding to a filesystem. This (along with getting the unlock
status for the status commands) uses additional keyctl functionality in
the crypto and actions packages.

Change-Id: Ic8e097b335c044c0b91973eff19753f363f4525d

8 years agocmd/fscrypt: setup, encrypt, unlock commands
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 17:21:21 +0000 (10:21 -0700)]
cmd/fscrypt: setup, encrypt, unlock commands

This commit adds in the framework for adding commands and subcommands to
the fscrypt tool. This commit adds in the "setup", "encrypt", and
"unlock" commands. Additional information can be found by running:
    fscrypt <command> --help.

This commit defines how flags are parsed and errors are handled. It also
creates an extensible framework for prompting the user for information.

Change-Id: I159d7f44ee2b2bbc5e072f0802850e082d9a13ce

8 years agoactions: error handling and API changed
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 17:03:44 +0000 (10:03 -0700)]
actions: error handling and API changed

This commit changes the error handling for the actions package to use
the error handling library github.com/pkg/errors. This means replacing
"errors" with "github.com/pkg/errors", reworking some of the error
values, and wrapping some errors with additional context.

This commit also changes the Protector/Policy API, moving most of the
package functionality into Protector or Policy methods. These types are
now "locked" when they are queried from the filesystem, and Unlock()
must be used to get their corresponding keys. Note that only certain
operations will require unlocking the keys. Certain unnecessary
functions and methods are also removed.

This CL also fixes two bugs reported by Tyler Hicks in CreateConfigFile.
CPU time is used instead of wall time, and kiB is used instead of kB.

Change-Id: I88f45659e9fe4938d148843e3289e7b6d5b698d8

8 years agoChange error handling to new package
Joe Richey joerichey@google.com [Wed, 21 Jun 2017 16:52:40 +0000 (09:52 -0700)]
Change error handling to new package

This commit changes the error handing for the crypto, filesystem,
metadata, pam, and util packages to use the error handling library
github.com/pkg/errors. This means elimination of the FSError type, an
increased use of wrapping errors (as opposed to logging), switching
on the Cause() of an error (as opposed to its value), and improving our
integration tests involving TEST_FILESYSTEM_ROOT.

This commit also fixes a few bugs with the keyring code to ensure that
our {Find|Remove|Insert}PolicyKey functions are always operating on the
same keyring. The check for filesystem support has been moved from the
filesystem package to the metadata package. Finally, the API for the
filesystem package has been slightly modified:
* filesystem.AllFilesystems() now returns all the filesystems in
  sorted order
* certain path methods are now public

O_SYNC is also removed for writing the metadata. We don't get that much
from syncing the metadata, as the actual file data could also be
corrupted by and IO error. The sync operation is also occasionally very
slow (~3 seconds) and can be unfriendly to battery life.

Change-Id: I392c2655141714b16dfdbc84ac09780072be2cf0

8 years agovendor: add in github.com/pkg/errors
Joe Richey joerichey@google.com [Fri, 16 Jun 2017 05:11:50 +0000 (22:11 -0700)]
vendor: add in github.com/pkg/errors

This commit adds in the github.com/pkg/errors package for handling
errors. This allows us to continue to add context to our errors as they
move up the call stack, but still be able to switch on their root cause.

Change-Id: I6fd55f184318ea1e28c93a84444a2627bff03682

8 years agoactions: Simplify the callback mechanism
Joe Richey joerichey@google.com [Thu, 1 Jun 2017 00:54:35 +0000 (17:54 -0700)]
actions: Simplify the callback mechanism

This commit makes the callbacks for getting keys easier to understand.
Functions which need keys now take a KeyFunc callback. This callback
contains a ProtectorInfo parameter (basically a read-only version of
metadata.ProtectorData) and a boolean which indicates if the call is
being retried. The documentation is also updated to say which functions
will retry the KeyFunc.

For selecting a protector, there is now an OptionFunc callback which
takes a slice of ProtectorOptions. A ProtectorOption is a ProtectorInfo
along with additional information about a linked filesystem (if
applicable).

This commit also adds in methods for getting the protector options for a
specific filesystem or policy. It also adds a function for getting the
policy descriptor for a specific path.

Change-Id: I41e0d94ffd44e7166b0c5cf1b5d18437960bdf90

8 years agovendor: update x/sys/unix
Joe Richey joerichey@google.com [Thu, 8 Jun 2017 17:54:14 +0000 (10:54 -0700)]
vendor: update x/sys/unix

This commit updates the vendored x/sys/unix to the current version. This
means that our vendored version of x/sys/unix no longer contains custom
patches. A few changes are needed in InsertPolicyKey() as the final API
differed slightly from our patches.

Change-Id: Ifff31c04e708f9dc4395ab5bfcc94e42fb46dea5

8 years agocrypto: add in additional keyring functionality
Joe Richey joerichey@google.com [Thu, 8 Jun 2017 17:51:04 +0000 (10:51 -0700)]
crypto: add in additional keyring functionality

This commit adds in the FindPolicyKey and RemovePolicyKey functions to
complement the InsertPolicyKey function. The existing functions were
also refactored slightly.

Change-Id: Iabd275f2186a9e3023d5efd44c772966123e3657

8 years agometadata: change encryption mode names
Joe Richey joerichey@google.com [Thu, 8 Jun 2017 17:41:55 +0000 (10:41 -0700)]
metadata: change encryption mode names

As new encryption modes are being added to the kernel that use 128 bit
keys (see https://patchwork.kernel.org/patch/9741913), we will need the
encryption modes to be more descriptive.

This change breaks backwards compatibility for the protobuf, but that's
fine because we have not released yet.

Change-Id: Ifb58d3d5a42db491f1e5393c12f3d260d9a091de