Commit Graph

9577 Commits

Author SHA1 Message Date
Tianjie Xu e7dd308591 Merge "Allow RSA 4096 key in package verification" am: 3168ddf79d am: 3de9ee62b8
am: 66afbbd536

Change-Id: I9cd59c456a5bf903e2779a274b75b38ba3b76028
2019-03-27 11:32:26 -07:00
Tianjie Xu 66afbbd536 Merge "Allow RSA 4096 key in package verification" am: 3168ddf79d
am: 3de9ee62b8

Change-Id: Iee0a4a2d61a086234bdcb925a4fedee6c43e49b9
2019-03-27 11:24:07 -07:00
Tianjie Xu 3de9ee62b8 Merge "Allow RSA 4096 key in package verification"
am: 3168ddf79d

Change-Id: Ie22fb0caddbf3185d5ee52ae883fc933c35e8cc4
2019-03-27 11:21:01 -07:00
Tianjie Xu 3168ddf79d Merge "Allow RSA 4096 key in package verification" 2019-03-27 17:57:38 +00:00
Tianjie Xu 4c3d68f7c8 Merge "Move out the code to parse block map in MemMap" am: f1cbd2f7f2 am: 67a3ffc22f
am: 0a6518b79b

Change-Id: Ic0c1b0224c1c68343c0a607a1abe34c79c819165
2019-03-26 17:37:16 -07:00
Tianjie Xu 0a6518b79b Merge "Move out the code to parse block map in MemMap" am: f1cbd2f7f2
am: 67a3ffc22f

Change-Id: I7b67c62c39e202fed0f1a999ecccaa96fa84e10a
2019-03-26 17:05:40 -07:00
Tianjie Xu 67a3ffc22f Merge "Move out the code to parse block map in MemMap"
am: f1cbd2f7f2

Change-Id: I630bae5c6be83a4e3f300542b45a10c4b31967a6
2019-03-26 16:09:33 -07:00
Tianjie Xu f1cbd2f7f2 Merge "Move out the code to parse block map in MemMap" 2019-03-26 21:52:40 +00:00
xunchang 908ad77af8 Allow RSA 4096 key in package verification
The RSA_verify sitll works for 4096 bits keys. And we just
need to loose the check on modulus.

Sample commands to generate the key & package:
1. openssl genrsa -out keypair.pem 4096
2. openssl pkcs8 -topk8 -inform PEM -outform DER -nocrypt \
   -in keypair.pem -out private.pk8
3. openssl req -new -x509 -key keypair.pem -out public.x509.pem \
   -days 365
4. java -Djava.library.path=prebuilts/sdk/tools/linux/lib64 -jar \
   prebuilts/sdk/tools/lib/signapk.jar -w public.x509.pem private.pk8 \
   unsigned.zip signed.zip

Bug: 129163830
Test: unit tests pass
Change-Id: I5a5ff539c9ff1955c02ec2ce4b17563cb92808a4
2019-03-26 12:28:23 -07:00
xunchang 625c588c0f Move out the code to parse block map in MemMap
We will reuse them to implement the fuse provider from block maps.

Test: unit tests pass, sideload an OTA
Change-Id: Iaa409d19569c4ccc0bb24e12518044fcddb45c69
2019-03-26 11:47:27 -07:00
andi34 0ef6492518 updater: Allow devices to suppress BLKDISCARD
* On some devices TRIM is disabled for security reasons. Don't fail
  flashing the ROM because discard isn't possible in this case.

Change-Id: I044619c3e0b01a496d967ef136501d0190240ad4
2019-03-23 14:39:53 +02:00
Michael Bestas 9bb7c225a4 Don't copy local mke2fs.conf for O-MR1
* It is now copied from system/extras/ext4_utils

Change-Id: Ibddcad4928c17bc174390d75708a5382a9262441
2019-03-23 14:39:53 +02:00
Michael Bestas de18923571 Remove duplicate ext4 flags from Android.mk
* They are right above

Change-Id: Ifff889e6ff748ed6bfa4a076b1afcc2c6a7eed3b
2019-03-23 14:39:53 +02:00
Michael Bestas 0cc2376153 Set a dummy CM_PLATFORM_SDK_VERSION if it doesn't exist
* Avoids printing 2 build warnings on every single rebuild
  of anything when building TWRP inline

Change-Id: I5dd3623707c03af0dfe7366f1a77e83762e720b2
2019-03-23 14:39:53 +02:00
Michael Bestas 0bb5df9a34 Remove leftover mounts.h~HEAD
* Wrongly added during 8.0 merge

