diff options
Diffstat (limited to 'fuse_sideload.cpp')
-rw-r--r-- | fuse_sideload.cpp | 15 |
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); +} |