29 const uint8_t* data, int32_t dataLength,
30 uint8_t* mac, int32_t* macLength)
34 gcry_md_open(&hd, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
35 gcry_md_setkey(hd, key, keyLength);
37 gcry_md_write (hd, data, dataLength);
39 uint8_t* p = gcry_md_read (hd, GCRY_MD_SHA1);
41 if (macLength != NULL) {
48 const uint8_t* dataChunks[],
49 uint32_t dataChunkLength[],
50 uint8_t* mac, int32_t* macLength )
54 gcry_md_open(&hd, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
55 gcry_md_setkey(hd, key, keyLength);
58 gcry_md_write (hd, *dataChunks, (uint32_t)(*dataChunkLength));
62 uint8_t* p = gcry_md_read (hd, GCRY_MD_SHA1);
64 if (macLength != NULL) {
74 gcry_md_open(&ctx, GCRY_MD_SHA1, GCRY_MD_FLAG_HMAC);
75 gcry_md_setkey(ctx, key, key_length);
79 void hmacSha1Ctx(
void* ctx,
const uint8_t* data, uint32_t data_length,
80 uint8_t* mac, int32_t* mac_length)
82 gcry_md_hd_t pctx = (gcry_md_hd_t)ctx;
86 gcry_md_write (pctx, data, data_length);
88 uint8_t* p = gcry_md_read (pctx, GCRY_MD_SHA1);
90 if (mac_length != NULL) {
95 void hmacSha1Ctx(
void* ctx,
const uint8_t* data[], uint32_t data_length[],
96 uint8_t* mac, int32_t* mac_length )
98 gcry_md_hd_t pctx = (gcry_md_hd_t)ctx;
100 gcry_md_reset (pctx);
102 gcry_md_write (pctx, *data, (uint32_t)(*data_length));
106 uint8_t* p = gcry_md_read (pctx, GCRY_MD_SHA1);
108 if (mac_length != NULL) {
115 gcry_md_hd_t pctx = (gcry_md_hd_t)ctx;
116 gcry_md_close (pctx);
void hmacSha1Ctx(void *ctx, const uint8_t *data, uint32_t data_length, uint8_t *mac, int32_t *mac_length)
Compute SHA1 HMAC.
void * createSha1HmacContext(uint8_t *key, int32_t key_length)
Create and initialize a SHA1 HMAC context.
void freeSha1HmacContext(void *ctx)
Free SHA1 HMAC context.
Functions to compute SHA1 HAMAC.
void hmac_sha1(uint8_t *key, int32_t keyLength, const uint8_t *data, int32_t dataLength, uint8_t *mac, int32_t *macLength)
#define SHA1_DIGEST_LENGTH