Commit graph

156 commits

Author SHA1 Message Date
Paul Lawrence
4a36ca0038 am 6a69cfc4: Make encryption configurable
* commit '6a69cfc411c086f15d59b7dc105763af16620414':
  Make encryption configurable
2015-01-26 15:53:01 +00:00
Kenny Root
ba5834dcea am 26970299: Merge "Remove superfluous OpenSSL include paths."
* commit '269702997153cdf92c65cfee277c76afed44e9e5':
  Remove superfluous OpenSSL include paths.
2015-01-23 01:17:16 +00:00
Adam Langley
41405bb3e5 Remove superfluous OpenSSL include paths.
The libcrypto and libssl modules (and their respective static and host
versions) use LOCAL_EXPORT_C_INCLUDE_DIRS thus just including the module
is sufficient.

Additionally, cryptfs.h was including an OpenSSL header just to get the
length of a SHA-256 hash. Rather than force all users of this header to
also depend on libcrypto, it's easier just to define that value in the
header file.

Change-Id: I3e3e0db906a212e1093944b298e4a8ff2e2fb07d
2015-01-22 16:45:28 -08:00
Paul Lawrence
6a69cfc411 Make encryption configurable
Add maybeenabledefaultencryption function, that encrypts based
on the encryption flag and appropriate environment variable

Bug: 18764230
Change-Id: Id9a1967d09a7ae63a51240c0a5f3c41505af0e9a
2015-01-21 10:00:17 -08:00
Brian Carlstrom
da91b1915c Remove unused local variable to fix the build
Change-Id: Ic0a77a754b649d360d07eaa9e6a93274e7eaf0a8
2014-12-18 17:01:40 -08:00
Dan Albert
210caabdb5 resolved conflicts for merge of 88aba541 to lmp-mr1-dev-plus-aosp
Change-Id: Ie5ef819dd8168cb6a73f84a881a92c116705fffc
2014-12-18 14:08:43 -08:00
Dan Albert
c07fa3fa5a Fix alignment of buffer used for dm_ioctl.
Since the dm_ioctl struct was being allocated on the stack as a large
character array, it was getting character alignment rather than the
proper alignment for the struct. GCC had been getting away with this
so far, but it's undefined behavior that clang managed to expose.

Bug: 18736778
Change-Id: Ied275dfad7fcc41d712b2d02c8a185f499221f57
2014-12-18 10:24:23 -08:00
Tim Murray
6c78e7d772 resolved conflicts for merge of 4be36106 to lmp-mr1-dev-plus-aosp
Change-Id: If504710a618d8c3adf85297d5fd2909558ed57a3
2014-12-17 16:41:07 -08:00
Tim Murray
8439dc9fd5 Make vold compile with -Werror -Wall.
-Wno-missing-field-initializers is used as well, but that is an
overzealous warning from initializing structs with {0} and not a
real warning.

bug 18736778 and 16868177

Change-Id: Iffde89cd7200d9a11193e1614f1819f9fcace30a
2014-12-18 00:21:21 +00:00
Paul Lawrence
6322302a5a am acfdc30e: Merge "Fix error in clocks leading to devices staying unlocked" into lmp-mr1-dev
* commit 'acfdc30e3793512de4b9a5e15da69533735dd8be':
  Fix error in clocks leading to devices staying unlocked
2014-12-02 18:54:41 +00:00
Paul Lawrence
82b451dacb am d44a8f59: Merge "Fix encrypt-and-wipe" into lmp-mr1-dev
* commit 'd44a8f59a7518b87a3fe4174c78dfb9727e63f89':
  Fix encrypt-and-wipe
2014-12-02 18:45:42 +00:00
Paul Lawrence
acfdc30e37 Merge "Fix error in clocks leading to devices staying unlocked" into lmp-mr1-dev 2014-12-02 18:34:14 +00:00
Paul Lawrence
ef2b5bea6b Fix error in clocks leading to devices staying unlocked
Use BOOTTIME consistently!

Bug: 18246810
Change-Id: I630bf39f72ab69f971d2f772e8d4545ffe467b82
2014-12-02 08:03:15 -08:00
Paul Lawrence
b1eb7a06ee Fix encrypt-and-wipe
encrypt-and-wipe was broken when checks were added that encryption succeeded
which assumed a 'normal' full encrypt traversing the device.

