]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - hmac-sha1/hmac-sha1.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / hmac-sha1 / hmac-sha1.c
index 56d90acc62a352b3b329dffb1280f58ecaf13abd..bf6eba3612575b712ae4d7f1c995817ffe0937a2 100644 (file)
@@ -1,7 +1,7 @@
 /* hmac-sha1.c */
 /*
     This file is part of the AVR-Crypto-Lib.
-    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+    Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
  * 
  * implementation of HMAC as described in RFC2104
  * Author:      Daniel Otte
- * email:       daniel.otte@rub.de
+ * email:       bg@nerilex.org
  * License:     GPLv3 or later
  **/
 
@@ -40,7 +40,7 @@
 
 #ifndef HMAC_SHORTONLY
 
-void hmac_sha1_init(hmac_sha1_ctx_t *s, const voidkey, uint16_t keylength_b){
+void hmac_sha1_init(hmac_sha1_ctx_t *s, const void *key, uint16_t keylength_b){
        uint8_t buffer[SHA1_BLOCK_BYTES];
        uint8_t i;
        
@@ -69,22 +69,22 @@ void hmac_sha1_init(hmac_sha1_ctx_t *s, const void* key, uint16_t keylength_b){
 #endif
 }
 
-void hmac_sha1_nextBlock(hmac_sha1_ctx_t *s, const voidblock){
+void hmac_sha1_nextBlock(hmac_sha1_ctx_t *s, const void *block){
        sha1_nextBlock(&(s->a), block);
 }
-void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const voidblock, uint16_t length_b){
+void hmac_sha1_lastBlock(hmac_sha1_ctx_t *s, const void *block, uint16_t length_b){
        while(length_b>=SHA1_BLOCK_BITS){
-               sha1_nextBlock(&(s->a), block);
+               sha1_nextBlock(&s->a, block);
                block = (uint8_t*)block + SHA1_BLOCK_BYTES;
                length_b -= SHA1_BLOCK_BITS;
        }
-       sha1_lastBlock(&(s->a), block, length_b);
+       sha1_lastBlock(&s->a, block, length_b);
 }
 
-void hmac_sha1_final(voiddest, hmac_sha1_ctx_t *s){
-       sha1_ctx2hash((sha1_hash_t*)dest, &(s->a));
-       sha1_lastBlock(&(s->b), dest, SHA1_HASH_BITS);
-       sha1_ctx2hash((sha1_hash_t*)dest, &(s->b));
+void hmac_sha1_final(void *dest, hmac_sha1_ctx_t *s){
+       sha1_ctx2hash(dest, &s->a);
+       sha1_lastBlock(&s->b, dest, SHA1_HASH_BITS);
+       sha1_ctx2hash(dest, &(s->b));
 }
 
 #endif
@@ -93,7 +93,7 @@ void hmac_sha1_final(void* dest, hmac_sha1_ctx_t *s){
  * keylength in bits!
  * message length in bits!
  */
-void hmac_sha1(void* dest, const void* key, uint16_t keylength_b, const void* msg, uint32_t msglength_b){ /* a one-shot*/
+void hmac_sha1(void *dest, const void *key, uint16_t keylength_b, const void *msg, uint32_t msglength_b){ /* a one-shot*/
        sha1_ctx_t s;
        uint8_t i;
        uint8_t buffer[SHA1_BLOCK_BYTES];