Commit Graph

3744 Commits

Author SHA1 Message Date
Ethan Yonker
cd00a8b361 backup: fix return handling when no digest is being created
If the user selects to skip digest creation, Backup_Partition always returned
false. This patch fixes this problem and somewhat cleans up the error
handling.

Change-Id: I1db0e285cd5ed2bd93756cd27c6f56b8415ffa86
2017-07-06 10:23:36 -05:00
Ethan Yonker
da056fdc5b libtar: Fix restore of e4crypt policies
Change-Id: I457356069330c38299fd326181c1c88b12a08dbd
2017-07-06 10:10:13 -05:00
Michael Bestas
c86b6d4312 Complete support for project pathmap
* Use project pathmap when available for LOCAL_C_INCLUDES

Change-Id: Iddc7cc8509d966307c4a490c9d6c15d761dbb3b4
2017-06-24 14:32:07 +02:00
nkk71
9efbe769c3 Fix incorrect 'unlink' return value check
Change-Id: I430f6bb21a5fd87e0422420463e8bb96c4a612e1
2017-06-17 14:21:47 +02:00
bigbiff bigbiff
56cf564658 twrpDigest refactor
This patch is to refactor twrpDigest using polymorphism
and inheritance to use the same call patterns for creating and
reading a digest. Now a library.
Use SHA2 from libcrypto. SHA2 is default if device has libcrypto.

Change string MD5 everywhere to use digest or Digest instead. Updated
string tags to digest. Translation will be required.

Switch out digest code into a driver class from partitionmanager.

SHA2 is better for digest creation due to decreased collision space
compared to MD5 and SHA1.

See https://en.wikipedia.org/wiki/SHA-2

Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f
2017-06-17 07:05:45 -05:00
Dees Troy
92e2531dca Merge "Fix minui issues for some build trees" into android-7.1 2017-06-10 15:52:31 +02:00
big biff
52dc0ea4f9 Merge "ors: Update doc" into android-7.1 2017-06-08 02:08:45 +02:00
Ethan Yonker
39662b2914 Fix minui issues for some build trees
In trees where TWRP is the primary recovery, minui.h was not setting rules
properly for healthd because healthd uses clang. Must use
CLANG_TARGET_GLOBAL_CFLAGS to set global flags.

Change-Id: I4cd9c88f8fcaec345fe012d09abcb9f24be06ef4
2017-06-06 11:32:50 -05:00
nailyk-fr
79605aece1 ors: Update doc
Change-Id: Ia026a8578262d4bb231e1727313ed1f5e323b880
2017-06-05 11:32:23 +02:00
nkk71
ffb02bdfc4 Improve decrypted partition logging
* Partition information should be updated after successful
  decryption (both userdata and adopted) and then logged

* Fix adopted storage nickname being ""

Change-Id: Idcdab84f339e932e62880089bad36e206920dd70
2017-06-04 23:15:05 +03:00
bigbiff bigbiff
4a2a1914a2 adbbackup: write smaller reads less than 512 bytes
This will allow the gzip compression header to be
written properly to the adb stream.

Thanks to nkk71 for finding the issue.
Change-Id: I3d88c5f575ca3fac904d8279f1f246994be2b02f
2017-06-04 04:30:09 +02:00
Ayke van Laethem
05c2de4c68 Fix various memory errors
There were a few memory errors while restoring a backup via adb (created
using `adb backup --twrp`).
On my device (S5 mini) it resulted in this error message:

  FORTIFY: strlen: prevented read past end of buffer

This commit fixes this issue and a few other potential issues.

Change-Id: I5022c94c961217238b3fefec0b2c4b8c6fa26ec7
2017-06-03 02:37:06 +02:00
nkk71
5073003302 cryptfs: Remove dm-crypt device on failed table load
* The dm-crypt device needs to be removed from
   the device-mapper driver list otherwise it will
   remain busy and cannot be used later on by
   other processes (eg vold_decrypt) or for further
   testing/debugging in recovery.

Change-Id: I35e43a79ecc3de234ddb9f87f7d75c6439ea7454
2017-05-23 14:59:57 +02:00
that
9c3b7e990e etc: remove "." from LD_LIBRARY_PATH
We shouldn't load libraries from some random working directory.
For example it breaks busybox when you're in /system/lib.

Change-Id: Ia1f8f4fda9e6182c0cd8c5ac727c2b1eb09c84a2
2017-05-16 22:56:51 +02:00
Michael Bestas
5f05255911 mtdutils: Fix mounting partitions by-name
Change-Id: I8314bb94bf5bcd9576995cd2ecdc5133c5f5ea11
2017-05-15 22:17:39 +02:00
that
0d0d522b88 gui: fix line wrapping in terminal, issue #876
Apparently we are supposed to delay going to the next line until the next
character is printed.