Change-Id: Icc0415f978af352458ce7d605b0c8c4cd84c184e
2019-03-23 14:39:53 +02:00
Simon Shi e682598480 prebuilt: Support ubsan libraries of all architectures
According to the file under './prebuilts/clang/host/linux-x86/clang-4691093/lib64/clang/6.0.2/lib/linux/*.so', these files are supported under different target architectures. This commit would add support to every architecture.

Change-Id: I1f88bc06c3f30e6d2f2083ba9b6350b2376d83f2
2019-03-22 16:33:47 -05:00
Simon Shi 8ae2b0d5dd twinstall: Force variable type
Force the usage of variable type since it is different on the 32-bit
devices. Use this commit to avoid the problem.

bugs:
bootable/recovery/twinstall.cpp:201:67: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'long long' [-Werror,-Wformat]
LOGINFO("has_legacy_properties: mmap (size=%zu) failed: %s!\n", finfo.st_size, strerror(errno));
                                           ~~~                  ^~~~~~~~~~~~~
                                           %lld

Change-Id: Ie0c51a90490e0c069fff33884a9431a97361f5c6
2019-03-22 16:32:39 -05:00
lambdadroid a0a163586c dosfstools: Fix compile error in Pie tree on 32 bit systems
Fixes the following compile error:
bootable/recovery/dosfstools/src/check.c:591:4: error: format specifies type 'unsigned long' but the argument has type 'unsigned long long'
[-Werror,-Wformat]
                 (uint64_t)clusters * fs->cluster_size,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This was fixed upstream in
"Fix format string in check_file() (%lu -> %llu)" (dosfstools/dosfstools@d7665f2)
This commit applies the change on top of TWRP's dosfstools copy.

Change-Id: I23374594662fd95e795f793112e78c54d8d50b30
2019-03-22 22:09:13 +01:00
Tianjie Xu 62909cd90a Merge "Move librecovery_ui to a sub-directory" am: 6287253eb4 am: 45898d8bb4
am: be1485faec

Change-Id: I7b02a0c6081086b7765bfecd9f53a207bd93f75d
2019-03-22 08:31:32 -07:00
Tianjie Xu be1485faec Merge "Move librecovery_ui to a sub-directory" am: 6287253eb4
am: 45898d8bb4

Change-Id: I426c6b2bd4731d913772b188cb41e7b9323a7330
2019-03-22 08:23:03 -07:00
Tianjie Xu 45898d8bb4 Merge "Move librecovery_ui to a sub-directory"
am: 6287253eb4

Change-Id: Ib055c175eab1857713d5d5bed63fd91ed43e881b
2019-03-22 08:15:37 -07:00
Tianjie Xu 6287253eb4 Merge "Move librecovery_ui to a sub-directory" 2019-03-22 15:05:00 +00:00
Ethan Yonker 7e94158684 Support both old and new mkfs.f2fs
Easiest way I could find to determine if we have the old or the
new mkfs.f2fs version is to pipe the usage output to grep and
grep the output for "reserved" and redirect the output to a file.
If the file has any data in it, then we must have the old
mkfs.f2fs that uses -r.

Change-Id: I7f1ed88b577a3f9827a98f0868d8f82e4e4886ac
2019-03-22 08:18:24 -05:00
dianlujitao 4879b37b5d Fix the long broken format function
* For EXT2/3:
   * Align mke2fs options with Android 9.0 fs_mgr_format.cpp.
 * For EXT4:
   * Note that make_ext4fs is still in use on Android 8.1 to workaround
     a FDE encryption bug even though mke2fs has become the default
     choice. The bug is fixed in Android 9.0+.
 * For F2FS:
   * Drop the broken "-r" option, it's never ported to O, explicitly
     pass number of sectors instead.
   * Keep all options aligned with Pie fs_mgr.
   * Check existence before start wiping, as Wipe_EXT4 does.
 * For all:
   * Calculate block size at runtime, and reserve the space specified
     via negative "length" option from fstab. Note that positive length
     will be ignored.
   * If the partition has crypto footer, and "length" is not specified
     in fstab, automatically reverse CRYPT_FOOTER_OFFSET (16384).
   * Remove the default crypto key location: footer, this is a bad
     assumption since most partitions don't use encryption! We need to
     know the real situation to decide whether to reserve crypto footer
     on format.
   * If the current action is "wipe" or "change filesystem", wipe crypto
     footer or block device after mkfs if the partition is
     unencrypted or undecrypted (e.g., wrong password).
   * If the current action is "format data", unconditionally wipe crypto
     footer or block device.

