Commit graph

230 commits

Author SHA1 Message Date
Yabin Cui
afaebf1b75 Use libbootloader_message. am: 1fb5966fbb
am: 951de915a3

Change-Id: I6a3291a9930b8e173f9ea7bae6c3f1275b3589ad
2016-06-30 23:11:19 +00:00
Yabin Cui
1fb5966fbb Use libbootloader_message.
Bug: 29582118

Change-Id: I8de2cfbc62908011dba2ab86d17f977ebcfadac0
2016-06-29 16:50:05 -07:00
Seigo Nonaka
e2ef0c0da4 Prepare necessary data directory before loading persistent properties.
init reads files in /data/property/ but it is not ready to read when
trigger_load_persist_props is triggered by vold.decrypt.

Bug: 29332975
Change-Id: I14beac8714ff2f722d8b11f666bc7ca693ccd46e
2016-06-20 17:05:40 +09:00
Paul Lawrence
908527a70b Set encryption mode in mode file am: 6e41059734
am: 3560d44f70

* commit '3560d44f709fc11eda978c4c513c24ed805193cc':
  Set encryption mode in mode file

Change-Id: Iadecc7032a2028f496bb128b0a7f33719187733b
2016-05-27 20:55:00 +00:00
Paul Lawrence
6e41059734 Set encryption mode in mode file
Bug: 28905864
Change-Id: Ie2a5c3e029075d53a86ef3afb7fe364c16d8d52b
2016-05-27 09:40:37 -07:00
Greg Kaiser
e8167afe55 cryptfs: Avoid dereferencing null pointer
We already know that "intermediate_key" is non-NULL here.  We
care if the result of the allocation, "*intermediate_key", is
non-NULL prior to our memcpy.

Change-Id: I83e22dfadabb870d527b93b31470bf47e22201bb
2016-04-20 10:50:15 -07:00
Paul Lawrence
b451785495 Merge "Don\'t start defaultcrypto twice" into nyc-dev am: 0264d8f am: e72c338
am: 85dfdb0

* commit '85dfdb082d87e2e17e69cc74d5b773959b15645c':
  Don't start defaultcrypto twice

Change-Id: Ia3c7998a00bc96dfbb211bfdf733eb22708ad13a
2016-04-19 14:53:04 +00:00
Paul Lawrence
84274cc35c Don't start defaultcrypto twice
The old way (using triggers) starts defaultcrypto twice because
queue_property_triggers_action retriggers the action.

Bug: 27452459

Change-Id: I715d5441f8ae0b820b680f6a75f51694c4420992
2016-04-18 15:39:04 -07:00
Yabin Cui
baeb3b4816 Merge "vold: write bootloader message directly." into nyc-dev am: cbedcc3
am: 008c7dd

* commit '008c7ddb1fe7743f780801c1cf219a3c25445401':
  vold: write bootloader message directly.

Change-Id: I10a098025619c4f32db3ce551a4b85e14a9558a8
2016-04-09 23:12:41 +00:00
Yabin Cui
ffa2e09921 vold: write bootloader message directly.
Bug: 27176738
Change-Id: I09bfe777e383325809d7ecc2dcb9129fe234053f
2016-04-06 17:21:38 -07:00
Paul Lawrence
422a16ecdf Fix some static analyser issues am: 300dae7c38
am: a1b97135eb

* commit 'a1b97135ebf696bbac3bb0e5e477fe5fa467e20b':
  Fix some static analyser issues
2016-03-11 23:47:09 +00:00
Paul Lawrence
300dae7c38 Fix some static analyser issues
Bug: 27099772
Change-Id: Ic96777edf4ea282be2b8f53525226396c01e023c
2016-03-11 11:02:52 -08:00
Paul Lawrence
58ec71b9d4 Merge "Make sure encryption type is set on first boot" into nyc-dev am: 439034b8cc
am: dba928fabd

* commit 'dba928fabdd25b2834d6178c99a1c9557f89fa7c':
  Make sure encryption type is set on first boot
2016-03-11 01:53:43 +00:00
Paul Lawrence
4ed4526e68 Make sure encryption type is set on first boot
Bug: 27599622
Change-Id: I2f38c03941ac8cdba40baf7421132f572866e296
2016-03-10 15:44:21 -08:00
Daniel Rosenberg
200dae0f19 Merge "Add information to error message" into nyc-dev am: 19d76fda3a
am: 7945daa13c

* commit '7945daa13cbadb67f3503a12ccdd76c8ef134367':
  Add information to error message