Change-Id: I5cd0cc128cc00dcdd0dd2dd9508281f1249db257
2017-05-15 15:14:32 -05:00
Ethan Yonker
805a5dfe89 3.1.1
Change-Id: I6ab4169836e460d1652d29c24ad1c5a55191efe7
2017-05-12 09:37:41 -05:00
Ethan Yonker
0afc1fdc48 Fix reboot when no OS is present
Change-Id: Idc3d3c79b8a7acf0f632ed39703766005d73de29
2017-05-12 16:21:54 +02:00
Ethan Yonker
84d61ce31c Update TWRP to AOSP 7.1.2
Change-Id: I19c1546efb4182aac62c690e3cc05b04e3a9a32e
2017-05-10 16:11:35 -05:00
Ethan Yonker
6355b56c93 Adopted Storage: backup keys but do not wipe them
Change-Id: I545a32848ee686ecfacd13604ae3f18f5d206dfc
2017-05-01 09:42:17 -05:00
bigbiff bigbiff
b5ecaad27a ADB Backup: fix adb restore issues
Set Backup_FileName on adb backup to fix restore.
Set read_from_adb after EOF to return properly
from newer adb client prompt.
Create setter and getter for Backup_FileName
for openrecoveryscript.cpp which is not a
friend class.
Fix condition for twrpTar::Get_Size() and adb backup.
Change-Id: I7eb8168fa3416366b996e220cecbc0e1bcec5e8e
2017-04-23 14:37:22 -04:00
Ethan Yonker
76958ae984 3.1.0
Change-Id: Iab21513c7d703304a4591fdf5af1317e2336a8a7
2017-03-07 21:30:46 -06:00
Captain Throwback
a52891b6b3 Revert "Fix adb shell in 7.0 tree"
This reverts commit 0a8a7cebf1.

Change-Id: Icdb1f2e93aeaf35a66b6f67eaff51d9af5fd2e9a
2017-03-07 23:18:50 +01:00
Captain Throwback
3184b2f739 file_contexts: remove symlink to binary file and use text version instead
Some older update binaries can't read the binary file_contexts, so include
the text version of the file to prevent errors. This removes the symlink
to the binary version of the file and uses the concatenated file_contexts
from the OUT build folder.

Change-Id: Ia57c9b47c95945721d3dfa1ec8e18c4bb199adff
2017-03-07 12:10:20 -05:00
nkk71
201d4b21bc vold_decrypt: Add back missing xml and get rid of compiler warning
Change-Id: I883112e2618f560e96002e2076e2735cc20cfac3
2017-03-06 21:39:10 +01:00
Ethan Yonker
64c5c0a9ba Add TWRP app install to landscape and watch themes
Change-Id: Id48245218dc3ee3c6506521ce0134e6a579b6f4a
2017-03-06 12:42:54 -06:00
nkk71
71c6c50d0d crypto: Use system's vold for decryption
If TWRP crypto fails to decrypt partition, mount the system
  partition and use system's own vold to attempt decryption.
  This provides a fallback for proprietary OEM encryption as well as
  encryption methods which TWRP hasn't been updated for.

  Requirements in device tree:
  * fstab.{ro.hardware} in device/recovery/root
    The fstab does not need to be complete, but it does need the
    data partition and the encryption entries.

  * 'TW_CRYPTO_USE_SYSTEM_VOLD := true' in BoardConfig
  or
  * 'TW_CRYPTO_USE_SYSTEM_VOLD := <list of services>'

  Notes:
  * Setting the flag to 'true' will just use system's vdc+vold
    or
  * Setting the flag with additional services, will also start them
    prior to attempting vdc+vold decryption, eg: for qualcomm based
    devices you usually need 'TW_CRYPTO_USE_SYSTEM_VOLD := qseecomd'

  * For each service listed an additional import will be automatically
    added to the vold_decrypt.rc file in the form of
    init.recovery.vold_decrypt.{service}.rc
    You will need to add any not already existing .rc files in
    your device/recovery/root folder.

  * The service names specified in the vold_decrypt.{service}.rc files
    have to be named 'sys_{service}'
    eg: 'service sys_qseecomd /system/bin/qseecomd'

  * Any service already existing in TWRP as {service} or sbin{service} will
    be stopped and restarted as needed.

  * You can override the default init.recovery.vold_decrypt.rc file(s)
    by placing same named ones in your device/recovery/root folder.
    If you do, you'll need to manually add the needed imports.

  * If /vendor and /firmware folders are temporarily moved and symlinked
    to the folders and files in the system partition, the properties
    'vold_decrypt.symlinked_vendor' and 'vold_decrypt.symlinked_firmware'
    will be set to 1.
    This allows for additional control in the .rc files for any extra
    actions (symlinks, cp files, etc) that may be needed for decryption
    by using: on property:vold_decrypt.symlinked_vendor=1 and/or
    on property:vold_decrypt.symlinked_firmware=1 triggers.

  Debug mode: 'TW_CRYPTO_SYSTEM_VOLD_DEBUG := true' in BoardConfig
  * Specifying this flag, will enable strace on init and vdc, which will
    create separate log files in /tmp for every process created, allowing
    for detailed analysis of which services and files are being accessed.
  * Note that enabling strace will expose the password in the logs!!
  * You need to manually add strace to your build.

