Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 338a3353 authored by Elliott Hughes's avatar Elliott Hughes Committed by android-build-merger
Browse files

Merge "Move dumpstate off mincrypt and over to BoringSSL." into nyc-dev-plus-aosp

am: 042ad795

* commit '042ad795':
  Move dumpstate off mincrypt and over to BoringSSL.

Change-Id: I7a04eb4a96a420db0c4924b74b8a4ab830a3df4a
parents 7c90bfcb 042ad795
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ LOCAL_MODULE := dumpstate

LOCAL_SHARED_LIBRARIES := libcutils liblog libselinux
# ZipArchive support, the order matters here to get all symbols.
LOCAL_STATIC_LIBRARIES := libziparchive libz libbase libmincrypt
LOCAL_STATIC_LIBRARIES := libziparchive libz libbase libcrypto_static
LOCAL_HAL_STATIC_LIBRARIES := libdumpstate
LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter
LOCAL_INIT_RC := dumpstate.rc
+8 −7
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
#include "ScopedFd.h"
#include "ziparchive/zip_writer.h"

#include "mincrypt/sha256.h"
#include <openssl/sha.h>

using android::base::StringPrintf;

@@ -985,7 +985,7 @@ static std::string SHA256_file_hash(std::string filepath) {
    }

    SHA256_CTX ctx;
    SHA256_init(&ctx);
    SHA256_Init(&ctx);

    std::vector<uint8_t> buffer(65536);
    while (1) {
@@ -997,13 +997,14 @@ static std::string SHA256_file_hash(std::string filepath) {
            return NULL;
        }

        SHA256_update(&ctx, buffer.data(), bytes_read);
        SHA256_Update(&ctx, buffer.data(), bytes_read);
    }

    uint8_t hash[SHA256_DIGEST_SIZE];
    memcpy(hash, SHA256_final(&ctx), SHA256_DIGEST_SIZE);
    char hash_buffer[SHA256_DIGEST_SIZE * 2 + 1];
    for(size_t i = 0; i < SHA256_DIGEST_SIZE; i++) {
    uint8_t hash[SHA256_DIGEST_LENGTH];
    SHA256_Final(hash, &ctx);

    char hash_buffer[SHA256_DIGEST_LENGTH * 2 + 1];
    for(size_t i = 0; i < SHA256_DIGEST_LENGTH; i++) {
        sprintf(hash_buffer + (i * 2), "%02x", hash[i]);
    }
    hash_buffer[sizeof(hash_buffer) - 1] = 0;