diff --git a/crypto/hash.c b/crypto/hash.c
index fc658475..b1cdfe67 100644
--- a/crypto/hash.c
+++ b/crypto/hash.c
@@ -1,3 +1,7 @@
+#include <gcrypt.h>
We don't need the libgcrypt library when configured with
--with-crypto=builtin
So this should come under the define CRYPTOPROVIDER_LIB...
diff --git a/crypto/hash.h b/crypto/hash.h
index fefccbd5..252ce9f9 100644
--- a/crypto/hash.h
+++ b/crypto/hash.h
@@ -9,5 +9,7 @@ int hash_crc32c(const u8 *buf, size_t length, u8 *out);
int hash_xxhash(const u8 *buf, size_t length, u8 *out);
int hash_sha256(const u8 *buf, size_t length, u8 *out);
int hash_blake2b(const u8 *buf, size_t length, u8 *out);
+int hash_hmac_sha256(struct btrfs_fs_info *fs_info, const u8 *buf,
+ size_t length, u8 *out);
#endif
diff --git a/disk-io.c b/disk-io.c
index 6221c3ce..5fa1f0c3 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -153,6 +153,10 @@ int btrfs_csum_data(struct btrfs_fs_info *fs_info, u16 csum_type,
return hash_sha256(data, len, out);
case BTRFS_CSUM_TYPE_BLAKE2:
return hash_blake2b(data, len, out);
+ case BTRFS_CSUM_TYPE_HMAC_SHA256:
+ if (!fs_info || !fs_info->auth_key)
+ return 0;
+ return hash_hmac_sha256(fs_info, data, len, out);
hash_hmac_sha256() is defined under CRYPTOPROVIDER_LIB...
So with default builtin option.
/Volumes/ws/btrfs-progs/disk-io.c:159: undefined reference to
`hash_hmac_sha256'
Thanks, Anand