Thanks to @Captain_Throwback for co-authoring and testing.

Tested successfully on HTC devices:
M8 (KK through MM), M9 (MM and N), A9 (N), 10 (N), Bolt (N),
Desire 626s (MM), U Ultra (N)

HTC One X9 (MTK device)

And by Nikolay Jeliazkov on: Xiaomi Mi Max

Change-Id: I4d22ab55baf6a2a50adde2e4c1c510c142714227
2017-03-06 18:50:52 +02:00
TheStrix
09e8693b7a Fix missing libf2fs.so needed by mkfs.f2fs
* Relink libf2fs.so in all cases except PLATFORM_SDK_VERSION=23
   with no CM_PLATFORM_SDK_VERSION set as 4 or above.

Change-Id: I58bcc7daeb2d67d41b8912cea73690d94f26dd56
2017-03-06 17:06:56 +01:00
Matt Mower
cc19c6f9bb ADBBU: Cleanup string usage/namespace
* string.h header defined twice
* Specify namespace for stringstream

Change-Id: I7002671c7c0108007adffac9d4d5016b1482f5e6
2017-03-01 22:59:41 +01:00
Ethan Yonker
ddb63e27f2 Timeout for decrypt
Sometimes, usually because of proprietary binaries related to keymaster,
decrypt will hang waiting for the keymaster to initialize forever. This patch
enables a timeout so that we don't get stuck trying to decrypt forever.
A timeout is especially important when dealing with the default password
because the user has no option to cancel when TWRP tries to decrypt.

NOTE: This patch only adds a timeout for FDE. FBE will require some special
handling because we need access to some static data and that data is not
available across a fork.

Special thanks to nkk71 for cleaning up some issues in my patch set.

Change-Id: Iccf2fe769ac27a7dcd6bfebfe7d2e9eddd034308
2017-03-01 15:56:47 -06:00
that
a9dd9f0374 gui: preserve order of gui_print vs gui_msg
- rename __gui_print to internal_gui_print (__* is reserved for compiler)
- translate outstanding messages in internal_gui_print
- add locking because background thread could print while we render
- minor cleanup

Change-Id: Ib687d2cfb4763ad08ad4d4b76daf5b129d61d2e2
2017-03-01 22:38:25 +01:00
big biff
35b8a40810 Merge "twrpDigest: don't crash when zip.md5 file is empty" into android-7.1 2017-03-01 01:10:24 +01:00
big biff
ced41a4a55 Merge "Update Hungarian localization" into android-7.1 2017-03-01 01:09:44 +01:00
kaneawk
c42cb2e6ca languages: update chinese translation
Change-Id: I48ac4bfe55cfd4ee7805b86f5af31e915dfaaaa7
2017-03-01 02:38:13 +08:00
Wechy77
9bb12a6761 Update Hungarian localization
Change-Id: I13c1b6be4e1f7dcd026bfaa03d0c097200d498ba
2017-02-25 21:43:08 +01:00
Matt Mower
653a170935 Tweak MTP startup routine
* As a precaution, (non-permanently) disable MTP if TWRP crashes.
* Remove a duplicate logging of 'Starting MTP'.
* Combine and improve readability of conditions before MTP starts.
* Remove unnecessary Disable_MTP() call if conditions unsatisfied.

Change-Id: I61ac772fc123da5b84c3061fbcf2116531bc4e2f
2017-02-24 03:10:17 +01:00
Matt Mower
e07f010963 Fix handling of USB config during MTP switching
The property set of sys.usb.config was not part of the original 'Only
change USB mode to mtp when ready for MTP' commit. Further, it adds an
additional USB off/on toggle to the MTP startup routine, potentially
confusing the host computer. The default init.recovery.usb.rc already
sets the usb functions to 'adb' during 'on fs'.

It is possible that devices could run into issues with MTP startup due
to sys.usb.config not yet being set. This is actually due to a poor
design decision in Enable_MTP(), where sys.usb.config would not be
configured for mtp if sys.usb.config had never been set. It is not
necessary to check for a previous value, just set it.

