]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
fix XXH3_64bits() not exported by bacula.dll in 64bits
authorAlain Spineux <alain@baculasystems.com>
Thu, 20 Oct 2022 10:09:51 +0000 (12:09 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:56:59 +0000 (13:56 +0200)
bacula/src/lib/crypto.c
bacula/src/lib/protos.h
bacula/src/stored/block_util.c

index fd60564a0715211319b56c24f4a678859251e4fb..a1147d05810ba58da399e836d45dc666b6b32018 100644 (file)
@@ -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);
+}
+
index c206dc5793d46d1403418c9553f8e21ce2224510..c94a7c8d9da931ca3d91a22a575f81ca8b0d6028 100644 (file)
@@ -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            ();
 
index b6c70b8d8dede4a4e6675782fb6ac28e2b037f4a..8b1626dd34617603a587b7fcf011a336467752a9 100644 (file)
@@ -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 {