123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- #ifndef __TC_HMAC_H__
- #define __TC_HMAC_H__
- #include <tinycrypt/sha256.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct tc_hmac_state_struct {
-
- struct tc_sha256_state_struct hash_state;
-
- uint8_t key[2*TC_SHA256_BLOCK_SIZE];
- };
- typedef struct tc_hmac_state_struct *TCHmacState_t;
- int tc_hmac_set_key(TCHmacState_t ctx, const uint8_t *key,
- unsigned int key_size);
- int tc_hmac_init(TCHmacState_t ctx);
- int tc_hmac_update(TCHmacState_t ctx, const void *data,
- unsigned int data_length);
- int tc_hmac_final(uint8_t *tag, unsigned int taglen, TCHmacState_t ctx);
- #ifdef __cplusplus
- }
- #endif
- #endif
|