Group PJLIB_UTIL_HMAC_SHA1

group PJLIB_UTIL_HMAC_SHA1

This module contains the implementation of HMAC: Keyed-Hashing for Message Authentication, as described in RFC 2104.

Functions

void pj_hmac_sha1(const pj_uint8_t *input, unsigned input_len, const pj_uint8_t *key, unsigned key_len, pj_uint8_t digest[20])

Calculate HMAC-SHA1 digest for the specified input and key with this single function call.

Parameters:
  • input – Pointer to the input stream.

  • input_len – Length of input stream in bytes.

  • key – Pointer to the authentication key.

  • key_len – Length of the authentication key.

  • digest – Buffer to be filled with HMAC SHA1 digest.

void pj_hmac_sha1_init(pj_hmac_sha1_context *hctx, const pj_uint8_t *key, unsigned key_len)

Initiate HMAC-SHA1 context for incremental hashing.

Parameters:
  • hctx – HMAC-SHA1 context.

  • key – Pointer to the authentication key.

  • key_len – Length of the authentication key.

void pj_hmac_sha1_update(pj_hmac_sha1_context *hctx, const pj_uint8_t *input, unsigned input_len)

Append string to the message.

Parameters:
  • hctx – HMAC-SHA1 context.

  • input – Pointer to the input stream.

  • input_len – Length of input stream in bytes.

void pj_hmac_sha1_final(pj_hmac_sha1_context *hctx, pj_uint8_t digest[20])

Finish the message and return the digest.

Parameters:
  • hctx – HMAC-SHA1 context.

  • digest – Buffer to be filled with HMAC SHA1 digest.

struct pj_hmac_sha1_context
#include <hmac_sha1.h>

The HMAC-SHA1 context used in the incremental HMAC calculation.

Public Members

pj_sha1_context context

SHA1 context

pj_uint8_t k_opad[64]

opad xor-ed with key