/*********************************************************************/
static
-void checksum_update(twister_large_ctx_t* ctx, uint8_t col){
+void checksum_update(twister_large_ctx_t *ctx, uint8_t col){
uint8_t i, col2;
uint8_t carry = 0;
int sum = 0;
/*********************************************************************/
-void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b){
+void twister_large_init(twister_large_ctx_t *ctx, uint16_t hashsize_b){
memset(ctx->state.s, 0, 64);
memset(ctx->checksum, 0, 64);
ctx->state.counter=0xffffffffffffffffLL;
/*********************************************************************/
-void twister_large_nextBlock(twister_large_ctx_t* ctx, const void* msg){
+void twister_large_nextBlock(twister_large_ctx_t *ctx, const void *msg){
uint8_t tmp[8][8];
/* 1st maxi round */
/*********************************************************************/
-void twister_inject_chksum(twister_large_ctx_t* ctx, uint8_t col){
- *((uint64_t*)(&ctx->state.s[7][0])) ^= *((uint64_t*)(&ctx->checksum[col][0]));
+void twister_inject_chksum(twister_large_ctx_t *ctx, uint8_t col){
+ uint8_t i=7;
+ do{
+ ctx->state.s[7][i] ^= ctx->checksum[col][i];
+
+ }while(i--);
twister_blank_round(&ctx->state);
}
/*********************************************************************/
-void twister_large_lastBlock(twister_large_ctx_t* ctx, const void* msg, uint16_t length_b){
+void twister_large_lastBlock(twister_large_ctx_t *ctx, const void *msg, uint16_t length_b){
uint8_t tmp[64];
while(length_b>=512){
twister_large_nextBlock(ctx, msg);
/*********************************************************************/
-void twister_large_ctx2hash(void* dest, twister_large_ctx_t* ctx, uint16_t hashsize_b){
+void twister_large_ctx2hash(void *dest, twister_large_ctx_t *ctx, uint16_t hashsize_b){
twister_ctx2hash(dest, &(ctx->state), hashsize_b);
}
/*********************************************************************/
/*********************************************************************/
-void twister384_init(twister384_ctx_t* ctx){
+void twister384_init(twister384_ctx_t *ctx){
twister_large_init(ctx, 384);
}
/*********************************************************************/
-void twister384_nextBlock(twister384_ctx_t* ctx, const void* msg){
+void twister384_nextBlock(twister384_ctx_t *ctx, const void *msg){
twister_large_nextBlock(ctx, msg);
}
/*********************************************************************/
-void twister384_lastBlock(twister384_ctx_t* ctx, const void* msg, uint16_t length_b){
+void twister384_lastBlock(twister384_ctx_t *ctx, const void *msg, uint16_t length_b){
twister_large_lastBlock(ctx, msg, length_b);
}
/*********************************************************************/
-void twister384_ctx2hash(void* dest, twister384_ctx_t* ctx){
+void twister384_ctx2hash(void *dest, twister384_ctx_t *ctx){
twister_large_ctx2hash(dest, ctx, 384);
}
/*********************************************************************/
-void twister384(void* dest, const void* msg, uint32_t msg_length_b){
+void twister384(void *dest, const void *msg, uint32_t msg_length_b){
twister_large_ctx_t ctx;
twister_large_init(&ctx, 384);
while(msg_length_b >=512){
/*********************************************************************/
-void twister512_init(twister512_ctx_t* ctx){
+void twister512_init(twister512_ctx_t *ctx){
twister_large_init(ctx, 512);
}
/*********************************************************************/
-void twister512_nextBlock(twister512_ctx_t* ctx, const void* msg){
+void twister512_nextBlock(twister512_ctx_t *ctx, const void *msg){
twister_large_nextBlock(ctx, msg);
}
/*********************************************************************/
-void twister512_lastBlock(twister512_ctx_t* ctx, const void* msg, uint16_t length_b){
+void twister512_lastBlock(twister512_ctx_t *ctx, const void *msg, uint16_t length_b){
twister_large_lastBlock(ctx, msg, length_b);
}
/*********************************************************************/
-void twister512_ctx2hash(void* dest, twister512_ctx_t* ctx){
+void twister512_ctx2hash(void *dest, twister512_ctx_t *ctx){
twister_large_ctx2hash(dest, ctx, 512);
}
/*********************************************************************/
-void twister512(void* dest, const void* msg, uint32_t msg_length_b){
+void twister512(void *dest, const void *msg, uint32_t msg_length_b){
twister_large_ctx_t ctx;
twister_large_init(&ctx, 512);
while(msg_length_b >=512){