2016-03-10 00:07:50 +00:00
Daniel Rosenberg
25a5213c1f Add information to error message
Bug: 27452459
Change-Id: I89e813755da0946de4effd827799681df7e12d82
2016-03-09 13:53:39 -08:00
George Burgess IV
605d7ae18d Cleanup uses of sprintf, add modes to open() with O_CREAT.
Change-Id: Iaed2538831b19ada26005bbef33cff28209c6512
2016-03-02 22:42:22 +00:00
Paul Crowley
63c18d3ba9 Add scrypt-based password stretching.
Bug: 27056334
Change-Id: Ifa7f776c21c439f89dad7836175fbd045e1c603e
2016-02-10 14:07:59 +00:00
Paul Crowley
38132a1f66 Refactor now that global DE has been reworked
Change-Id: I4d6156332cfc847e25e7c8863fd6a50fa325fb87
2016-02-09 10:11:42 +00:00
Jeff Sharkey
47695b29af Allow callers to prepare CE/DE user storage.
Give callers the option of preparing CE and/or DE storage.  The
framework will only prepare CE storage after the CE keys have been
unlocked for that user.

When init is calling enablecrypto, kick off the work in a thread so
that we can make other calls back into vold without causing
deadlock.  Leaves blocking call intact for framework callers.

Clean up 'vdc' tool to send useful transaction numbers, and
actually watch for the matching result to come back.  This fixes
race conditions when there are multiple 'vdc' callers.

Also add other system and misc directories to match spec.

Bug: 25796509
Change-Id: Ie4f853db6e387916b845d2b5fb92925d743b063d
2016-02-05 13:03:52 -07:00
Paul Lawrence
5a06a6481b Fix minor issues with previous change
New style logging
Remove set/get field from e4crypt
Save keys to temp file then rename

See https://googleplex-android-review.git.corp.google.com/#/c/858922/

Change-Id: I454c3f78489b491ffc1230a70dce64935e4e0f8a
2016-02-03 13:39:13 -08:00
Paul Lawrence
7b6b565fa0 Remove support for non-default root passwords in FBE
Change-Id: Ie179cb09f9f24382afd0fe0f3aa2a1ad943a7f5d
2016-02-02 12:47:52 -08:00
Jeff Vander Stoep
75fc83bac8 resolve merge conflicts of 2b6f9ce823 to master.
Change-Id: I69f36f560334b11b099f2eb15999603dd2469d4f
2016-02-01 15:24:58 -08:00
Jeff Vander Stoep
df72575862 cryptfs: run e2fsck/fsck.f2fs in fsck domain
e2fsck and fsck.f2fs must run in the fsck domain. Add call to
setexeccon() to tell selinux to run in the fsck domain on exec.

Addresses:
avc: denied { execute_no_trans } for path="/system/bin/e2fsck" dev="mmcblk0p41" ino=241 scontext=u:r:vold:s0 tcontext=u:object_r:fsck_exec:s0 tclass=file

Bug: 26872236
Change-Id: Ib2a583aeefc667f8aa67532e0ac0ff9619b65461
2016-02-01 12:59:59 -08:00
Paul Lawrence
b0f4a229e5 Merge "cryptfs: Skip to encrtypt unused blocks into a block group which uninitialize block bitmap ." am: 1ae498e0d4
am: 9b5db9bcbe

* commit '9b5db9bcbe333b677ca18d2c1c398c8751cd0fd2':
  cryptfs: Skip to encrtypt unused blocks into a block group which uninitialize block bitmap .
2016-01-12 22:21:21 +00:00
liminghao
aa08e58e3a cryptfs: Skip to encrtypt unused blocks into a block group which uninitialize block bitmap .
Bug: 198288

Change-Id: Iaa1a14fd916ddec8dc1a4be18d49732ebcba6884
Signed-off-by: liminghao <liminghao@xiaomi.com>
2016-01-06 15:20:38 +08:00
Paul Lawrence
3d99ebad3d Encrypt on reboot
Change encryption to happen after a reboot, not before. This
removes the problem whereby if data cannot be unmounted, we cannot
encrypt.

Bug: 25426629

Change-Id: I25d610204234ed8254330d001eb965e6e87a2fe9
2015-11-23 12:40:17 -08:00
Kenny Root
873da23cb0 Merge "system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1." am: 0a7e668ebf am: cd6d8e3fb6
am: 03b10c268b

