include $(CLEAR_VARS)
LOCAL_SRC_FILES := mkbootimg.c
-LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libmincrypt
+LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libcrypto_static
LOCAL_MODULE := mkdtbhbootimg
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
#include <dtbimg.h>
-#include "mincrypt/sha.h"
+#include <openssl/sha.h>
#include "bootimg.h"
static void *load_file(const char *fn, unsigned *_sz)
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;
/* 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) {