From: Alain Spineux Date: Thu, 20 Oct 2022 10:09:51 +0000 (+0200) Subject: fix XXH3_64bits() not exported by bacula.dll in 64bits X-Git-Tag: Beta-15.0.0~399 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64695ef99c1383b39dee4b8eeda49619ef45567e;p=thirdparty%2Fbacula.git fix XXH3_64bits() not exported by bacula.dll in 64bits --- diff --git a/bacula/src/lib/crypto.c b/bacula/src/lib/crypto.c index fd60564a0..a1147d058 100644 --- a/bacula/src/lib/crypto.c +++ b/bacula/src/lib/crypto.c @@ -1866,3 +1866,12 @@ int block_cipher_get_key_length(BLOCK_CIPHER_CONTEXT *blk_ctx) { return blk_ctx->key_length; } + +/* wrapper for XXH3_64bits, this is for Windows bacula.dll because XXH3_64bits + * don't show up in bacula64.def + */ +uint64_t bXXH3_64bits(const void* input, size_t length) +{ + return XXH3_64bits(input, length); +} + diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index c206dc579..c94a7c8d9 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -238,6 +238,8 @@ int block_cipher_encrypt(BLOCK_CIPHER_CONTEXT *blk_ctx, int len, const char *src int block_cipher_decrypt(BLOCK_CIPHER_CONTEXT *blk_ctx, int len, const char *src, char *dst); int block_cipher_get_key_length(BLOCK_CIPHER_CONTEXT *blk_ctx); +uint64_t bXXH3_64bits(const void* input, size_t length); + /* daemon.c */ void daemon_start (); diff --git a/bacula/src/stored/block_util.c b/bacula/src/stored/block_util.c index b6c70b8d8..8b1626dd3 100644 --- a/bacula/src/stored/block_util.c +++ b/bacula/src/stored/block_util.c @@ -26,7 +26,6 @@ #include "bacula.h" #include "stored.h" -#include "lib/xxhash.h" static const int dbglvl = 160; @@ -101,7 +100,7 @@ void dump_block(DEVICE *dev, DEV_BLOCK *b, const char *msg, bool force) uint64_t save; memcpy(&save, b->buf+BLKHDR_CS64_OFFSET, BLKHDR_CS64_LENGTH); memset(b->buf+BLKHDR_CS64_OFFSET, '\0', BLKHDR_CS64_LENGTH); - BlockCheckSum64 = XXH3_64bits((uint8_t *)b->buf+BLKHDR_CS_LENGTH, + BlockCheckSum64 = bXXH3_64bits((uint8_t *)b->buf+BLKHDR_CS_LENGTH, block_len-BLKHDR_CS_LENGTH); /* restore the checksum */ memcpy(b->buf+BLKHDR_CS64_OFFSET, &save, BLKHDR_CS64_LENGTH); @@ -415,7 +414,7 @@ uint64_t ser_block_header(DEV_BLOCK *block, bool do_checksum) ser_uint64(0x00); // the XXH3_64 checksum if (do_checksum) { /* Checksum whole block including the checksum with value 0x0 */ - block->CheckSum64 = XXH3_64bits((uint8_t *)block->buf, + block->CheckSum64 = bXXH3_64bits((uint8_t *)block->buf, block_len); /* update the checksum in the block header */ ser_begin(block->buf+chk_off, BLKHDR_CS64_LENGTH); @@ -605,7 +604,7 @@ bool unser_block_header(DCR *dcr, DEVICE *dev, DEV_BLOCK *block) uint64_t save; /* make a copy of the xxh64 */ memcpy(&save, block->buf+chk_off, BLKHDR_CS64_LENGTH); memset(block->buf+chk_off, '\0', BLKHDR_CS64_LENGTH); - BlockCheckSum64 = XXH3_64bits((uint8_t *)block->buf, + BlockCheckSum64 = bXXH3_64bits((uint8_t *)block->buf, block_len); memcpy(block->buf+chk_off, &save, BLKHDR_CS64_LENGTH); } else {