encrypt-and-wipe doesn't traverse, it just lays down a file system over
the encrypted device, so in this mode do not check the amount encrypted -
it will always be 0.

Bug: 18511900
Change-Id: Icb1d7e0cdb67abd2eac0ab3cbfc1a88912768f9d
2014-12-02 16:02:05 +00:00
Iliyan Malchev
c9c5171792 am bb7d9afe: fall back to dm-crypt if device already encrypted
* commit 'bb7d9afea9479eabbc98133d3d968225a1e1019e':
  fall back to dm-crypt if device already encrypted
2014-11-21 08:56:42 +00:00
Iliyan Malchev
b7d35115dc resolved conflicts for merge of 87701e27 to lmp-mr1-dev-plus-aosp
Change-Id: Ie873baff626fe786515497f2e81aa9db2329168d
2014-11-21 00:52:40 -08:00
Iliyan Malchev
bb7d9afea9 fall back to dm-crypt if device already encrypted
Devices already encrypted with aes-cbc-essiv:sha256 will continue to be
decrypted in software, until a factory data reset.  New devices that
implement CONFIG_HW_DISK_ENCRYPTION will switch to aes-xts.

b/17475056 Enable hardware crypto for userdata encryption

Change-Id: I62d1583bdaf7ff06b87e386e758fa3b18c719bca
Signed-off-by: Iliyan Malchev <malchev@google.com>
2014-11-21 08:19:33 +00:00
Ajay Dudani
87701e2755 Adding support of dm-req-crypt
Currently Android provides disk encryption support using dm-crypt
which is based on bios. dm-crypt uses 512 bytes packet size for
crypto operations. While 512 bytes size packet is ok for SW based
disk encryption, it is inefficient for HW based crypto engines.
dm-req-crypt is similar to dm-crypt except it uses block requests
rathe bios for crypto operations. block requests when unpacked
carries data upto 512KB. Hence, HW based crypto engine can be used
more efficiently.

Also move create disk encryption key before framework start as
HW based disk encryption creates key in secure side. Key creation
can take sometime to create the key securely. If framework is
started before creating the key, it is possible that framework
requests service from secure side. Secure side can serve mostly one
request at a time. Secure side may reject framework request if key
creation request is still going on. This may cause problem in the
system

b/17475056 Enable hardware crypto for userdata encryption

Change-Id: I5480ab72a37c02532218a18faaba598a824589fd
Signed-off-by: Iliyan Malchev <malchev@google.com>
2014-11-21 08:17:32 +00:00
Shawn Willden
b4be7416f8 Modify vold to check for hardware keymaster.
automerge: 7c49ab0

* commit '7c49ab0a0b3c1ee9b24a4b0b1a2c0a8c86acea41':
  Modify vold to check for hardware keymaster.
2014-11-05 18:03:47 +00:00
Shawn Willden
7c49ab0a0b Modify vold to check for hardware keymaster.
vold should only use hardware keymaster implementations to protect the
disk encryption key, because there's little value in using the software
implementation.  More importantly, if we allow vold to use softkeymaster
in the absence of a HW keymaster and (somehow) a HW keymaster is added
to a device, the HW version will be loaded, and will be unable to use
the softkeymaster key found in the crypto footer, forcing a factory
reset.

This CL will not break devices without HW keymaster, because
softkeymaster currently reports its keys as non-standalone (which isn't
correct).  After this CL is in, I will fix softkeymaster.

Bug: 17362157
Change-Id: I98b169e7a59ff7d44b72069b87743463ec823ea2
2014-11-04 17:58:12 +00:00
Rubin Xu
84f2515008 Merge "Make persistent field in cryptofs support longer values." into lmp-mr1-dev
automerge: 13c3a90

* commit '13c3a90b586d272b391bd0e2795717db75a4d853':
  Make persistent field in cryptofs support longer values.
2014-10-30 18:59:11 +00:00
Rubin Xu
85c01f95c7 Make persistent field in cryptofs support longer values.
Store long field values in multiple underlying fixed-length entries
and concatenate them together when reading back.

Bug: 17556485
Change-Id: I2f8033d18c208993fa1b010712be0dad5d8b646b
2014-10-24 10:56:02 +01:00
JP Abgrall
9b5a381241 cryptfs: [HACK] reboot if the crypto block dev failed to open
automerge: 512f0d5

* commit '512f0d52ac5f85b327872e085d9fe6f02517eadf':
  cryptfs: [HACK] reboot if the crypto block dev failed to open
