summaryrefslogtreecommitdiffstats
path: root/fuse_sideload.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-08-25 22:32:21 +0200
committerEthan Yonker <dees_troy@teamw.in>2016-08-25 22:36:13 +0200
commitf117962eb25bde75e981c3bff91ba708a55df65e (patch)
tree4d8565830b460a940ad33701e953d0371a0e5355 /fuse_sideload.cpp
parentUpdate to 7.0 (diff)
downloadandroid_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.tar
android_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.tar.gz
android_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.tar.bz2
android_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.tar.lz
android_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.tar.xz
android_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.tar.zst
android_bootable_recovery-f117962eb25bde75e981c3bff91ba708a55df65e.zip
Diffstat (limited to '')
-rw-r--r--fuse_sideload.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/fuse_sideload.cpp b/fuse_sideload.cpp
index 66dc4be86..f57d479b0 100644
--- a/fuse_sideload.cpp
+++ b/fuse_sideload.cpp
@@ -61,7 +61,12 @@
#include <sys/uio.h>
#include <unistd.h>
+#ifdef USE_MINCRYPT
+#include "mincrypt/sha256.h"
+#define SHA256_DIGEST_LENGTH SHA256_DIGEST_SIZE
+#else
#include <openssl/sha.h>
+#endif
#include "fuse_sideload.h"
@@ -275,7 +280,11 @@ static int fetch_block(struct fuse_data* fd, uint32_t block) {
// - Otherwise, return -EINVAL for the read.
uint8_t hash[SHA256_DIGEST_LENGTH];
+#ifdef USE_MINCRYPT
+ SHA256_hash(fd->block_data, fd->block_size, hash);
+#else
SHA256(fd->block_data, fd->block_size, hash);
+#endif
uint8_t* blockhash = fd->hashes + block * SHA256_DIGEST_LENGTH;
if (memcmp(hash, blockhash, SHA256_DIGEST_LENGTH) == 0) {
return 0;
@@ -527,3 +536,9 @@ int run_fuse_sideload(struct provider_vtab* vtab, void* cookie,
return result;
}
+
+extern "C" int run_old_fuse_sideload(struct provider_vtab* vtab, void* cookie,
+ uint64_t file_size, uint32_t block_size)
+{
+ return run_fuse_sideload(vtab, cookie, file_size, block_size);
+}