X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=bcal%2Fbcal-basic.c;h=578848d4afcd09d66351f8528eb69e476b4ae85c;hp=52734deec94a19ae3107264a4214cbde94760307;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=8d1970350aa1d7cdcb59cf79f7f60e385e2816e5 diff --git a/bcal/bcal-basic.c b/bcal/bcal-basic.c index 52734de..578848d 100644 --- a/bcal/bcal-basic.c +++ b/bcal/bcal-basic.c @@ -1,7 +1,7 @@ /* bcal-basic.c */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2009 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 @@ -39,13 +39,15 @@ uint8_t bcal_cipher_init(const bcdesc_t *cipher_descriptor, init_fpt.initvoid = (void_fpt) (pgm_read_word(&(cipher_descriptor->init.initvoid))); if (init_fpt.initvoid == NULL) { - if (!(ctx->ctx = malloc((keysize_b + 7) / 8))) + if (!(ctx->ctx = malloc((keysize_b + 7) / 8))) { return 2; + } memcpy(ctx->ctx, key, (keysize_b + 7) / 8); return 0; } - if (!(ctx->ctx = malloc(pgm_read_word(&(cipher_descriptor->ctxsize_B))))) + if (!(ctx->ctx = malloc(pgm_read_word(&(cipher_descriptor->ctxsize_B))))) { return 3; + } if ((flags & BC_INIT_TYPE) == BC_INIT_TYPE_1) { init_fpt.init1((void*) key, (ctx->ctx)); } else {