Commit graph

27140 commits

Author SHA1 Message Date
Alex Klyubin
f31ced2e10 maxSdkVersion can be specified for APK verification.
This enables verification of APKs which are served to a specific
range of Android platform versions, or to replicate behavior of
particular platform versions.

Bug: 27461702
Change-Id: I44ab4c99419eb97d72c4ccd109137fe1efda577d
2016-06-17 10:02:47 -07:00
Alex Klyubin
21213cff9c Merge "Reject PKCS#7 SignerInfo with unsupported parameters." 2016-06-17 15:56:51 +00:00
Treehugger Robot
63fc2b6766 Merge "Remove obsolete MTD support from the releasetools scripts." 2016-06-17 04:47:47 +00:00
Elliott Hughes
305b088729 Remove obsolete MTD support from the releasetools scripts.
Bug: http://b/29250988
Change-Id: I653dc306485c6b35411840b53211d42eb6d19e34
2016-06-16 20:48:47 -07:00
Treehugger Robot
ab95c4a59d Merge "Add new Android.mk to handle repo move" 2016-06-16 23:25:46 +00:00
Treehugger Robot
fcb8a89c3b Merge "Remove build/libs" 2016-06-16 22:49:35 +00:00
Dan Willemsen
c72dfe3cca Add new Android.mk to handle repo move
We're moving the platform/build repository down a level, then symlinking
the directories and necessary files back into build/. So if we're still
in build/, keep searching for Android.mk files, otherwise stop, since
they'll be found through the symlinks.

Bug: 28001743
Change-Id: Ieea6e3b1fca265b548395c6af148ebb4efa43b0f
2016-06-16 15:30:19 -07:00
Dan Willemsen
eb4431595c Remove build/libs
There's only a single library, libhost, and it's only used by acp and
atree in build/tools, move it there.

Bug: 28001743
Change-Id: Ie404d2793710de4e265a6fa95d462c32d4042623
2016-06-16 14:52:47 -07:00
Alex Klyubin
d7236da153 Reject PKCS#7 SignerInfo with unsupported parameters.
This addresses the TODO to mimic the behavior of Android when
verifying APK JAR signatures. Unfortunately, the behavior of Android
kept changing in interesting ways between different platform versions.
This is hard-coded as a big lookup.

Bug: 27461702
Change-Id: I49bc181ee05f774ef8ee041af870385b35212c23
2016-06-16 12:44:36 -07:00
Treehugger Robot
b727d5bb32 Merge "Support wiping userdata for A/B OTA packages." 2016-06-16 15:39:23 +00:00
Dan Willemsen
3068a85962 Merge changes Ib6ffcc38,Ia58e6bc1
* changes:
  Check that NDK-built modules only link to NDK-built modules
  Add macros for printing pretty warnings/errors in rules
2016-06-16 15:38:02 +00:00
Tao Bao
7c5dc578b3 Support wiping userdata for A/B OTA packages.
update_engine now accepts POWERWASH=1 to schedule a factory reset in
the post-install phase. Hook up with the --wipe_user_data flag in the
OTA script.

Bug: 28700985
Change-Id: Ie73876a61db90d124d2af588d674757376e9aabc
(cherry picked from commit 38ca0be399)
2016-06-15 23:19:52 -07:00
Dan Willemsen
b097fbed0a Check that NDK-built modules only link to NDK-built modules
Modules built against the NDK should only link against modules also
built against the NDK (or link to the NDK prebuilts). This patch
attempts to catch these cases, and prints a large warning when this is
violated. Once the tree is cleaned up, this will change to an error.

Change-Id: Ib6ffcc38d9161abdbe45a58af26ba429fb6f1876
2016-06-15 20:22:19 -07:00
Dan Willemsen
dd5a5d328b Add macros for printing pretty warnings/errors in rules
Change-Id: Ia58e6bc1328c84e5f4ba1f6a2fd2d650e94e127e
2016-06-15 20:22:19 -07:00
Treehugger Robot
a6f510c776 Merge "Fix kati --no_ignore_dirty usage" 2016-06-15 22:41:32 +00:00
Dan Willemsen
7fba3347b9 Merge "Forbid libstdc++ on Linux and Darwin" 2016-06-15 22:38:30 +00:00
Dan Willemsen
3773b45c3b Fix kati --no_ignore_dirty usage
Kati only supports a single use of --no_ignore_dirty, so we were
ignoring the SOONG_ANDROID_MK file, and only detecting changes to
SOONG_MAKEVARS_MK. Fix this by using a pattern that should apply to both
of those makefiles.

Change-Id: I46390f9887f95f1db0efe4e93339667f35ebc67c
2016-06-15 14:55:58 -07:00
Dan Willemsen
327fa9c411 Forbid libstdc++ on Linux and Darwin
The last user has been removed, forbid any modules from selecting this.

