diff --git a/dtbhtool/Android.mk b/dtbhtool/Android.mk index 100d608f..7769e9c9 100644 --- a/dtbhtool/Android.mk +++ b/dtbhtool/Android.mk @@ -12,7 +12,7 @@ include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := mkbootimg.c -LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libmincrypt +LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libcrypto_static LOCAL_MODULE := mkdtbhbootimg @@ -34,7 +34,7 @@ include $(BUILD_HOST_EXECUTABLE) include $(CLEAR_VARS) LOCAL_SRC_FILES := mkbootimg.c -LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libmincrypt libcutils libc +LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libcrypto_static libcutils libc LOCAL_MODULE := utility_mkdtbhbootimg LOCAL_MODULE_STEM := mkdtbhbootimg LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES diff --git a/dtbhtool/mkbootimg.c b/dtbhtool/mkbootimg.c index bb1528e1..7b59139d 100644 --- a/dtbhtool/mkbootimg.c +++ b/dtbhtool/mkbootimg.c @@ -36,7 +36,7 @@ #include -#include "mincrypt/sha.h" +#include #include "bootimg.h" static void *load_file(const char *fn, unsigned *_sz) @@ -131,7 +131,7 @@ int main(int argc, char **argv) unsigned pagesize = 2048; int fd; SHA_CTX ctx; - uint8_t* sha; + uint8_t sha[SHA_DIGEST_LENGTH]; unsigned base = 0x10000000; unsigned kernel_offset = 0x00008000; unsigned ramdisk_offset = 0x01000000; @@ -283,20 +283,20 @@ int main(int argc, char **argv) /* put a hash of the contents in the header so boot images can be * differentiated based on their first 2k. */ - SHA_init(&ctx); - SHA_update(&ctx, kernel_data, hdr.kernel_size); - SHA_update(&ctx, &hdr.kernel_size, sizeof(hdr.kernel_size)); - SHA_update(&ctx, ramdisk_data, hdr.ramdisk_size); - SHA_update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size)); - SHA_update(&ctx, second_data, hdr.second_size); - SHA_update(&ctx, &hdr.second_size, sizeof(hdr.second_size)); + SHA1_Init(&ctx); + SHA1_Update(&ctx, kernel_data, hdr.kernel_size); + SHA1_Update(&ctx, &hdr.kernel_size, sizeof(hdr.kernel_size)); + SHA1_Update(&ctx, ramdisk_data, hdr.ramdisk_size); + SHA1_Update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size)); + SHA1_Update(&ctx, second_data, hdr.second_size); + SHA1_Update(&ctx, &hdr.second_size, sizeof(hdr.second_size)); if(dt_data) { - SHA_update(&ctx, dt_data, hdr.dt_size); - SHA_update(&ctx, &hdr.dt_size, sizeof(hdr.dt_size)); + SHA1_Update(&ctx, dt_data, hdr.dt_size); + SHA1_Update(&ctx, &hdr.dt_size, sizeof(hdr.dt_size)); } - sha = SHA_final(&ctx); + SHA1_Final(sha, &ctx); memcpy(hdr.id, sha, - SHA_DIGEST_SIZE > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_SIZE); + SHA_DIGEST_LENGTH > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_LENGTH); fd = open(bootimg, O_CREAT | O_TRUNC | O_WRONLY, 0644); if(fd < 0) { diff --git a/dtbhtool/unpackbootimg.c b/dtbhtool/unpackbootimg.c index aef2166b..acc9659e 100644 --- a/dtbhtool/unpackbootimg.c +++ b/dtbhtool/unpackbootimg.c @@ -7,7 +7,6 @@ #include #include -#include "mincrypt/sha.h" #include "bootimg.h" typedef unsigned char byte;