* commit '03b10c268b810c06e31f20fab00ee9bb93d09d01':
  system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1.
2015-11-06 17:27:03 +00:00
Kenny Root
cd6d8e3fb6 Merge "system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1."
am: 0a7e668ebf

* commit '0a7e668ebf7215fbb89837e251f3f73a124adada':
  system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1.
2015-11-06 17:22:59 +00:00
Kenny Root
0a7e668ebf Merge "system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1." 2015-11-06 17:20:30 +00:00
Adam Langley
bf0d972ab4 system/vold: check return value of PKCS5_PBKDF2_HMAC_SHA1.
The function PKCS5_PBKDF2_HMAC_SHA1 can fail for a number of reasons and
thus its return value should be checked and handled.

Change-Id: I0f0d8f74b58940a34df16b88434a085760822075
2015-11-04 14:51:39 -08:00
Paul Lawrence
0c24746627 Add developer option to convert from FDE to FBE
This set of changes adds the screen that offers this conversion,
and the plumbing so the option is only available on suitable
devices.

It does not implement the conversion mechanism.

Change-Id: I801199c37b03436045d40bf8840a8746daf94d27
2015-11-04 05:09:32 -08:00
Paul Lawrence
2309f76d17 Merge "Don't show UI on default encryption" into mnc-dr-dev 2015-10-21 14:27:30 +00:00
David Ng
82fd804f8b vold: Retry opening block device on failure when starting encryption
The device mapper storage device node can take some time to be
created; so retry.

Bug: 23024596
Change-Id: Ieeb3b697f9cef72d4ea9d106750696901f0a224d
2015-10-01 11:45:22 +01:00
Paul Lawrence
569649ff1d Don't show UI on default encryption
Bug: 22989588
Change-Id: I21403233d84031869d929c46c3c7b2ebefb3caff
2015-09-09 12:13:00 -07:00
Paul Lawrence
f733ae6306 Don't break on setting default password
Bug: 22329642
Change-Id: I58dac4dba8e65c7015d50ca0c3575f77f550a215
2015-07-13 16:59:12 +00:00
Shawn Willden
86af3557e3 Add purpose to vold-generated keymaster1 keys.
Also remove the app ID and additional padding and digest options.

Bug: 22009890
Change-Id: Ibff9bbd0e0c11d651d11fac85d4ac907588f1cd2
2015-06-24 09:27:31 -07:00
Shawn Willden
0417060e8e Use correct error code for rate limiting.
Note that this CL depends on cl 712195, which must be submitted first.

Bug: 21607106
Change-Id: Iafc42d1c8a1145a31ea252b33b404044f92ec62b
2015-06-19 09:14:51 -06:00
Shawn Willden
da6e899f4e Add keymaster1 support to vold.
Bug: 21607106
Change-Id: I498141b90888d4f0652912413b04519f61886935
2015-06-17 10:27:07 -06:00
Paul Lawrence
b1ef4665e8 Improve boot time by 0.1s by reducing a polling sleep interval
Bug: 21516860
Change-Id: I9e28f4d9cc20ec2a7d9e325c02ef85f0ad9b3d60
2015-06-11 11:36:18 -07:00
Paul Lawrence
3bd36d5e5f Remove hex encoding and password adjusting now that patterns are '1' based
Bug: 21606650
Change-Id: I3486ad394d563135c5171a1d4785f7a27eeea3ae
2015-06-10 07:21:19 -07:00
Paul Lawrence
86c942a253 DO NOT MERGE Delete password as per block encryption
(cherry-picked from commit 00f4aade5c)

Bug: 18151196
Change-Id: Iee0f932c61ff4a309dc2861725b24bf976adb4c7
2015-05-29 14:22:18 -07:00
Paul Lawrence
2f32cda63b DO NOT MERGE Retry unmounts in ext4 encryption
(cherry-picked from commit 29b54aab8e)

Bug: 18151196
Change-Id: I52ca23b2ce3adcff44bd003d4a12243a0bd6ac34
2015-05-29 14:20:51 -07:00
Paul Lawrence
368d79459e DO NOT MERGE Enable properties in ext4enc
(cherry-picked from 4e7274551c)

Enables OwnerInfo and pattern suppression

Bug: 18151196

Change-Id: I46144e16cb00319deeb5492ab82c67f5dd43d6d3
2015-05-29 14:16:42 -07:00
Paul Lawrence
c78c71b171 DO NOT MERGE Check password is correct by checking hash
(cherry-picked from commit 3ca21e227a)

