X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=hmac-sha1.c;h=9271e50c034b31d3deea4a9011131207d0f4eaaa;hp=45a2afb562729aa273352144c7cee4f2612924fc;hb=83d0614d8b17eac97f891f7de2bb3ef265751dea;hpb=fa7a41a129697b6e7dce363060d2265f5fdb93a6 diff --git a/hmac-sha1.c b/hmac-sha1.c index 45a2afb..9271e50 100644 --- a/hmac-sha1.c +++ b/hmac-sha1.c @@ -32,11 +32,11 @@ #include #include "config.h" #include "sha1.h" +#include "hmac-sha1.h" #define IPAD 0x36 #define OPAD 0x5C -typedef sha1_ctx_t hmac_sha1_ctx_t; #ifndef HMAC_SHORTONLY @@ -58,7 +58,7 @@ void hmac_sha1_init(hmac_sha1_ctx_t *s, void* key, uint16_t keylength_b){ sha1_init(s); sha1_nextBlock(s, buffer); #if defined SECURE_WIPE_BUFFER - memset(buffer, 0, SHA256_BLOCK_BITS/8); + memset(buffer, 0, SHA1_BLOCK_BYTES); #endif } @@ -85,7 +85,7 @@ void hmac_sha1_final(hmac_sha1_ctx_t *s, void* key, uint16_t keylength_b){ memcpy(s, &a, sizeof(sha1_ctx_t)); #if defined SECURE_WIPE_BUFFER memset(buffer, 0, SHA1_BLOCK_BYTES); - memset(a.h, 0, 20); + memset(&a, 0, sizeof(sha1_ctx_t)); #endif } @@ -100,7 +100,7 @@ void hmac_sha1_lastBlock() * keylength in bits! * message length in bits! */ -void hmac_sha1(void* dest, void* key, uint16_t keylength_b, void* msg, uint64_t msglength_b){ /* a one-shot*/ +void hmac_sha1(void* dest, void* key, uint16_t keylength_b, void* msg, uint32_t msglength_b){ /* a one-shot*/ sha1_ctx_t s; uint8_t i; uint8_t buffer[SHA1_BLOCK_BYTES];