2014-10-17 00:21:22 +00:00
JP Abgrall
4c9b4d8c97 am 7776871d: cryptfs: extra debugging around crypto blockdev dm-... errors.
* commit '7776871d82050bac3e6bb307a68caef973305516':
  cryptfs: extra debugging around crypto blockdev dm-... errors.
2014-10-16 21:01:28 +00:00
JP Abgrall
512f0d52ac cryptfs: [HACK] reboot if the crypto block dev failed to open
There are cases where the /dev/block/dm-0 fails to open.
This leads to the device not completing the boot up sequence.
Currently, the only way out is to reboot.

Bug: 17898962
Change-Id: If4583ebb1ef1ebdbaf680d69b876459aaec2f4ce
(cherry picked from commit 7fc1de8a44)
2014-10-16 20:55:52 +00:00
JP Abgrall
ca42022cf0 am 7fc1de8a: cryptfs: [HACK] reboot if the crypto block dev failed to open
* commit '7fc1de8a44307d6c51826ab90f804702e08d1e6d':
  cryptfs: [HACK] reboot if the crypto block dev failed to open
2014-10-13 20:36:52 +00:00
JP Abgrall
03279172e9 am 3334c6a1: cryptfs: extra debugging around crypto blockdev dm-... errors.
* commit '3334c6a1ae38b2c7886fc9c0a69467e586af8635':
  cryptfs: extra debugging around crypto blockdev dm-... errors.
2014-10-13 19:07:27 +00:00
JP Abgrall
7fc1de8a44 cryptfs: [HACK] reboot if the crypto block dev failed to open
There are cases where the /dev/block/dm-0 fails to open.
This leads to the device not completing the boot up sequence.
Currently, the only way out is to reboot.

Bug: 17898962
Change-Id: If4583ebb1ef1ebdbaf680d69b876459aaec2f4ce
2014-10-10 18:51:24 -07:00
JP Abgrall
3334c6a1ae cryptfs: extra debugging around crypto blockdev dm-... errors.
Some times the /dev/block/dm-0 fails to open after it has been setup.
Log why.

Bug: 17576594
Bug: 17942270
Change-Id: If0bbfe22d84137f2029bacb10873832038f0d36c
2014-10-10 18:51:06 -07:00
JP Abgrall
7776871d82 cryptfs: extra debugging around crypto blockdev dm-... errors.
Some times the /dev/block/dm-0 fails to open after it has been setup.
Log why.

Bug: 17576594
Bug: 17942270
Change-Id: If0bbfe22d84137f2029bacb10873832038f0d36c
2014-10-10 15:52:11 -07:00
Paul Lawrence
2e83bfa43d am fc615041: Remove possibility of zero chars from passwords
* commit 'fc61504166d4377a1f83211c236ca11260da1261':
  Remove possibility of zero chars from passwords
2014-10-07 00:34:56 +00:00
Paul Lawrence
fd2180a972 am fc615041: Remove possibility of zero chars from passwords
* commit 'fc61504166d4377a1f83211c236ca11260da1261':
  Remove possibility of zero chars from passwords
2014-10-06 22:49:36 +00:00
Paul Lawrence
fc61504166 Remove possibility of zero chars from passwords
scrypt pads the password with zeros. Our patterns use 0 to represent
the top left dot. So patterns that end there are equivalent to ones
that end one short.

After much thought, the best solution is to change the way we
represent patterns in keyguard. This, however, is a big change.

The short term solution is to change the pattern representation in vold
so that we are storing the correct thing. Later we will change keyguard
to handle patterns correctly and remove quite a few hacks from vold
(use of hex, this code). b/17840293 created to track this.

Bug: 17751714
Change-Id: I30cdffb0f0db406d2e2b6c54d4153d120d975318
2014-10-06 14:39:31 -07:00
Paul Lawrence
4465744614 am 7639a6ab: Merge "Reset failed decryption count on successful decryptions" into lmp-dev
* commit '7639a6ab60426bbfa57c750c1ff0b4016cad0294':
  Reset failed decryption count on successful decryptions
2014-10-05 23:38:39 +00:00
Paul Lawrence
6bcac81e6a am 7639a6ab: Merge "Reset failed decryption count on successful decryptions" into lmp-dev
* commit '7639a6ab60426bbfa57c750c1ff0b4016cad0294':
  Reset failed decryption count on successful decryptions