Change-Id: Idd9ef6ca4b6c6754935d59c4a09c7d213ae481c1
2016-06-15 13:41:45 -07:00
Alex Klyubin
1fb96c3ff5 Merge "Don't depend on Bouncy Castle." 2016-06-15 20:32:35 +00:00
Treehugger Robot
98b4f07dfc Merge "Faster and cleaner way to obtain UTF-8 encoded form." 2016-06-14 22:37:10 +00:00
Treehugger Robot
6c0c720389 Merge "Use more prebuilt build-tools" 2016-06-14 22:14:07 +00:00
Alex Klyubin
d4761a19b8 Faster and cleaner way to obtain UTF-8 encoded form.
Instead of specifying character encoding by name, the faster, cleaner,
and safer way is to use StandardCharsets.UTF_8.

Bug: 27461702
Change-Id: I897284d3ceeb44a21cc74de09a9b25f6aec8c205
2016-06-14 14:18:21 -07:00
Alex Klyubin
cf89865b95 Merge "APK JAR signature verifier." 2016-06-14 20:56:28 +00:00
Dan Willemsen
7c2d228701 Use more prebuilt build-tools
For acp, we've been using an old prebuilt in prebuilts/sdk, but it's not
part of the SDK. Instead, we'll use a prebuilt in the build-tools
repository.

For ijar, we've been using the host libstdc++ to workaround the lack of
libc++ on some unbundled branches. Instead, use a prebuilt that can use
libc++.

For ziptime, we've been disabling it on unbundled branches, due to the
lack of libc++. Instead, use a prebuilt version of ziptime that can use
the prebuilt libc++.

Change-Id: If80f845ea06f76e3fe6765964e77c864eaf303d0
2016-06-14 13:50:38 -07:00
Treehugger Robot
06f3e8349f Merge "Add a libc++ version of ijar for prebuilt use" 2016-06-14 18:34:38 +00:00
Alex Klyubin
7f770c0963 Don't depend on Bouncy Castle.
This switches PKCS#7 SignedData generation code from Bouncy Castle to
OpenJDK's proprietary internal API. This is to avoid depending on a
huge library that's not really needed. In the longer term, it's best
to add our own implementation of PKCS#7 SignedData building, parsing,
and verification. This will give the code more power to mimic what the
Android platform does.

Bug: 27461702
Change-Id: I29f1ceea1293e35424fde69c0f2969d551345100
2016-06-14 11:20:49 -07:00
Dan Willemsen
e19d451f49 Add a libc++ version of ijar for prebuilt use
I'll remove the old version once we've moved over to the prebuilts.

Change-Id: Ifd8d396f8b653abbe958cd34e69831a6ca378649
2016-06-14 10:30:06 -07:00
Alex Klyubin
8b47001e9b APK JAR signature verifier.
This adds JAR signature verification to ApkVerifier.

Bug: 27461702
Change-Id: Id2b72bea7869be66268f6bc1387e1559ee02ff9d
2016-06-14 10:28:36 -07:00
Treehugger Robot
7b4c07f1d5 Merge "Skip uses-library check for preopted apps." 2016-06-14 17:22:25 +00:00
Jeff Hao
00b75bc41a Skip uses-library check for preopted apps.
Bug: 26880306

(cherry-picked from commit b00263f96a)

Change-Id: I22beccaf61ca30cf1487a25f80e1c3fd7bdf2c62
2016-06-13 18:14:27 -07:00
Yabin Cui
e6fae50455 Merge "Add option to link static lite protobuf library." 2016-06-14 00:16:34 +00:00
Alex Klyubin
dca955a9bd Merge "More general OutputStreamDataSink." 2016-06-13 19:49:01 +00:00
Alex Klyubin
a85e0aa883 Merge "Fix inefficiency in APK entry data alignment." 2016-06-13 18:14:18 +00:00
Alex Klyubin
e54b2753e4 More general OutputStreamDataSink.
This replaces the less general DataSink which outputs into a
ByteArrayOutputStream with a more general DataSink which outputs into
an OutputStream.

Bug: 27461702
Change-Id: I9467f38c41f586b71f35edb3602fd6e57153184f
2016-06-13 10:19:26 -07:00
David Zeuthen
8b3b1727da Merge "bvb: Update path to key since repo was moved." 2016-06-13 15:54:36 +00:00
David Zeuthen
bca24302bb bvb: Update path to key since repo was moved.
We recently moved Brillo verified boot from system/bvb to external/bvb
so update the path accordingly.

TEST=Build with 'BOARD_BVB_ENABLE := true' succeeds.
BUG=29099910

Change-Id: I66f3b90e23d6b2afc09f81af571ede7b573325e9
2016-06-13 11:26:26 -04:00
Yohann Roussel
0a26fc0ace Merge "Do not force turn off of Jack warning" 2016-06-13 14:33:48 +00:00
Alex Klyubin
ab2a3b0061 Fix inefficiency in APK entry data alignment.
26f00cda4b introduced a bug where an
APK entry's extra field is padded for alignment purposes when no
padding is necessary because the entry is aligned without any padding
bytes.