Fix the USB PID for adb-only mode in Disable_MTP().

Change-Id: I21b5e64c9bdcd3104372a8b4eb8ea50cf4561892
2017-02-23 19:21:33 -06:00
that
d1afb52fea twrpDigest: don't crash when zip.md5 file is empty
Change-Id: I14145b32c7993bb0cd236b2982ed00bc2c791282
2017-02-23 23:05:59 +01:00
Captain Throwback
1b3fa22d71 logd: add seclabel so that service runs in 7.1 tree builds
Change-Id: If9bfcf6bdeac91e82e9615b671acbee5acffe0cc
2017-02-23 13:16:02 -06:00
Matt Mower
9b4d8dd8f3 Use LOGI/LOGE for non-EVENT_LOGGING events
Change-Id: Iaebc613a25a727a91205d2f361e9d7719036d88d
2017-02-23 20:14:10 +01:00
Matt Mower
c0f84e77d2 Run language_helper.py from inside languages dir
compare_xml.py and language_helper.py make different assumptions about
the directory from which they are called. Assume the script is run from
within the languages directory for both.

Change-Id: I4207919360d82dcd3cfbdebcff38f0e872554744
2017-02-23 20:02:05 +01:00
Matt Mower
ff2c6b2d52 Update MTP debugging tags
Change-Id: I8cf8b32d5a98ac2470386cbaf70cfc87f44e94f6
2017-02-23 20:01:07 +01:00
Matt Mower
a8e6d83155 Do not unconditionally remove MTP storage on unmount
* It is not necessary to Remove_MTP_Storage() for a partition if an
  MTP_Storage_ID has not been assigned.
* The hack to force-set tw_mtp_enabled=1 should no longer be necessary
  now that we're checking whether MTP really needs to be disabled for
  a volume before running Disable_MTP().

Change-Id: I1b7233eedd9da7c6be0c67fc60243f3837105173
2017-02-23 19:42:48 +01:00
Matt Mower
84830ce015 Only change USB mode to mtp when ready for MTP
Commit 'Do not toggle USB ID during MTP startup if not needed' changed
the default USB mode to 'mtp,adb'. Depending on the device, this can
result in an unfortunate side effect of crashing an ORS sideload
midway through the process (it's not clear to me whether the kernel or
the connected computer is responsible). Only put USB into mtp mode
when MTP storage is starting-up.

The hack to change the USB mode to adb when a user compiles TWRP
without MTP support is no longer necessary now that 'adb' is the
startup mode.

Change-Id: I8ed13d6ab8e85621533997b8c37ef7ebec0fcf85
2017-02-23 12:30:59 -06:00
D. Andrei Măceș
9ce12ec20d build: [FIXUP] Addendum for BusyBox get/setprop & API 24 vs 25
Change-Id: I9c909bc990210fc3ec2ed3edf0ac106248f613ba
2017-02-23 16:00:44 +01:00
MinSeong Kim
663ad8e9d0 Fix "ordered comparison between pointer and zero".
From Clang 4.x releases, DR583 and DR1512 will be addressed.
This patch, in advance, fixes the error(s).

Test: `mmma bootable/recovery`
Change-Id: I29dc85ae681307c322ab3a698c3f3bbad1c784ee
Signed-off-by: MinSeong Kim <minseong.kim@linaro.org>
2017-02-23 15:27:05 +01:00
SevenMaxs
c7a2f934b5 Update Russian localization
Added new strings (Scripts language_helper.py and compare_xml.py were used).

Change-Id: Id6f220d17e748cd10ff8ff8b21c2e40d84be5ec9
2017-02-21 11:12:50 +03:00
nijel8
2dd66f4962 cryptfs: Fix encryption issue due to stack corruption.
Ioctl BLKGETSIZE expects pointer to unsigned long as argument.

On 64bit target using pointer to unsigned int can cause stack
corruption due to type mismatch.

props to f8b8787317

Change-Id: I1d76c65e29479c8f0cd44b6892069b21b8249b95
2017-02-19 21:34:12 +01:00
Ethan Yonker
91758440d3 Add a listxattr tool for listing xattrs
Change-Id: Ib80bab2b605ce77cd8fdc717d8bcfa8085516679
2017-02-16 21:54:51 -06:00
Ethan Yonker
8d039f7bd8 libtar: support backing up and restoring new Android user.* xattr
Support for backing up and restoring user.default, user.inode_cache, and
user.inode_code_cache xattrs introduced in Android 7.x

Change-Id: I6e0aa7fc9cd30ed004ef28ebb58d60a82e518123
2017-02-16 21:50:05 -06:00