2014-10-05 23:27:41 +00:00
Paul Lawrence
7639a6ab60 Merge "Reset failed decryption count on successful decryptions" into lmp-dev 2014-10-05 23:24:46 +00:00
Paul Lawrence
72b8b82780 Reset failed decryption count on successful decryptions
Bug: 17866359
Change-Id: I1af2ff1ac4f5243afba0cfa2f2d3a1d0b029091b
2014-10-05 22:38:04 +00:00
Greg Hackmann
72498ed5c2 am 6e8440fd: cryptfs: kill processes with open files on tmpfs /data
* commit '6e8440fd5072a673dd861ffb531fc17b4673ad90':
  cryptfs: kill processes with open files on tmpfs /data
2014-10-03 06:16:58 +00:00
Paul Lawrence
17fb62cebb am 9c58a871: Use monotonic clock for cryptfs progress
* commit '9c58a871f9fb356409d3b90734bf706d1463f041':
  Use monotonic clock for cryptfs progress
2014-10-03 06:16:57 +00:00
Greg Hackmann
b69a5e44db am 6e8440fd: cryptfs: kill processes with open files on tmpfs /data
* commit '6e8440fd5072a673dd861ffb531fc17b4673ad90':
  cryptfs: kill processes with open files on tmpfs /data
2014-10-03 03:54:44 +00:00
Greg Hackmann
6e8440fd50 cryptfs: kill processes with open files on tmpfs /data
cryptfs will fail to remount /data at boot if any processes (e.g.
dex2oat) have files open on the tmpfs /data partition.  Since these
files are about to be destroyed anyway, just kill the offending
processes: first with SIGHUP and finally with SIGKILL.

Also remove a stray i++ that effectively cut the number of retries in
half.

Bug: 17576594

Change-Id: I76fb90ce2e52846ffb9de706e52b7bde98b4186a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-10-02 18:05:40 -07:00
Paul Lawrence
f2eabef83f am 9c58a871: Use monotonic clock for cryptfs progress
* commit '9c58a871f9fb356409d3b90734bf706d1463f041':
  Use monotonic clock for cryptfs progress
2014-09-30 18:19:43 +00:00
Paul Lawrence
9c58a871f9 Use monotonic clock for cryptfs progress
Otherwise we get strange results when the time changes. Worst
effect is that the encryption takes a lot longer since we are
calling the logging code far more frequently.

Bug: 17625981
Change-Id: Ice29f28b3720e9e4a1ea28e45eeab574d1959ec1
2014-09-30 09:12:51 -07:00
Greg Hackmann
fd8d08c22a am 3574b085: Merge "cryptfs: log umount() failure reason" into lmp-dev
* commit '3574b085f46a5b22ee660a9fd3ef727a20c106ee':
  cryptfs: log umount() failure reason
2014-09-26 00:21:50 +00:00
Greg Hackmann
7103f41a17 am 46a3a79a: Merge "print information about opened files when failed unmount" into lmp-dev
* commit '46a3a79a8f6b8b8eb66b1194a1a56b0ddcd4943b':
  print information about opened files when failed unmount
2014-09-26 00:21:49 +00:00
Jeff Sharkey
714526434c am dd1a8040: Include reason when wiping data.
* commit 'dd1a8040e8449cc0e8b861a23e0339a43d80593c':
  Include reason when wiping data.
2014-09-26 00:21:49 +00:00
Greg Hackmann
e46f7122e0 am 3574b085: Merge "cryptfs: log umount() failure reason" into lmp-dev
* commit '3574b085f46a5b22ee660a9fd3ef727a20c106ee':
  cryptfs: log umount() failure reason
2014-09-24 23:35:42 +00:00
Greg Hackmann
e2a470f398 am 46a3a79a: Merge "print information about opened files when failed unmount" into lmp-dev
* commit '46a3a79a8f6b8b8eb66b1194a1a56b0ddcd4943b':
  print information about opened files when failed unmount
2014-09-24 23:35:42 +00:00
Jeff Sharkey
640aa86222 am dd1a8040: Include reason when wiping data.
* commit 'dd1a8040e8449cc0e8b861a23e0339a43d80593c':
  Include reason when wiping data.
2014-09-24 23:35:41 +00:00
Greg Hackmann
3574b085f4 Merge "cryptfs: log umount() failure reason" into lmp-dev 2014-09-24 23:32:00 +00:00