Bug: 27461702
Change-Id: Icb164dbaa26d9686412e2920318a9f40c5ce9751
2016-06-11 17:47:20 -07:00
Treehugger Robot
1318ec93e7 Merge "Redirect subprocess stderr to stdout in verbose mode." 2016-06-11 00:56:32 +00:00
Alex Deymo
d8d96ecdae Redirect subprocess stderr to stdout in verbose mode.
This patch uses subprocess.communicate instead of subprocess.wait to
prevent deadlock if any of the child processes outputs too much data,
and redirects the subprocess output to stdout when running in verbose
mode.

With this patch `ota_from_target_files -v` prints the delta_generator
output in stdout, and no output if '-v' is not passed.

Bug: None
TEST=ota_from_target_files -v ...

Change-Id: Id66e4f3360a6f91d61a3ce96d53afbccdaa19da5
2016-06-10 16:38:31 -07:00
David Turner
7a866d783c Merge "goldfish_setup: grant /system/bin/sh exec access" 2016-06-10 18:04:26 +00:00
Nick Kralevich
03bfdea1a3 goldfish_setup: grant /system/bin/sh exec access
The goldfish_setup shell script needs the ability to execute
the shell script interpreter. Allow it.

Addresses the following denial:

avc: denied { getattr } for pid=1220 comm="init.goldfish.s"
path="/system/bin/sh" dev="vda" ino=442 scontext=u:r:goldfish_setup:s0
tcontext=u:object_r:shell_exec:s0 tclass=file permissive=0

(cherrypicked from commit 501c88c029)

Bug: 28941573
Change-Id: I22d26e90f107c8d801229354a5e0513c37e6c31d
2016-06-09 09:52:39 -07:00
Vikas Marwaha
e5c1af2dd0 Merge "Add variable PRODUCT_SHIPPING_API_LEVEL and make files with the new read only product property ro.product.first_api_level." 2016-06-09 02:30:57 +00:00
Dan Willemsen
a8d13592ac Merge "Rewrite LDLIBS and SHARED_LIBRARIES" 2016-06-08 21:09:34 +00:00
Alex Klyubin
4f8bde47ae Merge "APK Signature Scheme v2 APK verifier." 2016-06-08 20:51:58 +00:00
Alex Klyubin
8740e9df19 APK Signature Scheme v2 APK verifier.
This adds the ApkVerifier class which verifies APKs using APK
Signature Scheme v2 only. In a follow-up commit this class will be
extended to verify APKs using JAR signature scheme when necessary.

The APK verifier is designed to not just verify an APK, but also
report errors, warnings, and information about signers in a structured
way, to enable tools to surface this information to users in various
ways.

Bug: 27461702
Change-Id: I10c6ba436021d86b6dbf6d3cf44494652adacb66
2016-06-08 08:23:30 -07:00
Alex Klyubin
ebe68ec237 Merge "Fix DSA APK signatures for API Level 8 and lower." 2016-06-08 15:17:42 +00:00
Yohann Roussel
bf17172521 Do not force turn off of Jack warning
When ANDROID_JACK_EXTRA_ARGS is defined there is no reason to still turn
off those warnings.

Change-Id: Ic7ac02c72ed3b7b0eaca9394c9fc7d92d5dfa871
2016-06-08 17:00:09 +02:00
Dan Willemsen
6731b495ca Rewrite LDLIBS and SHARED_LIBRARIES
LOCAL_LDLIBS was the only correct way to use NDK libraries, but few used
it correctly. It also often got confused with LOCAL_LDFLAGS, so move the
flags to the correct variable.

For binaries that weren't using the NDK (empty LOCAL_SDK_VERSION), it
was never valid to use LOCAL_LDLIBS, as dependencies would not be
properly set up, and could lead to random build failures. So convert any
-l linker flags to using LOCAL_SHARED_LIBRARIES automatically.

For binaries built using the NDK (LOCAL_SDK_VERSION set), they were
required to use LOCAL_LDLIBS for prebuilt NDK libraries, otherwise they
would get headers and dependencies to the platform versions. Any
non-prebuilt LOCAL_LDLIBS would miss dependencies. So move the NDK
prebuilt libraries to LDLIBS from SHARED_LIBRARIES, and move everything
else to SHARED_LIBRARIES.

So now, for device modules, LOCAL_SHARED_LIBRARIES should always be
used, and we'll do the right thing. LOCAL_LDLIBS should only be used for
host libraries from the system.

Change-Id: Ide34c7afdcfb6507a378d45a42471729e489a9e0
2016-06-07 21:59:55 -07:00
Yabin Cui
72a1156efb Add option to link static lite protobuf library.
Bug: 28114205

Change-Id: Id2b7e42017a53138c60b92de8d196ca92bc38053
2016-06-07 21:24:06 -07:00