summaryrefslogtreecommitdiffstats
path: root/fuse_sideload.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-04-13 02:15:40 +0200
committerElliott Hughes <enh@google.com>2016-04-13 02:15:40 +0200
commit6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2 (patch)
treee7f86e2e969d3c1de73c3ed4a743bfb75e08f569 /fuse_sideload.cpp
parentresolve merge conflicts of a58a6db to nyc-dev-plus-aosp (diff)
parentMerge "Convert recovery to use BoringSSL instead of mincrypt." (diff)
downloadandroid_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.tar
android_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.tar.gz
android_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.tar.bz2
android_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.tar.lz
android_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.tar.xz
android_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.tar.zst
android_bootable_recovery-6e2a8b11ecb0bdfd6f4a2f096519075663a2d1c2.zip
Diffstat (limited to 'fuse_sideload.cpp')
-rw-r--r--fuse_sideload.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/fuse_sideload.cpp b/fuse_sideload.cpp
index 9c3e75f89..1725e8823 100644
--- a/fuse_sideload.cpp
+++ b/fuse_sideload.cpp
@@ -61,7 +61,8 @@
#include <sys/uio.h>
#include <unistd.h>
-#include "mincrypt/sha256.h"
+#include <openssl/sha.h>
+
#include "fuse_sideload.h"
#define PACKAGE_FILE_ID (FUSE_ROOT_ID+1)
@@ -269,22 +270,22 @@ static int fetch_block(struct fuse_data* fd, uint32_t block) {
// block).
// - Otherwise, return -EINVAL for the read.
- uint8_t hash[SHA256_DIGEST_SIZE];
- SHA256_hash(fd->block_data, fd->block_size, hash);
- uint8_t* blockhash = fd->hashes + block * SHA256_DIGEST_SIZE;
- if (memcmp(hash, blockhash, SHA256_DIGEST_SIZE) == 0) {
+ uint8_t hash[SHA256_DIGEST_LENGTH];
+ SHA256(fd->block_data, fd->block_size, hash);
+ uint8_t* blockhash = fd->hashes + block * SHA256_DIGEST_LENGTH;
+ if (memcmp(hash, blockhash, SHA256_DIGEST_LENGTH) == 0) {
return 0;
}
int i;
- for (i = 0; i < SHA256_DIGEST_SIZE; ++i) {
+ for (i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
if (blockhash[i] != 0) {
fd->curr_block = -1;
return -EIO;
}
}
- memcpy(blockhash, hash, SHA256_DIGEST_SIZE);
+ memcpy(blockhash, hash, SHA256_DIGEST_LENGTH);
return 0;
}
@@ -393,10 +394,10 @@ int run_fuse_sideload(struct provider_vtab* vtab, void* cookie,
goto done;
}
- fd.hashes = (uint8_t*)calloc(fd.file_blocks, SHA256_DIGEST_SIZE);
+ fd.hashes = (uint8_t*)calloc(fd.file_blocks, SHA256_DIGEST_LENGTH);
if (fd.hashes == NULL) {
fprintf(stderr, "failed to allocate %d bites for hashes\n",
- fd.file_blocks * SHA256_DIGEST_SIZE);
+ fd.file_blocks * SHA256_DIGEST_LENGTH);
result = -1;
goto done;
}