mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
dtbhtool: Use BoringSSL instead of mincrypt
* mincrypt is gone as of LineageOS/android_system_core@6b11c13ae Change-Id: Ia3b1dee747510daff45a345ae603181be5ab6023
This commit is contained in:
parent
523971c63b
commit
a04741b693
3 changed files with 15 additions and 16 deletions
|
@ -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
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <dtbimg.h>
|
||||
|
||||
#include "mincrypt/sha.h"
|
||||
#include <openssl/sha.h>
|
||||
#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) {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include "mincrypt/sha.h"
|
||||
#include "bootimg.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
|
Loading…
Reference in a new issue