]> git.cryptolib.org Git - avr-crypto-lib.git/blobdiff - twister-big.c
new hash function abstraction layer + shavs + dump util + ...
[avr-crypto-lib.git] / twister-big.c
index 5139bdc211021d1c75d791691c60d6302a11e4b1..795190951d3263d4a78718ff887c0fc98bd25d7c 100644 (file)
@@ -1,4 +1,21 @@
 /* twister-big.c */
+/*
+    This file is part of the AVR-Crypto-Lib.
+    Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
+
+    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
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 #include <stdint.h>
 #include <string.h>
@@ -40,7 +57,7 @@ void twister_big_init(twister_big_ctx_t* ctx, uint16_t hashsize_b){
 
 /*********************************************************************/
 
-void twister_big_nextBlock(twister_big_ctx_t* ctx, void* msg){
+void twister_big_nextBlock(twister_big_ctx_t* ctx, const void* msg){
        uint8_t tmp[8][8];
 
        /* 1st maxi round */
@@ -98,7 +115,7 @@ void twister_inject_chksum(twister_big_ctx_t* ctx, uint8_t col){
 
 /*********************************************************************/
 
-void twister_big_lastBlock(twister_big_ctx_t* ctx, void* msg, uint16_t length_b){
+void twister_big_lastBlock(twister_big_ctx_t* ctx, const void* msg, uint16_t length_b){
        uint8_t tmp[64];        
        while(length_b>512){
                twister_big_nextBlock(ctx, msg);
@@ -147,13 +164,13 @@ void twister384_init(twister384_ctx_t* ctx){
 
 /*********************************************************************/
 
-void twister384_nextBlock(twister384_ctx_t* ctx, void* msg){
+void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg){
        twister_big_nextBlock(ctx, msg);
 }
 
 /*********************************************************************/
 
-void twister384_lastBlock(twister384_ctx_t* ctx, void* msg, uint16_t length_b){
+void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b){
        twister_big_lastBlock(ctx, msg, length_b);
 }
 
@@ -165,7 +182,7 @@ void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx){
 
 /*********************************************************************/
 
-void twister384(void* dest, void* msg, uint32_t msg_length_b){
+void twister384(void* dest, const void* msg, uint32_t msg_length_b){
        twister_big_ctx_t ctx;
        twister_big_init(&ctx, 384);
        while(msg_length_b >=512){
@@ -187,13 +204,13 @@ void twister512_init(twister512_ctx_t* ctx){
 
 /*********************************************************************/
 
-void twister512_nextBlock(twister512_ctx_t* ctx, void* msg){
+void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg){
        twister_big_nextBlock(ctx, msg);
 }
 
 /*********************************************************************/
 
-void twister512_lastBlock(twister512_ctx_t* ctx, void* msg, uint16_t length_b){
+void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b){
        twister_big_lastBlock(ctx, msg, length_b);
 }
 
@@ -205,7 +222,7 @@ void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx){
 
 /*********************************************************************/
 
-void twister512(void* dest, void* msg, uint32_t msg_length_b){
+void twister512(void* dest, const void* msg, uint32_t msg_length_b){
        twister_big_ctx_t ctx;
        twister_big_init(&ctx, 512);
        while(msg_length_b >=512){