Merge "Move rangeset.h and print_sha1.h into otautil."
am: ff9b6f63a2
Change-Id: I4fea3584f64b273922ff20e9661c02a34ccca2f8
This commit is contained in:
@@ -229,6 +229,7 @@ LOCAL_SRC_FILES := \
|
|||||||
asn1_decoder.cpp \
|
asn1_decoder.cpp \
|
||||||
verifier.cpp
|
verifier.cpp
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
|
libotautil \
|
||||||
libcrypto_utils \
|
libcrypto_utils \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
libbase
|
libbase
|
||||||
|
|||||||
+17
-17
@@ -25,12 +25,13 @@ LOCAL_SRC_FILES := \
|
|||||||
LOCAL_MODULE := libapplypatch
|
LOCAL_MODULE := libapplypatch
|
||||||
LOCAL_MODULE_TAGS := eng
|
LOCAL_MODULE_TAGS := eng
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/include \
|
$(LOCAL_PATH)/include
|
||||||
bootable/recovery
|
LOCAL_EXPORT_C_INCLUDE_DIRS := \
|
||||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
$(LOCAL_PATH)/include
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libedify \
|
libedify \
|
||||||
libotafault \
|
libotafault \
|
||||||
|
libotautil \
|
||||||
libbase \
|
libbase \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
libbspatch \
|
libbspatch \
|
||||||
@@ -50,11 +51,12 @@ LOCAL_SRC_FILES := \
|
|||||||
imgpatch.cpp
|
imgpatch.cpp
|
||||||
LOCAL_MODULE := libimgpatch
|
LOCAL_MODULE := libimgpatch
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/include \
|
$(LOCAL_PATH)/include
|
||||||
bootable/recovery
|
LOCAL_EXPORT_C_INCLUDE_DIRS := \
|
||||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
$(LOCAL_PATH)/include
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libedify \
|
libedify \
|
||||||
|
libotautil \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
libbspatch \
|
libbspatch \
|
||||||
libbase \
|
libbase \
|
||||||
@@ -75,11 +77,12 @@ LOCAL_SRC_FILES := \
|
|||||||
LOCAL_MODULE := libimgpatch
|
LOCAL_MODULE := libimgpatch
|
||||||
LOCAL_MODULE_HOST_OS := linux
|
LOCAL_MODULE_HOST_OS := linux
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/include \
|
$(LOCAL_PATH)/include
|
||||||
bootable/recovery
|
LOCAL_EXPORT_C_INCLUDE_DIRS := \
|
||||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
$(LOCAL_PATH)/include
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libedify \
|
libedify \
|
||||||
|
libotautil \
|
||||||
libcrypto \
|
libcrypto \
|
||||||
libbspatch \
|
libbspatch \
|
||||||
libbase \
|
libbase \
|
||||||
@@ -97,9 +100,9 @@ include $(CLEAR_VARS)
|
|||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
applypatch_modes.cpp
|
applypatch_modes.cpp
|
||||||
LOCAL_MODULE := libapplypatch_modes
|
LOCAL_MODULE := libapplypatch_modes
|
||||||
LOCAL_C_INCLUDES := bootable/recovery
|
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libapplypatch \
|
libapplypatch \
|
||||||
|
libotautil \
|
||||||
libbase \
|
libbase \
|
||||||
libedify \
|
libedify \
|
||||||
libcrypto
|
libcrypto
|
||||||
@@ -111,7 +114,6 @@ include $(BUILD_STATIC_LIBRARY)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_SRC_FILES := applypatch_main.cpp
|
LOCAL_SRC_FILES := applypatch_main.cpp
|
||||||
LOCAL_MODULE := applypatch
|
LOCAL_MODULE := applypatch
|
||||||
LOCAL_C_INCLUDES := bootable/recovery
|
|
||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libapplypatch_modes \
|
libapplypatch_modes \
|
||||||
libapplypatch \
|
libapplypatch \
|
||||||
@@ -141,6 +143,7 @@ libimgdiff_cflags := \
|
|||||||
-DZLIB_CONST
|
-DZLIB_CONST
|
||||||
|
|
||||||
libimgdiff_static_libraries := \
|
libimgdiff_static_libraries := \
|
||||||
|
libotautil \
|
||||||
libbsdiff \
|
libbsdiff \
|
||||||
libdivsufsort \
|
libdivsufsort \
|
||||||
libdivsufsort64 \
|
libdivsufsort64 \
|
||||||
@@ -161,8 +164,7 @@ LOCAL_CFLAGS := \
|
|||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
$(libimgdiff_static_libraries)
|
$(libimgdiff_static_libraries)
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/include \
|
$(LOCAL_PATH)/include
|
||||||
bootable/recovery
|
|
||||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
@@ -177,8 +179,7 @@ LOCAL_CFLAGS := \
|
|||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
$(libimgdiff_static_libraries)
|
$(libimgdiff_static_libraries)
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/include \
|
$(LOCAL_PATH)/include
|
||||||
bootable/recovery
|
|
||||||
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
|
||||||
include $(BUILD_HOST_STATIC_LIBRARY)
|
include $(BUILD_HOST_STATIC_LIBRARY)
|
||||||
|
|
||||||
@@ -193,6 +194,5 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
$(libimgdiff_static_libraries) \
|
$(libimgdiff_static_libraries) \
|
||||||
libbz
|
libbz
|
||||||
LOCAL_C_INCLUDES := \
|
LOCAL_C_INCLUDES := \
|
||||||
$(LOCAL_PATH)/include \
|
$(LOCAL_PATH)/include
|
||||||
bootable/recovery
|
|
||||||
include $(BUILD_HOST_EXECUTABLE)
|
include $(BUILD_HOST_EXECUTABLE)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "otafault/ota_io.h"
|
#include "otafault/ota_io.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
|
||||||
static int LoadPartitionContents(const std::string& filename, FileContents* file);
|
static int LoadPartitionContents(const std::string& filename, FileContents* file);
|
||||||
static size_t FileSink(const unsigned char* data, size_t len, int fd);
|
static size_t FileSink(const unsigned char* data, size_t len, int fd);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "applypatch/applypatch.h"
|
#include "applypatch/applypatch.h"
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
|
||||||
void ShowBSDiffLicense() {
|
void ShowBSDiffLicense() {
|
||||||
puts("The bsdiff library used herein is:\n"
|
puts("The bsdiff library used herein is:\n"
|
||||||
|
|||||||
@@ -166,7 +166,7 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "applypatch/imgdiff_image.h"
|
#include "applypatch/imgdiff_image.h"
|
||||||
#include "rangeset.h"
|
#include "otautil/rangeset.h"
|
||||||
|
|
||||||
using android::base::get_unaligned;
|
using android::base::get_unaligned;
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
#include "imgdiff.h"
|
#include "imgdiff.h"
|
||||||
#include "rangeset.h"
|
#include "otautil/rangeset.h"
|
||||||
|
|
||||||
class ImageChunk {
|
class ImageChunk {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -23,25 +23,25 @@
|
|||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
|
|
||||||
static std::string print_sha1(const uint8_t* sha1, size_t len) {
|
static std::string print_sha1(const uint8_t* sha1, size_t len) {
|
||||||
const char* hex = "0123456789abcdef";
|
const char* hex = "0123456789abcdef";
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
for (size_t i = 0; i < len; ++i) {
|
for (size_t i = 0; i < len; ++i) {
|
||||||
result.push_back(hex[(sha1[i]>>4) & 0xf]);
|
result.push_back(hex[(sha1[i] >> 4) & 0xf]);
|
||||||
result.push_back(hex[sha1[i] & 0xf]);
|
result.push_back(hex[sha1[i] & 0xf]);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
|
[[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
|
||||||
return print_sha1(sha1, SHA_DIGEST_LENGTH);
|
return print_sha1(sha1, SHA_DIGEST_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
|
[[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
|
||||||
return print_sha1(sha1, 4);
|
return print_sha1(sha1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) {
|
[[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) {
|
||||||
return print_sha1(bytes, len);
|
return print_sha1(bytes, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // RECOVERY_PRINT_SHA1_H
|
#endif // RECOVERY_PRINT_SHA1_H
|
||||||
@@ -201,6 +201,7 @@ LOCAL_SRC_FILES := \
|
|||||||
LOCAL_STATIC_LIBRARIES := \
|
LOCAL_STATIC_LIBRARIES := \
|
||||||
libimgdiff \
|
libimgdiff \
|
||||||
libimgpatch \
|
libimgpatch \
|
||||||
|
libotautil \
|
||||||
libbsdiff \
|
libbsdiff \
|
||||||
libbspatch \
|
libbspatch \
|
||||||
libziparchive \
|
libziparchive \
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include "applypatch/applypatch.h"
|
#include "applypatch/applypatch.h"
|
||||||
#include "applypatch/applypatch_modes.h"
|
#include "applypatch/applypatch_modes.h"
|
||||||
#include "common/test_constants.h"
|
#include "common/test_constants.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
|
||||||
static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) {
|
static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) {
|
||||||
ASSERT_NE(nullptr, sha1);
|
ASSERT_NE(nullptr, sha1);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "otautil/SysUtil.h"
|
#include "otautil/SysUtil.h"
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
#include "updater/blockimg.h"
|
#include "updater/blockimg.h"
|
||||||
#include "updater/install.h"
|
#include "updater/install.h"
|
||||||
#include "updater/updater.h"
|
#include "updater/updater.h"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "rangeset.h"
|
#include "otautil/rangeset.h"
|
||||||
|
|
||||||
TEST(RangeSetTest, Parse_smoke) {
|
TEST(RangeSetTest, Parse_smoke) {
|
||||||
RangeSet rs = RangeSet::Parse("2,1,10");
|
RangeSet rs = RangeSet::Parse("2,1,10");
|
||||||
|
|||||||
@@ -52,8 +52,8 @@
|
|||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
#include "otafault/ota_io.h"
|
#include "otafault/ota_io.h"
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
#include "rangeset.h"
|
#include "otautil/rangeset.h"
|
||||||
#include "updater/install.h"
|
#include "updater/install.h"
|
||||||
#include "updater/updater.h"
|
#include "updater/updater.h"
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -54,6 +54,7 @@
|
|||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <selinux/label.h>
|
#include <selinux/label.h>
|
||||||
#include <selinux/selinux.h>
|
#include <selinux/selinux.h>
|
||||||
|
#include <tune2fs.h>
|
||||||
#include <ziparchive/zip_archive.h>
|
#include <ziparchive/zip_archive.h>
|
||||||
|
|
||||||
#include "edify/expr.h"
|
#include "edify/expr.h"
|
||||||
@@ -61,8 +62,7 @@
|
|||||||
#include "otafault/ota_io.h"
|
#include "otafault/ota_io.h"
|
||||||
#include "otautil/DirUtil.h"
|
#include "otautil/DirUtil.h"
|
||||||
#include "otautil/error_code.h"
|
#include "otautil/error_code.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
#include "tune2fs.h"
|
|
||||||
#include "updater/updater.h"
|
#include "updater/updater.h"
|
||||||
|
|
||||||
// Send over the buffer to recovery though the command pipe.
|
// Send over the buffer to recovery though the command pipe.
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@
|
|||||||
#include <openssl/obj_mac.h>
|
#include <openssl/obj_mac.h>
|
||||||
|
|
||||||
#include "asn1_decoder.h"
|
#include "asn1_decoder.h"
|
||||||
#include "print_sha1.h"
|
#include "otautil/print_sha1.h"
|
||||||
|
|
||||||
static constexpr size_t MiB = 1024 * 1024;
|
static constexpr size_t MiB = 1024 * 1024;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user