Change-Id: I7304a8ee703131ea4a08ab7c60334af28cac28b3
2019-03-21 16:15:52 -05:00
Tianjie Xu 8f397309b4 Move librecovery_ui to a sub-directory
This helps to expose librecovery_ui for device specific RecoveryUi.

Bug: 76436783
Test: mma, unit tests pass
Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
(cherry picked from commit b5108c372c)
2019-03-21 10:46:11 -07:00
Tianjie Xu b5108c372c Move librecovery_ui to a sub-directory
This helps to expose librecovery_ui for device specific RecoveryUi.

Bug: 76436783
Test: mma, unit tests pass
Change-Id: Ic6c3d301d5833e4a592e6ea9d9d059bc4e4919be
2019-03-21 00:45:37 -07:00
Ethan Yonker 64e0a6525f Use listbox for device-specific advanced menu items
This patch allows items to have more than one action surrounded
by the <actions> tags like other GUI elements. The patch also
adds new twrp command line options that let you reload the theme
and switch to a specific page from the command line:

adb shell twrp reloadtheme
adb shell twrp changepage=advanced

Change-Id: I838ea380a508be07b9fa617034d1954e116febd6
2019-03-20 15:42:49 -05:00
Dees Troy 908442dfb5 Merge "Update FDE decrypt to pie from CAF" into android-9.0 2019-03-20 21:40:44 +01:00
Ethan Yonker 98661c1a29 Update FDE decrypt to pie from CAF
cryptfs.cpp based on CAF tag LA.UM.7.3.r1-05900-sdm845.0
Used CAF because AOSP no longer contains code for qcom's hardware
crypto.

Change-Id: I921cbe9bed70989f91449e23b5ac3ec1037b7b97
2019-03-20 15:33:48 -05:00
bigbiff bigbiff af32bb9c4f MTP FFS updates:
This update splits old MTP code and new MTP code from Google
into two trees, legacy and ffs. Depending on the SDK level,
the build system will select the correct version. The reason
for separating the versions out are due to older android trees
not supporting the updated MTP code from Google.

Most MTP code is from Google, with additions needed from
implementing the Java functions in C++ for TWRP and FFS.

We assume if you are in android-9.0 or above, your kernel
has support for FFS over MTP. Verify that your init.rc
is mounting the MTP FFS driver to the proper location.

Change-Id: I4b107b239bd9bc5699527f9c8c77d9079f264a7e
2019-03-20 14:28:21 -05:00
Tianjie Xu 9d2a945e9b Merge "Move apply_from_sdcard to fuse_sdcard_install" am: 3c61cd02cf am: 3c21700fcd
am: c1dfb51ae3

Change-Id: I273c41fe713965485d604344d1d44f31a852e892
2019-03-20 11:34:19 -07:00
Tianjie Xu c1dfb51ae3 Merge "Move apply_from_sdcard to fuse_sdcard_install" am: 3c61cd02cf
am: 3c21700fcd

Change-Id: I11dd7813aa0d43688b4856ee9a1508fe1de9fdee
2019-03-20 11:17:10 -07:00
Tianjie Xu 9b177eb32d Merge "Remove the provider_vtab" am: 2037c60de4 am: d7eba6248b
am: b3025d752d

Change-Id: If5419d0e263442b7ebd7ec95e972fb67e2f6fc94
2019-03-20 11:10:04 -07:00
Tianjie Xu 3c21700fcd Merge "Move apply_from_sdcard to fuse_sdcard_install"
am: 3c61cd02cf

Change-Id: Idd0f65f979145b572e30bd9b8b38d477f2b7e185
2019-03-20 11:07:00 -07:00
Tianjie Xu b3025d752d Merge "Remove the provider_vtab" am: 2037c60de4
am: d7eba6248b

Change-Id: Idf8762f7e39c165514710f0afd98bc485c5e9d9b
2019-03-20 11:05:51 -07:00
Tianjie Xu d7eba6248b Merge "Remove the provider_vtab"
am: 2037c60de4

