aboutsummaryrefslogtreecommitdiff
path: root/util/util.go
AgeCommit message (Collapse)Author
2017-10-19fmt almost doneJoe Richey joerichey@google.com
2017-10-19FixesJoe Richey joerichey@google.com
2017-08-30util: Added parsing and effective user functionsJoseph Richey
2017-08-23pam_fscrypt: Session accounting completedJoe Richey joerichey@google.com
2017-08-22security: Moved cache dropping functionJoe Richey joerichey@google.com
2017-08-17cmd/fscrypt: purge command now clears cacheJoe Richey joerichey@google.com
2017-08-13util: Slice/Pointer conversion fits in MatInt32Joseph Richey
2017-07-17util: Add conversions for byte/pointer arraysJoe Richey joerichey@google.com
2017-07-17util: Move line reading into common packageJoe Richey joerichey@google.com
2017-05-31util: better handing of custom errorsJoe Richey joerichey@google.com
This commit changes how we handle InvalidInput and System errors. Instead of having formatting functions, the now just wrap a string and should be created with fmt.Sprintf or similar. We also move all of the error related code into a single place. Finally, the utils package gets additional functionality with MinInt64 and GetUsername, and the UnderlyingError function gets better logging. Note that this will break packages that depend on it. For instance, metadata and crypto currently do not build. This is fixed in a later commit. Change-Id: I819e4d1970604456a5b4b6a7c86426f180a6d092
2017-05-02crypto: reading and writing recovery keysJoe Richey
This commit adds in the concept of recovery codes: human-readable strings that contain the necessary information to rederive a cryptographic key. These keys look like: 73PZBXVP-DKJX7SKV-NNTFIC7A-QEGRPZUX-4K5ORRH2-MTKMKP3B-HFCA==== They are input or output directly to a io.Reader or io.Writer respectively. This prevents the data from passing through unsecured memory before it gets to its destination. Of course, if the provided io.Reader or io.Writer is insecure, there is nothing we can do. In most cases the provided io.Reader or io.Writer will be stdin or stdout. In some rare cases you might want to pipe the output to another key. This commit also adds tests and benchmarks for encoding/decoding recovery codes. It also tests that encoding/decoding will fail in the correct situations. A benchmark is also added to measure the effect of locking the keys in memory. Change-Id: Ifa0bc4c08582789785cf1cdd9a4acfe76c79534f
2017-05-02metadata: get and set policies from goJoe Richey
This commit adds in the ability to get and set policy data from go using the GetPolicy and SetPolicy functions. This is done via a patch of the x/sys/unix package that exposes the filesystem encryption structures. Note that not all the fields of the PolicyData protocol buffer are needed to get and set policies. The wrapped_policy_keys are not used and will be written and read by other components of fscrypt. To run the policy tests, the environment variable BASE_TEST_DIR must be set to a directory for testing on a filesystem that supports encryption. Change-Id: I13b1d983356845f3ffc1945cedf53234218f32e5
2017-05-02util: convenience utilities for fscryptJoe Richey
This commit adds in the util package. This package provides two functions for creating errors. These functions are: - InvalidInputErrorF - bad input from user or caller - SystemErrorF - low level failure It also adds in a small function for converting Go byte slices into C void pointers. This will be very useful for interoperating with C. Change-Id: I87ad7946dd5fa26e28927590aff4bcc9fd5ce4f7