Handle failures gracefully

Change-Id: Ifb6da8c11a86c50fb11964c18cc1be1326461f78
2015-05-29 14:13:50 -07:00
Paul Lawrence
731a7a242d DO NOT MERGE Securely encrypt the master key
(cherry-picked from commit 707fd6c7cc)

Move all key management into vold
Reuse vold's existing key management through the crypto footer
to manage the device wide keys.

Use ro.crypto.type flag to determine crypto type, which prevents
any issues when running in block encrypted mode, as well as speeding
up boot in block or no encryption.

This is one of four changes to enable this functionality:
  https://android-review.googlesource.com/#/c/148586/
  https://android-review.googlesource.com/#/c/148604/
  https://android-review.googlesource.com/#/c/148606/
  https://android-review.googlesource.com/#/c/148607/

Bug: 18151196

Change-Id: I3c68691717a61b5e1df76423ca0c02baff0dab98
2015-05-29 17:25:54 +00:00
Jeff Sharkey
ce6a913aea Exclusive exec() path, format after partition.
Sadly setexeccon() is process global, so we need to carefully ensure
that all exec() are mutually exclusive to avoid transitioning into
unwanted domains.  Also, because we have several threads floating
around, we need to guard all our FDs with O_CLOEXEC.

Format all newly created volumes immediately after partitioning,
but silence all events emitted from those volumes to prevent the
framework from getting all excited.  Unify all notify events under a
single codepath to make them easy to silence.

Sent SIGINT before escalating to SIGTERM when unmounting.

Bug: 19993667
Change-Id: Idc6c806afc7919a004a93e2240b42884f6b52d6b
2015-04-11 08:48:13 -07:00
Jeff Sharkey
9c48498f45 Support for private (adopted) volumes.
This adds support for private volumes which is just a filesystem
wrapped in a dm-crypt layer.  For now we're using the exact same
configuration as internal encryption (aes-cbc-essiv:sha256), but we
don't store any key material on the removable media.  Instead, we
store the key on internal storage, and use the GPT partition GUID
to identify which key should be used.

This means that private external storage is effectively as secure as
the internal storage of the device.  That is, if the internal storage
is encrypted, then our external storage key is also encrypted.

When partitioning disks, we now support a "private" mode which has
a PrivateVolume partition, and a currently unused 16MB metadata
partition reserved for future use.  It also supports a "mixed" mode
which creates both a PublicVolume and PrivateVolume on the same
disk.  Mixed mode is currently experimental.

For now, just add ext4 support to PrivateVolume; we'll look at f2fs
in a future change.  Add VolumeBase lifecycle for setting up crypto
mappings, and extract blkid logic into shared method.  Sprinkle some
more "static" around the cryptfs code to improve invariants.

Bug: 19993667
Change-Id: Ibd1df6250735b706959a1eb9d9f7219ea85912a0
2015-04-01 10:45:05 -07:00
Jeff Sharkey
36801cccf2 Progress towards dynamic storage support.
Wire up new Disk and VolumeBase objects and events to start replacing
older DirectVolume code.  Use filesystem UUID as visible PublicVolume
name to be more deterministic.

When starting, create DiskSource instances based on fstab, and watch
for kernel devices to appear.  Turn matching devices into Disk
objects, scan for partitions, and create any relevant VolumeBase
objects.  Broadcast all of these events towards userspace so the
framework can decide what to mount.

Keep track of the primary VolumeBase, and update the new per-user
/storage/self/primary symlink for all started users.

Provide a reset command that framework uses to start from a known
state when runtime is restarted.  When vold is unexpectedly killed,
try recovering by unmounting everything under /mnt and /storage
before moving forward.

Remove UMS sharing support for now, since no current devices support
it; MTP is the recommended solution going forward because it offers
better multi-user support.

Switch killProcessesWithOpenFiles() to directly take signal.  Fix
one SOCK_CLOEXEC bug, but SELinux says there are more lurking.

Bug: 19993667
Change-Id: I2dad1303aa4667ec14c52f774e2a28b3c1c1ff6d
2015-03-30 19:46:31 -07:00
Elliott Hughes
2a8c10965a am 8a0fde27: am e9623fed: Merge "Fixed type mismatch for ioctl(BLKGETSIZE)"
* commit '8a0fde272be430f66b2e5db6236aa732d2ba6efc':
  Fixed type mismatch for ioctl(BLKGETSIZE)
2015-03-30 21:28:10 +00:00