Change-Id: I691e88cc2b12ac142b694b83e5756df208677dc5
2019-03-20 11:01:35 -07:00
Tianjie Xu 3c61cd02cf Merge "Move apply_from_sdcard to fuse_sdcard_install" 2019-03-20 17:43:46 +00:00
Tianjie Xu 2037c60de4 Merge "Remove the provider_vtab" 2019-03-20 17:43:30 +00:00
mauronofrio e9a49efe75 Adding Edl button in reboot menu
Edl mode is available only on qualcomm devices and it used to fully
restore the bricked devices. I made the button available only if
TW_HAS_EDL_MODE := true like the download button. I set the edl
button to the right of the download button, so devices can support
edl button and download button. I also added the translation for
all languages.

Change-Id: I69d1058b8c050b722395c7b3da6dce1ccfbe7a91
2019-03-20 10:57:07 -05:00
xunchang 3cc23d5eac Move apply_from_sdcard to fuse_sdcard_install
Move the sdcard installation function and all helper functions to a
separate file, and drop the dependency on common.h.

In the future, we want to move these functions into the install class.

Bug: 127071893
Test: unit tests pass
Change-Id: I0b7f7cbf0b68918e638e13878ca28bfca367088a
2019-03-19 23:05:13 -07:00
Tianjie Xu 61307a2e3c Merge "Create a FuseDataProvider base class" am: eeea86f5fd am: 4aa4bf5e19
am: 77a2ff12d7

Change-Id: I851a7a2947b7abfbad6e0331b581d8eb320ea89d
2019-03-19 14:00:22 -07:00
Tianjie Xu 77a2ff12d7 Merge "Create a FuseDataProvider base class" am: eeea86f5fd
am: 4aa4bf5e19

Change-Id: I7fd63a6d23c2e17ffc4fe403c15df86b4e2c76da
2019-03-19 13:56:19 -07:00
Tianjie Xu 4aa4bf5e19 Merge "Create a FuseDataProvider base class"
am: eeea86f5fd

Change-Id: I9a7fc19e2897cb123a27a66f6a291a92b4653fe1
2019-03-19 13:52:17 -07:00
Tianjie Xu eeea86f5fd Merge "Create a FuseDataProvider base class" 2019-03-19 20:34:58 +00:00
xunchang 5e6832a24d Remove the provider_vtab
It's no longer needed with the newly added FuseDataProvider class. Also
cleans up the parameters for run_fuse_sideload.

Bug: 127071893
Test: unit tests pass, run a sideload
Change-Id: I1ccd6798d187cfc6ac9f559ffb3f3edf08dad55c
2019-03-19 13:03:59 -07:00
xunchang ea2912f187 Create a FuseDataProvider base class
The fuse data provider for adb/sdcard shares common code and structures.
This cl creates a FuseDataProvider base class and provides
implementations for adb and sdcard.

In the follow cls, we can kill the provider_vtab struct; and also add
another implementation to parse a block map file and provides data.

Test: unit tests pass, sideload a package, apply a package from sdcard
Change-Id: If8311666a52a2e3c0fbae0ee9688fa6d01e4ad09
2019-03-19 11:11:58 -07:00
D. Andrei Măceș 08f91e84e0 gpt: Add -Wno-format-security
The existing -Wno-format requires it:

error: -Wformat-security ignored without -Wformat [-Werror=format-security]

Change-Id: I9e4177df3437f582b7c71fdaf364ab3b7ced595e
Signed-off-by: D. Andrei Măceș <andrei@unlegacy-android.org>
2019-03-19 18:05:40 +01:00
Andreas Blaesius 38d2d5268e TWRP: fix compiling on Android 7
fixes
cp: cannot create regular file (...)/recovery/root/file_contexts': No such file or directory

Change-Id: I094a0bd242c6eb01e84570fbe49e853098e33a8b
2019-03-19 17:58:29 +01:00
Ethan Yonker e03158ebdd Fix gr_clip
gr_clip was not calculating the correct values after the rotation
patch. Since gr_clip width and height instead of taking a second
pair of x,y coordinates, we cannot depend as much on the
ROTATION_X_DISP and ROTATION_Y_DISP macros. The simplest solution
was to call scissor with direct values in most cases.

Change-Id: I25f9d575ec6ddc430fca4555f29c8334441fc95d
2019-03-19 11:40:28 -05:00
Tao Bao c5f06d7dc8 Merge "Skip calling verify_package_compatibility when resuming." am: 98beb6414b am: c4148b529a
am: db9dabb826

Change-Id: Ic4948239024645f99c96bda5e41524bfe4d07d7d
2019-03-18 16:39:28 -07:00