X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=scal%2Fscal-basic.c;h=0e4215e21926bc3f1c18676923f9f570a5cbfda6;hb=1f6be6ce98d01772fbb1f4d5205a13bea896a1f1;hp=441a88c99623132fc073f22c315fca6543cfcdd2;hpb=66c915087d1f7b8eb7280be43c16e9588faf2e55;p=avr-crypto-lib.git diff --git a/scal/scal-basic.c b/scal/scal-basic.c index 441a88c..0e4215e 100644 --- a/scal/scal-basic.c +++ b/scal/scal-basic.c @@ -1,7 +1,7 @@ /* scal-basic.c */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2011 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 @@ -24,9 +24,9 @@ #include "streamcipher_descriptor.h" #include "keysize_descriptor.h" -uint8_t scal_cipher_init(const scdesc_t* cipher_descriptor, - const void* key, uint16_t keysize_b, - const void* iv, uint16_t ivsize_b, scgen_ctx_t* ctx){ +uint8_t scal_cipher_init(const scdesc_t *cipher_descriptor, + const void *key, uint16_t keysize_b, + const void *iv, uint16_t ivsize_b, scgen_ctx_t *ctx){ ctx->buffer = NULL; ctx->ctx = NULL; @@ -79,7 +79,7 @@ uint8_t scal_cipher_init(const scdesc_t* cipher_descriptor, } -void scal_cipher_free(scgen_ctx_t* ctx){ +void scal_cipher_free(scgen_ctx_t *ctx){ if(ctx->buffer){ free(ctx->buffer); } @@ -88,7 +88,7 @@ void scal_cipher_free(scgen_ctx_t* ctx){ } } -uint8_t scal_cipher_gen_byte(scgen_ctx_t* ctx){ +uint8_t scal_cipher_gen_byte(scgen_ctx_t *ctx){ uint8_t flags; uint16_t blocksize_b; void_fpt gen_fpt; @@ -125,12 +125,10 @@ uint8_t scal_cipher_gen_byte(scgen_ctx_t* ctx){ } } -void scal_cipher_gen_block(void* block, scgen_ctx_t* ctx){ +void scal_cipher_gen_block(void *block, scgen_ctx_t *ctx){ uint8_t flags; - uint16_t blocksize_b; void_fpt gen_fpt; flags = pgm_read_byte(&(ctx->desc_ptr->flags)); - blocksize_b = pgm_read_word(&(ctx->desc_ptr->gensize_b)); gen_fpt = (void_fpt)pgm_read_word(&(ctx->desc_ptr->gen)); if((flags&SC_GEN_TYPE)==SC_GEN_TYPE_1){ *((uint8_t*)block) = ((sc_gen1_fpt)gen_fpt)(ctx->ctx); @@ -139,7 +137,7 @@ void scal_cipher_gen_block(void* block, scgen_ctx_t* ctx){ } } -void scal_cipher_gen_fillblock(void* block, uint16_t blocksize_B, scgen_ctx_t* ctx){ +void scal_cipher_gen_fillblock(void *block, uint16_t blocksize_B, scgen_ctx_t *ctx){ while(blocksize_B){ *((uint8_t*)block) = scal_cipher_gen_byte(ctx); block = (uint8_t*)block + 1; @@ -147,17 +145,17 @@ void scal_cipher_gen_fillblock(void* block, uint16_t blocksize_B, scgen_ctx_t* c } } -uint16_t scal_cipher_getBlocksize_b(const scdesc_t* desc){ +uint16_t scal_cipher_getBlocksize_b(const scdesc_t *desc){ uint16_t blocksize_b; blocksize_b = pgm_read_word(&(desc->gensize_b)); return blocksize_b; } -PGM_VOID_P scal_cipher_getKeysizeDesc(const scdesc_t* desc){ +PGM_VOID_P scal_cipher_getKeysizeDesc(const scdesc_t *desc){ return (PGM_VOID_P)pgm_read_word(&(desc->valid_keysize_desc)); } -PGM_VOID_P scal_cipher_getIVsizeDesc(const scdesc_t* desc){ +PGM_VOID_P scal_cipher_getIVsizeDesc(const scdesc_t *desc){ return (PGM_VOID_P)pgm_read_word(&(desc->valid_ivsize_desc)); }