]> git.ozlabs.org Git - ccan/blob - ccan/crypto/hmac_sha256/hmac_sha256.h
crypto/hmac_sha256: new module.
[ccan] / ccan / crypto / hmac_sha256 / hmac_sha256.h
1 #ifndef CCAN_CRYPTO_HMAC_SHA256_H
2 #define CCAN_CRYPTO_HMAC_SHA256_H
3 /* BSD-MIT - see LICENSE file for details */
4 #include "config.h"
5 #include <stdint.h>
6 #include <stdlib.h>
7 #include <ccan/crypto/sha256/sha256.h>
8
9 /* Uncomment this to use openssl's HMAC routines (and link with -lcrypto) */
10 /*#define CCAN_CRYPTO_HMAC_USE_OPENSSL 1*/
11
12 #ifdef CCAN_CRYPTO_HMAC_USE_OPENSSL
13 #include <openssl/hmac.h>
14 #endif
15
16 /**
17  * struct hmac_sha256 - structure representing a completed HMAC.
18  */
19 struct hmac_sha256 {
20         struct sha256 sha;
21 };
22
23 /**
24  * hmac_sha256 - return hmac of an object with a key.
25  * @hmac: the hmac to fill in
26  * @k: pointer to the key,
27  * @ksize: the number of bytes pointed to by @k
28  * @d: pointer to memory,
29  * @dsize: the number of bytes pointed to by @d
30  */
31 void hmac_sha256(struct hmac_sha256 *hmac,
32                  const void *k, size_t ksize,
33                  const void *d, size_t dsize);
34 #endif /* CCAN_CRYPTO_HMAC_SHA256_H */