diff --git a/src/shared/crypto.c b/src/shared/crypto.c
index ce0dcd6..5c5e121 100644
--- a/src/shared/crypto.c
+++ b/src/shared/crypto.c
return true;
}
+
+bool bt_crypto_gatt_hash(struct bt_crypto *crypto, struct iovec *iov,
+ size_t iov_len, uint8_t res[16])
+{
+ const uint8_t key[16] = {};
+ ssize_t len;
+ int fd;
+
+ if (!crypto)
+ return false;
+
+ fd = alg_new(crypto->cmac_aes, key, 16);
+ if (fd < 0)
+ return false;
+
+ len = writev(fd, iov, iov_len);
+ if (len < 0) {
+ close(fd);
+ return false;
+ }
+
+ len = read(fd, res, 16);
+ if (len < 0) {
+ close(fd);
+ return false;
+ }
+
+ close(fd);
+
+ return true;
+}
diff --git a/src/shared/crypto.h b/src/shared/crypto.h
index 1e1b483..c58d2e1 100644
--- a/src/shared/crypto.h
+++ b/src/shared/crypto.h
#include <stdbool.h>
#include <stdint.h>
+#include <sys/uio.h>
struct bt_crypto;
bool bt_crypto_sign_att(struct bt_crypto *crypto, const uint8_t key[16],
const uint8_t *m, uint16_t m_len,
uint32_t sign_cnt, uint8_t signature[12]);
+bool bt_crypto_gatt_hash(struct bt_crypto *crypto, struct iovec *iov,
+ size_t iov_len, uint8_t res[16]);