aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--applypatch/Android.mk34
-rw-r--r--applypatch/applypatch.cpp2
-rw-r--r--applypatch/bspatch.cpp2
-rw-r--r--applypatch/imgdiff.cpp2
-rw-r--r--applypatch/include/applypatch/imgdiff_image.h2
-rw-r--r--otautil/include/otautil/print_sha1.h (renamed from print_sha1.h)20
-rw-r--r--otautil/include/otautil/rangeset.h (renamed from rangeset.h)0
-rw-r--r--tests/Android.mk1
-rw-r--r--tests/component/applypatch_test.cpp2
-rw-r--r--tests/component/updater_test.cpp2
-rw-r--r--tests/unit/rangeset_test.cpp4
-rw-r--r--updater/blockimg.cpp4
-rw-r--r--updater/install.cpp4
-rw-r--r--verifier.cpp2
15 files changed, 42 insertions, 40 deletions
diff --git a/Android.mk b/Android.mk
index b40e23dc..5fe37fd6 100644
--- a/Android.mk
+++ b/Android.mk
@@ -229,6 +229,7 @@ LOCAL_SRC_FILES := \
229 asn1_decoder.cpp \ 229 asn1_decoder.cpp \
230 verifier.cpp 230 verifier.cpp
231LOCAL_STATIC_LIBRARIES := \ 231LOCAL_STATIC_LIBRARIES := \
232 libotautil \
232 libcrypto_utils \ 233 libcrypto_utils \
233 libcrypto \ 234 libcrypto \
234 libbase 235 libbase
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 05d93700..66494e60 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -25,12 +25,13 @@ LOCAL_SRC_FILES := \
25LOCAL_MODULE := libapplypatch 25LOCAL_MODULE := libapplypatch
26LOCAL_MODULE_TAGS := eng 26LOCAL_MODULE_TAGS := eng
27LOCAL_C_INCLUDES := \ 27LOCAL_C_INCLUDES := \
28 $(LOCAL_PATH)/include \ 28 $(LOCAL_PATH)/include
29 bootable/recovery 29LOCAL_EXPORT_C_INCLUDE_DIRS := \
30LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 30 $(LOCAL_PATH)/include
31LOCAL_STATIC_LIBRARIES := \ 31LOCAL_STATIC_LIBRARIES := \
32 libedify \ 32 libedify \
33 libotafault \ 33 libotafault \
34 libotautil \
34 libbase \ 35 libbase \
35 libcrypto \ 36 libcrypto \
36 libbspatch \ 37 libbspatch \
@@ -50,11 +51,12 @@ LOCAL_SRC_FILES := \
50 imgpatch.cpp 51 imgpatch.cpp
51LOCAL_MODULE := libimgpatch 52LOCAL_MODULE := libimgpatch
52LOCAL_C_INCLUDES := \ 53LOCAL_C_INCLUDES := \
53 $(LOCAL_PATH)/include \ 54 $(LOCAL_PATH)/include
54 bootable/recovery 55LOCAL_EXPORT_C_INCLUDE_DIRS := \
55LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 56 $(LOCAL_PATH)/include
56LOCAL_STATIC_LIBRARIES := \ 57LOCAL_STATIC_LIBRARIES := \
57 libedify \ 58 libedify \
59 libotautil \
58 libcrypto \ 60 libcrypto \
59 libbspatch \ 61 libbspatch \
60 libbase \ 62 libbase \
@@ -75,11 +77,12 @@ LOCAL_SRC_FILES := \
75LOCAL_MODULE := libimgpatch 77LOCAL_MODULE := libimgpatch
76LOCAL_MODULE_HOST_OS := linux 78LOCAL_MODULE_HOST_OS := linux
77LOCAL_C_INCLUDES := \ 79LOCAL_C_INCLUDES := \
78 $(LOCAL_PATH)/include \ 80 $(LOCAL_PATH)/include
79 bootable/recovery 81LOCAL_EXPORT_C_INCLUDE_DIRS := \
80LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 82 $(LOCAL_PATH)/include
81LOCAL_STATIC_LIBRARIES := \ 83LOCAL_STATIC_LIBRARIES := \
82 libedify \ 84 libedify \
85 libotautil \
83 libcrypto \ 86 libcrypto \
84 libbspatch \ 87 libbspatch \
85 libbase \ 88 libbase \
@@ -97,9 +100,9 @@ include $(CLEAR_VARS)
97LOCAL_SRC_FILES := \ 100LOCAL_SRC_FILES := \
98 applypatch_modes.cpp 101 applypatch_modes.cpp
99LOCAL_MODULE := libapplypatch_modes 102LOCAL_MODULE := libapplypatch_modes
100LOCAL_C_INCLUDES := bootable/recovery
101LOCAL_STATIC_LIBRARIES := \ 103LOCAL_STATIC_LIBRARIES := \
102 libapplypatch \ 104 libapplypatch \
105 libotautil \
103 libbase \ 106 libbase \
104 libedify \ 107 libedify \
105 libcrypto 108 libcrypto
@@ -111,7 +114,6 @@ include $(BUILD_STATIC_LIBRARY)
111include $(CLEAR_VARS) 114include $(CLEAR_VARS)
112LOCAL_SRC_FILES := applypatch_main.cpp 115LOCAL_SRC_FILES := applypatch_main.cpp
113LOCAL_MODULE := applypatch 116LOCAL_MODULE := applypatch
114LOCAL_C_INCLUDES := bootable/recovery
115LOCAL_STATIC_LIBRARIES := \ 117LOCAL_STATIC_LIBRARIES := \
116 libapplypatch_modes \ 118 libapplypatch_modes \
117 libapplypatch \ 119 libapplypatch \
@@ -141,6 +143,7 @@ libimgdiff_cflags := \
141 -DZLIB_CONST 143 -DZLIB_CONST
142 144
143libimgdiff_static_libraries := \ 145libimgdiff_static_libraries := \
146 libotautil \
144 libbsdiff \ 147 libbsdiff \
145 libdivsufsort \ 148 libdivsufsort \
146 libdivsufsort64 \ 149 libdivsufsort64 \
@@ -161,8 +164,7 @@ LOCAL_CFLAGS := \
161LOCAL_STATIC_LIBRARIES := \ 164LOCAL_STATIC_LIBRARIES := \
162 $(libimgdiff_static_libraries) 165 $(libimgdiff_static_libraries)
163LOCAL_C_INCLUDES := \ 166LOCAL_C_INCLUDES := \
164 $(LOCAL_PATH)/include \ 167 $(LOCAL_PATH)/include
165 bootable/recovery
166LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 168LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
167include $(BUILD_STATIC_LIBRARY) 169include $(BUILD_STATIC_LIBRARY)
168 170
@@ -177,8 +179,7 @@ LOCAL_CFLAGS := \
177LOCAL_STATIC_LIBRARIES := \ 179LOCAL_STATIC_LIBRARIES := \
178 $(libimgdiff_static_libraries) 180 $(libimgdiff_static_libraries)
179LOCAL_C_INCLUDES := \ 181LOCAL_C_INCLUDES := \
180 $(LOCAL_PATH)/include \ 182 $(LOCAL_PATH)/include
181 bootable/recovery
182LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 183LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
183include $(BUILD_HOST_STATIC_LIBRARY) 184include $(BUILD_HOST_STATIC_LIBRARY)
184 185
@@ -193,6 +194,5 @@ LOCAL_STATIC_LIBRARIES := \
193 $(libimgdiff_static_libraries) \ 194 $(libimgdiff_static_libraries) \
194 libbz 195 libbz
195LOCAL_C_INCLUDES := \ 196LOCAL_C_INCLUDES := \
196 $(LOCAL_PATH)/include \ 197 $(LOCAL_PATH)/include
197 bootable/recovery
198include $(BUILD_HOST_EXECUTABLE) 198include $(BUILD_HOST_EXECUTABLE)
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 729d2a91..c8b75df7 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -40,7 +40,7 @@
40 40
41#include "edify/expr.h" 41#include "edify/expr.h"
42#include "otafault/ota_io.h" 42#include "otafault/ota_io.h"
43#include "print_sha1.h" 43#include "otautil/print_sha1.h"
44 44
45static int LoadPartitionContents(const std::string& filename, FileContents* file); 45static int LoadPartitionContents(const std::string& filename, FileContents* file);
46static size_t FileSink(const unsigned char* data, size_t len, int fd); 46static size_t FileSink(const unsigned char* data, size_t len, int fd);
diff --git a/applypatch/bspatch.cpp b/applypatch/bspatch.cpp
index b2f29fbd..c291464a 100644
--- a/applypatch/bspatch.cpp
+++ b/applypatch/bspatch.cpp
@@ -31,7 +31,7 @@
31 31
32#include "applypatch/applypatch.h" 32#include "applypatch/applypatch.h"
33#include "edify/expr.h" 33#include "edify/expr.h"
34#include "print_sha1.h" 34#include "otautil/print_sha1.h"
35 35
36void ShowBSDiffLicense() { 36void ShowBSDiffLicense() {
37 puts("The bsdiff library used herein is:\n" 37 puts("The bsdiff library used herein is:\n"
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index c887a854..3a61a7d0 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -166,7 +166,7 @@
166#include <zlib.h> 166#include <zlib.h>
167 167
168#include "applypatch/imgdiff_image.h" 168#include "applypatch/imgdiff_image.h"
169#include "rangeset.h" 169#include "otautil/rangeset.h"
170 170
171using android::base::get_unaligned; 171using android::base::get_unaligned;
172 172
diff --git a/applypatch/include/applypatch/imgdiff_image.h b/applypatch/include/applypatch/imgdiff_image.h
index 491043dc..3d29547c 100644
--- a/applypatch/include/applypatch/imgdiff_image.h
+++ b/applypatch/include/applypatch/imgdiff_image.h
@@ -29,7 +29,7 @@
29#include <zlib.h> 29#include <zlib.h>
30 30
31#include "imgdiff.h" 31#include "imgdiff.h"
32#include "rangeset.h" 32#include "otautil/rangeset.h"
33 33
34class ImageChunk { 34class ImageChunk {
35 public: 35 public:
diff --git a/print_sha1.h b/otautil/include/otautil/print_sha1.h
index d0c18b35..03a8d292 100644
--- a/print_sha1.h
+++ b/otautil/include/otautil/print_sha1.h
@@ -23,25 +23,25 @@
23#include <openssl/sha.h> 23#include <openssl/sha.h>
24 24
25static std::string print_sha1(const uint8_t* sha1, size_t len) { 25static std::string print_sha1(const uint8_t* sha1, size_t len) {
26 const char* hex = "0123456789abcdef"; 26 const char* hex = "0123456789abcdef";
27 std::string result = ""; 27 std::string result = "";
28 for (size_t i = 0; i < len; ++i) { 28 for (size_t i = 0; i < len; ++i) {
29 result.push_back(hex[(sha1[i]>>4) & 0xf]); 29 result.push_back(hex[(sha1[i] >> 4) & 0xf]);
30 result.push_back(hex[sha1[i] & 0xf]); 30 result.push_back(hex[sha1[i] & 0xf]);
31 } 31 }
32 return result; 32 return result;
33} 33}
34 34
35[[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) { 35[[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
36 return print_sha1(sha1, SHA_DIGEST_LENGTH); 36 return print_sha1(sha1, SHA_DIGEST_LENGTH);
37} 37}
38 38
39[[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) { 39[[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
40 return print_sha1(sha1, 4); 40 return print_sha1(sha1, 4);
41} 41}
42 42
43[[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) { 43[[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) {
44 return print_sha1(bytes, len); 44 return print_sha1(bytes, len);
45} 45}
46 46
47#endif // RECOVERY_PRINT_SHA1_H 47#endif // RECOVERY_PRINT_SHA1_H
diff --git a/rangeset.h b/otautil/include/otautil/rangeset.h
index f224a08b..f224a08b 100644
--- a/rangeset.h
+++ b/otautil/include/otautil/rangeset.h
diff --git a/tests/Android.mk b/tests/Android.mk
index 31c7de17..b0f71a83 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -201,6 +201,7 @@ LOCAL_SRC_FILES := \
201LOCAL_STATIC_LIBRARIES := \ 201LOCAL_STATIC_LIBRARIES := \
202 libimgdiff \ 202 libimgdiff \
203 libimgpatch \ 203 libimgpatch \
204 libotautil \
204 libbsdiff \ 205 libbsdiff \
205 libbspatch \ 206 libbspatch \
206 libziparchive \ 207 libziparchive \
diff --git a/tests/component/applypatch_test.cpp b/tests/component/applypatch_test.cpp
index 42542898..15ec08fe 100644
--- a/tests/component/applypatch_test.cpp
+++ b/tests/component/applypatch_test.cpp
@@ -35,7 +35,7 @@
35#include "applypatch/applypatch.h" 35#include "applypatch/applypatch.h"
36#include "applypatch/applypatch_modes.h" 36#include "applypatch/applypatch_modes.h"
37#include "common/test_constants.h" 37#include "common/test_constants.h"
38#include "print_sha1.h" 38#include "otautil/print_sha1.h"
39 39
40static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) { 40static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) {
41 ASSERT_NE(nullptr, sha1); 41 ASSERT_NE(nullptr, sha1);
diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp
index e35870dc..e6aec4ad 100644
--- a/tests/component/updater_test.cpp
+++ b/tests/component/updater_test.cpp
@@ -41,7 +41,7 @@
41#include "edify/expr.h" 41#include "edify/expr.h"
42#include "otautil/SysUtil.h" 42#include "otautil/SysUtil.h"
43#include "otautil/error_code.h" 43#include "otautil/error_code.h"
44#include "print_sha1.h" 44#include "otautil/print_sha1.h"
45#include "updater/blockimg.h" 45#include "updater/blockimg.h"
46#include "updater/install.h" 46#include "updater/install.h"
47#include "updater/updater.h" 47#include "updater/updater.h"
diff --git a/tests/unit/rangeset_test.cpp b/tests/unit/rangeset_test.cpp
index 15bcec85..b3ed9921 100644
--- a/tests/unit/rangeset_test.cpp
+++ b/tests/unit/rangeset_test.cpp
@@ -21,7 +21,7 @@
21 21
22#include <gtest/gtest.h> 22#include <gtest/gtest.h>
23 23
24#include "rangeset.h" 24#include "otautil/rangeset.h"
25 25
26TEST(RangeSetTest, Parse_smoke) { 26TEST(RangeSetTest, Parse_smoke) {
27 RangeSet rs = RangeSet::Parse("2,1,10"); 27 RangeSet rs = RangeSet::Parse("2,1,10");
@@ -156,4 +156,4 @@ TEST(SortedRangeSetTest, file_range) {
156 ASSERT_EQ(static_cast<size_t>(40970), rs.GetOffsetInRangeSet(4096 * 16 + 10)); 156 ASSERT_EQ(static_cast<size_t>(40970), rs.GetOffsetInRangeSet(4096 * 16 + 10));
157 // block#10 not in range. 157 // block#10 not in range.
158 ASSERT_EXIT(rs.GetOffsetInRangeSet(40970), ::testing::KilledBySignal(SIGABRT), ""); 158 ASSERT_EXIT(rs.GetOffsetInRangeSet(40970), ::testing::KilledBySignal(SIGABRT), "");
159} \ No newline at end of file 159}
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 0f836444..ce3cea4f 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -52,8 +52,8 @@
52#include "edify/expr.h" 52#include "edify/expr.h"
53#include "otafault/ota_io.h" 53#include "otafault/ota_io.h"
54#include "otautil/error_code.h" 54#include "otautil/error_code.h"
55#include "print_sha1.h" 55#include "otautil/print_sha1.h"
56#include "rangeset.h" 56#include "otautil/rangeset.h"
57#include "updater/install.h" 57#include "updater/install.h"
58#include "updater/updater.h" 58#include "updater/updater.h"
59 59
diff --git a/updater/install.cpp b/updater/install.cpp
index 01210f51..9425d187 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -54,6 +54,7 @@
54#include <openssl/sha.h> 54#include <openssl/sha.h>
55#include <selinux/label.h> 55#include <selinux/label.h>
56#include <selinux/selinux.h> 56#include <selinux/selinux.h>
57#include <tune2fs.h>
57#include <ziparchive/zip_archive.h> 58#include <ziparchive/zip_archive.h>
58 59
59#include "edify/expr.h" 60#include "edify/expr.h"
@@ -61,8 +62,7 @@
61#include "otafault/ota_io.h" 62#include "otafault/ota_io.h"
62#include "otautil/DirUtil.h" 63#include "otautil/DirUtil.h"
63#include "otautil/error_code.h" 64#include "otautil/error_code.h"
64#include "print_sha1.h" 65#include "otautil/print_sha1.h"
65#include "tune2fs.h"
66#include "updater/updater.h" 66#include "updater/updater.h"
67 67
68// Send over the buffer to recovery though the command pipe. 68// Send over the buffer to recovery though the command pipe.
diff --git a/verifier.cpp b/verifier.cpp
index 18437fb7..283e0430 100644
--- a/verifier.cpp
+++ b/verifier.cpp
@@ -32,7 +32,7 @@
32#include <openssl/obj_mac.h> 32#include <openssl/obj_mac.h>
33 33
34#include "asn1_decoder.h" 34#include "asn1_decoder.h"
35#include "print_sha1.h" 35#include "otautil/print_sha1.h"
36 36
37static constexpr size_t MiB = 1024 * 1024; 37static constexpr size_t MiB = 1024 * 1024;
38 38