summaryrefslogtreecommitdiff
path: root/verity
AgeCommit message (Collapse)Author
2024-02-02Migrate Test Targets to New Android Ownership ModelAditya Choudhary
This CL is created as a best effort to migrate test targets to the new Android ownership model. It is based on historical data from repository history and insights from git blame. Given the nature of this effort, there may be instances of incorrect attribution. If you find incorrect or unnecessary attribution in this CL, please create a new CL to fix that. For detailed guidelines and further information on the migration please refer to the link below, go/new-android-ownership-model Bug: 304529413 Test: N/A Change-Id: I4d1f107d18f767c06f88da57c1bd7dad2b1230a1
2023-10-17destroy file handle in error caseGeQi
this issue was found by static analysis tool Change-Id: Iecf4cc465bee236c9ce00704f9c53022fec52818 Signed-off-by: GeQi <geqi@xiaomi.com>
2022-04-14Fix more issues with python3 conversion of build_verity_metadata.pyCole Faust
Bug: 203436762 Test: lunch hikey-userdebug; m droidcore Change-Id: I11ee92d7a3d9aa4e190c338e8438848c3ba47762
2022-04-13Fix issue with python3 conversion of build_verity_metadata.pyCole Faust
Files should be opened for reading/writing in text mode, not binary mode. Bug: 203436762 Test: Presubmits Change-Id: I86166bf434704dbd0a546e543c684818b57620f5
2022-04-05Convert build_verify_metadata to python 3Cole Faust
Also update some python 3 issues in mkuserimg_mke2fs. Bug: 203436762 Test: Presubmits Change-Id: Ib919d40c96d3c26d29d8c1b4af67300c4130ec42
2022-03-24Tweak linux_glibc properties for musl builds in system/extrasColin Cross
For convenience, builds against musl libc currently use the linux_glibc properties because they are almost always linux-specific and not glibc-specific. In preparation for removing this hack, tweak the linux_glibc properties by either moving them to host_linux, which will apply to linux_glibc, linux_musl and linux_bionic, or by setting appropriate musl or linux_musl properties. Properties that must not be repeated while musl uses linux_musl and also still uses the linux_glibc properties are moved to glibc properties, which don't apply to musl. Whether these stay as glibc properties or get moved back to linux_glibc later once the musl hack is removed is TBD. Bug: 223257095 Test: m checkbuild Test: m USE_HOST_MUSL=true host-native Change-Id: Iff2b4ec1465033e3e076774bc0c72b2cf966478c
2021-11-16Only use integer sanitizer for 64-bit linux buildsColin Cross
fec32 fails to compile when integer sanitization is enabled: ld.lld: error: undefined symbol: __tls_get_addr >>> referenced by sanitizer_linux_libcdep.cpp:355 (out/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:355) >>> sanitizer_linux_libcdep.cpp.o:(__sanitizer::CollectStaticTlsBlocks(dl_phdr_info*, unsigned int, void*)) in archive /usr/local/google/home/ccross/ssd/master/prebuilts/clang/host/linux-x86/clang-r433403b/lib64/clang/13.0.3/lib/linux/libclang_rt.ubsan_standalone-i386.aclang-13: error: linker command failed with exit code 1 (use -v to see invocation) Bug: 206691489 Test: m static_apexer_tools dist BUILD_HOST_static=1 Change-Id: Ic090d7b8d240262a87f98b85d3ad962c4d2fdc9e
2021-05-11Expose a static method for computing hash tree sizeKelvin Zhang
Test: th Change-Id: I53cae3ffeaef262733faf9070815cd396590c7be
2021-02-24Support blake2b-256 in hashtree builderTianjie
Now that blake2b-256 can be used to generate hashtree, add the algorithm support in hashtree builder. This is needed to perform on-device verity computation during an OTA update. Bug: 178117377 Test: disable vabc on CF, check blake2b-256 verity tree generates correctly on device Change-Id: I54de6f9db34f7b128f914de15af9b7fb61c41d1a
2021-02-19[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: alloc-stress/Android.bp app-launcher/Android.bp boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp brillo_config/Android.mk checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioblame/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp partition_tools/aidl/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp pssbench/Android.mk puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp zram-perf/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ia559848af903a7b6746d9b12b7de8b83bc57f99d
2021-02-16Revert "[LSC] Add LOCAL_LICENSE_KINDS to system/extras"Bob Badour
This reverts commit 044d055c842a5750359ed71dfe50a6a4bf5f4cc3. Reason for revert: Needs to run as multiple roots. Change-Id: I8e06e7eb19e0f634f52fbd8a1c6662f43e347dd5
2021-02-12[LSC] Add LOCAL_LICENSE_KINDS to system/extrasBob Badour
Added SPDX-license-identifier-Apache-2.0 to: boot_control_copy/Android.bp bootctl/Android.bp boottime_tools/bootanalyze/stressfs/Android.bp boottime_tools/bootio/Android.bp checkpoint_gc/Android.bp cppreopts/Android.bp crypto-perf/Android.bp ext4_utils/Android.bp ext4_utils/Android.mk f2fs_utils/Android.bp ioshark/Android.bp iotop/Android.bp kexec_tools/Android.bp latencytop/Android.bp libfec/Android.bp libfec/test/Android.bp libfscrypt/Android.bp libfscrypt/tests/Android.bp libjsonpb/parse/Android.bp libjsonpb/verify/Android.bp memory_replay/Android.bp memtrack/Android.bp mmap-perf/Android.bp module_ndk_libs/libnativehelper/Android.bp multinetwork/Android.bp pagecache/Android.bp partition_tools/Android.bp perf2cfg/Android.bp postinst/Android.bp preopt2cachename/Android.bp profcollectd/Android.bp profcollectd/libprofcollectd/Android.bp profcollectd/libprofcollectd/bindings/libflags/Android.bp puncture_fs/Android.bp runconuid/Android.bp sane_schedstat/Android.bp showslab/Android.bp simpleperf/Android.bp simpleperf/runtest/Android.bp simpleperf/scripts/inferno/Android.bp simpleperf/simpleperf_app_runner/Android.bp slideshow/Android.mk sound/Android.bp squashfs_utils/Android.bp su/Android.mk taskstats/Android.bp tests/Android.bp tests/audio/alsa/Android.bp tests/binder/benchmarks/Android.bp tests/bootloader/Android.mk tests/cpueater/Android.bp tests/crypto/Android.bp tests/directiotest/Android.bp tests/ext4/Android.mk tests/framebuffer/Android.bp tests/fstest/Android.bp tests/icachetest/Android.bp tests/iptables/qtaguid/Android.bp tests/kernel.config/Android.mk tests/lib/Android.bp tests/lib/testUtil/Android.bp tests/memeater/Android.mk tests/pagingtest/Android.mk tests/pftest/Android.bp tests/schedtest/Android.bp tests/storage/Android.bp tests/suspend_stress/Android.bp tests/tcp_nuke_addr/Android.bp tests/timetest/Android.bp tests/uevents/Android.bp toolchain-extras/Android.bp vbmeta_tools/Android.bp verity/Android.bp verity/fec/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: cpustats/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD legacy_notice to: Android.bp Added SPDX-license-identifier-BSD to: ANRdaemon/Android.bp Added legacy_notice to: alloc-stress/Android.bp app-launcher/Android.bp brillo_config/Android.mk ioblame/Android.bp partition_tools/aidl/Android.bp pssbench/Android.mk zram-perf/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ie7c022a4d7f828a89d0cda663684a497af37006e
2021-01-20Switch required to data to be bundled in host-unit-testsJulien Desprez
Test: make fec_unittest Bug: 177450457 Change-Id: I01d8cb0585e94703be97523117ef95581b75cbba
2020-09-28Add WriteHashTree() to allow users process hashtree data themselvesKelvin Zhang
Sometimes we may want to write hash tree data somewhere else other than fd. For example, we may want to send hash tree data to CowWriter. Currently there's no interface to do that, so we added a generate WriteHashTree() so users can process the hashtree data themselves Test: treehugger Change-Id: I56258ee8497336abcb804facef017ed71b5c9415
2020-03-09Allow building libfec without libavbTianjie Xu
Add stub implementation for avb related functions to allow building libfec without libavb support. This is useful to build the fec binary when libavb isn't available on mac. Test: build, unittests pass Change-Id: I26f8de390c3c2c37bf48418fb31038ddd9863866
2020-01-21Suport parsing hashtree and ecc data from avbTianjie Xu
Add support to parse the AvbHashtreeFooter in the avb image. We are in particular looking for the ecc and hashtree data so that they can laster be used for error correction. Bug: 144388532 Test: unittests pass Change-Id: I3e53e3e84a58b00346274f9946cafc135702ac82
2020-01-14fec: Add liblog as a dependency where libbase is usedTom Cherry
Bug: 119867234 Test: build Change-Id: I49d2110a5469c4c58bf2587f8d7e4a5b8981caac
2020-01-10Merge "Add liblog as a dependency where libbase is used"Tom Cherry
2020-01-10Merge "Allow fec to be compiled with BUILD_HOST_static."Treehugger Robot
2020-01-09Add liblog as a dependency where libbase is usedTom Cherry
Bug: 119867234 Test: build Change-Id: I2728559bbd3cd4f867b30baf53a62124b8abd0b6
2020-01-09Allow fec to be compiled with BUILD_HOST_static.Dario Freni
Bug: 144477678 Test: m fec; BUILD_HOST_static=1 m fec Change-Id: Ic9d9fb65604e56e89a4c6ce75eb583beb34efe63
2020-01-05Add utility to calculate digest from the root of verity treeNikita Ioffe
This function will help verifying that external hashtree wasn't tampered. See another change in this topic for more context. Test: atest build_verity_tree_test Bug: 145670581 Change-Id: I10a8141a60eec142c77cde0048f0abf44b3406bb
2019-09-09verity: Do not increment data when it is nullptr.MarijnS95
Address a segfault introduced in d6dc877032c65768b3c6737156d3142f32cc9984 As soon as leftover_ becomes non-empty, the data pointer is incremented and will now be an invalid pointer in case it was null previously. The subsequent check in HashBlocks() will now encounter a non-null data ptr and pass it to HashBlock(), triggering a segfault. Test: Manually build and boot an image on which this crashed before. Test: build_verity_tree_test Change-Id: I324ff6103c9d35fb290c4e96fb5009ee365a0249 Signed-off-by: MarijnS95 <marijns95@gmail.com> (cherry picked from commit c82514bd034f214b16d273b10c676dd63a9e603b)
2019-05-02verity: Update the build rules for verity tools.Tao Bao
Test: `m -j dist` with aosp_marlin-userdebug (which uses the tools in this dir). Test: TreeHugger Change-Id: I39bae841ff287c431459fd42a4f64b099f12396e
2019-03-29Merge "Fix incorrect error checking on unique_fd"Treehugger Robot
2019-03-28Convert more of system/extras to Android.bpDan Willemsen
See build/soong/README.md for more information about Soong. Bug: 122331914 Test: cd system/extras; mma Test: treehugger Change-Id: Ic1cf293df2c848c7476ca93c150106a4a3cd849c
2019-03-28Fix incorrect error checking on unique_fdBernie Innocenti
The expression "!fd" calls the implicit conversion to int, but comparing the raw fd against 0 won't work, since open() and other POSIX calls returning file descriptors use -1 to signal an error. Test: m verity_verifier Change-Id: Ib117de62ff46c8d3389db54875bfa269fd539b51
2019-02-23Fix build error of generating fec dataJinguang Dong
When we make the fec data for spare images, we will check each chunk the length of spare image but not the total length. If the libspare sends the data which is not a multiple of 4096, there is an error. We have reproduced it using our image. The data is send by https://android.googlesource.com/platform/system/core/+/fca4a9c27950a4a4281de0f413280cff9f4da653/libsparse/output_file.cpp#272 , and is checked by https://android.googlesource.com/platform/system/extras/+/29bf737e56e10c2742f1e14fe9f07184d59bbcc0/verity/fec/image.cpp#179 If the to_write in first link is equal INT_MAX, the assert in second link will be failed. Test: use fec to product fec data successfully ./fec --encode --roots 2 system.img fecdata Change-Id: Ib1e310a32bcda8acb3785d3784537d84fd439732
2019-01-24boot_signer should support boot header version 2Hridya Valsaraju
Boot Image header version two modifies the boot image format to include DTB. Test: make Bug: 111136242 Change-Id: Icfc1fce695d0e19ff15a1d74afd00b9b88cccf7e
2018-11-14switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn
Test: compile Bug: 119313545 Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-10-23Mark libverity_tree as recovery_available for update_engine_sideloadDan Willemsen
Test: build update_engine_sideload Change-Id: I9a77e5e45f5acb0e7e3be0b6b080997c2b110691
2018-10-02verity: Support partial blocks in Update().Sen Jiang
In update_engine we get data from a callback, usually this will be a multiple of the block size, but that's not guaranteed. Bug: 28171891 Test: build_verity_tree_test Change-Id: I2fdf40e6e3750a86d409885917d3b5aeb77643d1
2018-09-05verity: Add HashTreeBuilder::CheckHashTree().Sen Jiang
Check the built hash tree against a given hash tree in a buffer, used to verify the hash tree when generating OTA. Bug: 28171891 Test: generate a payload with verity hash tree Change-Id: I60d6c3657343438b7720727874ab849e5970e576
2018-08-05Merge "Make host targets use non-repackaged targets"Treehugger Robot
2018-08-02Change the interface parameter from off_t to uint64_tTianjie Xu
Therefore, users won't need to set the FILE_OFFSET_BITS=64 Test: unit tests pass Change-Id: I6dbd756d598ee16282b10ae554ca852d61a6b809
2018-07-25Export headers for libverity_treeTianjie Xu
Also factor out a function to convert a hex string to the byte array. Bug: 25170618 Test: unit tests pass Change-Id: Id9252d58d8de065bce332e806e2302dd18a54a8c
2018-07-24Add support of more hash algorithms for verity tree builderTianjie Xu
Currently, verified boot 1.0 is using SHA256 to compute the hash tree while AVB is using SHA1. We should support at least these two hash functionss in the HashTreeBuilder and command line parser. And we can potentially add more algorithms in the future. Bug: 25170618 Test: unit tests pass Change-Id: I5f6dc8a545c0cef75acbbc2044959e8100f9f842
2018-07-23[verity] Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I1772953d2e66d3030aaa5a65e42d6ad664d19d78
2018-07-23Make host targets use non-repackaged targetsNeil Fuller
A host build target was depending on a target that is intended for on-device, repackaged (com.android.) use. This switches to using the unbundled target instead. Test: Build Bug: 111055375 Bug: 111734251 Change-Id: I47ea4f4807da9373feedd27022c0fc5c4f7650e6
2018-07-19Add unit tests to build_verity_treeTianjie Xu
Also factor out the cc_defaults in the bp file. Bug: 25170618 Test: unit tests pass Change-Id: If22b6fdea4b68fe61a7dc984204c1536ad3c5aee
2018-07-18Move functions in build_verity_tree to a static libraryTianjie Xu
Move the functions to calculate the hash tree size & generate the tree to a seperate static library. Also switch to libbase logging. Bug: 25170618 Test: run build_verity_tree to calculate size & generate a tree Change-Id: I88a2ce077292e35fe069d00000a9e59dbeb95317
2018-07-03Convert the sparse_hash_ctx to the HashTreeBuilder classTianjie Xu
Also convert the verity tree storage to std::vector. Check that the run time doesn't increase much. Bug: 25170618 Test: run build_verity_tree on a system image and check the root hash Change-Id: I911c40fe9c540a35bd0397c16e09be81f28b3642
2018-05-09Convert more of system/extras to SoongDan Willemsen
See build/soong/README.md for more information. Some modules are no longer installed by default on eng/debug builds, but I didn't see any automatic references to them. If they're commonly used by users, they can be added into build/make with PRODUCT_PACKAGES_ENG / PRODUCT_PACKAGES_DEBUG. Otherwise everyone's compiles get a little smaller. Some modules also moved from /system/xbin to /system/bin, as we've deprecated xbin. I checked codesearch for references to the full paths and couldn't find any. Test: cd system/extras; mma Test: for the modules changing locations, check cs/ for references Change-Id: I4ffd99d3dcf50e4d5cb2197824abc11973214133
2018-04-24verity: Track the libsparse API change.Tao Bao
libsparse is updating the 'len' parameter, from 'int' to 'size_t', in the callback parameter of sparse_file_callback(). The value represents the chunk size, which could be legitimately larger than INT_MAX. Bug: 78432315 Test: `m dist` with aosp_marlin-userdebug Change-Id: I0c4b9465fd145b6a35d8228430362d25b8fd4c6e
2018-03-28Allow recovery-dtbo in recovery.img to be signedHridya Valsaraju
Non-A/B devices need to include the DTBO image within the recovery partition to be self-sufficient and prevent OTA failures. The CL includes the size of recovery DTBO in the size of the boot image to be signed to prevent image truncation. Test: Verified that recovery.img was not getting truncated. Bug: 74763691 Change-Id: Id56928129dfea167e2451aa5f4609fef77e00ff4
2018-03-20Remove verify_boot_signature.David Benjamin
The immediate motivation is to trim away uses of the <openssl/asn1t.h> header. Per email with samitolvanen@, this verified boot scheme has been deprecated for a while, and this target isn't actually used anywhere. It is only a rough example for OEMs. Accordingly, remove it. Test: mma Change-Id: Ie3b6d2c3fb0a6873b81a1a048945ef8258521f16
2017-10-20Use -Werror in system/extrasChih-Hung Hsieh
* Remove unused variables. * Fix redefined macro warnings. * Fix sign-compare warnings. * Fix 'return false' in main(). * Keep existing warnings to fix later. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: Ib92ef5297693595fb84ed4f8e61665bda4cee312
2017-10-11build_verity_metadata.py: allow disabling verityBowgo Tsai
Allowing building metadata with the "VOFF" magic, for ENG builds to disable dm-verity by default. The resulting metadata is the same as triggering an "adb disable-verity" on an USERDEBUG image. With this, fs_mgr doesn't need to know whether it's an ENG build and can rely on the magic to know it should enable dm-verity or not. Bug: 63056044 Test: boot sailfish eng/userdebug builds Change-Id: Ie81de372aa057f3aafa0eb571b460e73aa5eb375
2017-09-22verity: Fix the broken 'build_verity_tree -A'.Tao Bao
Commit 6eb049322c26431961fb69168a113bfd27016ab3 introduced a bug in checking if there's any passed-in salt string (via '-A <salt>' or '-a <salt>'). "salt.data()" should be "salt.empty()", which otherwise may or may not be nullptr even if salt is empty. This CL fixes the issue. This CL also removes the duplicate variable 'salt_size', which can be fully covered by salt.size(). Test: m build_verity_tree; Test: `build_verity_tree system.img verity.img` gives random root hash and salt string across runs. Test: `build_verity_tree -A <hex string> system.img verity.img` gives identical results across runs. Test: `build_verity_tree -a <string> system.img verity.img` gives identical results across runs. Change-Id: I377e42fc48c0f703dc33d813466f6ef60514bbe5
2017-09-08Merge "<stdbool.h> not necessary in C++."Elliott Hughes