X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=gcm%2Fgcm128.c;h=73c1b91b2695e8abb123019b02dc6147723d307b;hb=d9352fc79fbdee0cf3288809b104ea196ea85693;hp=1f71046228b90c6746767b3b6ab42853dfbaeb0b;hpb=e542ff92d053ecf40b42364a44bc887431cecae2;p=avr-crypto-lib.git diff --git a/gcm/gcm128.c b/gcm/gcm128.c index 1f71046..73c1b91 100644 --- a/gcm/gcm128.c +++ b/gcm/gcm128.c @@ -1,7 +1,7 @@ /* gcm128.c */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2006-2015 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 @@ -254,7 +254,7 @@ void gcm128_decrypt_block( { uint8_t tmp[BLOCK_BYTES]; ghash128_block(&ctx->ghash_ctx, src); - inc32(&ctx->ctr[11]); + inc32(&ctx->ctr[BLOCK_BYTES - COUNT_BYTES]); memcpy(tmp, ctx->ctr, BLOCK_BYTES); bcal_cipher_enc(tmp, &ctx->cipher_ctx); memxor(tmp, src, BLOCK_BYTES); @@ -286,7 +286,7 @@ void gcm128_decrypt_final_block( tmp[length_b / 8] &= 0xff << (8 - (length_b & 7)); } ghash128_block(&ctx->ghash_ctx, tmp); - inc32(&ctx->ctr[11]); + inc32(&ctx->ctr[BLOCK_BYTES - COUNT_BYTES]); memcpy(tmp, ctx->ctr, BLOCK_BYTES); bcal_cipher_enc(tmp, &ctx->cipher_ctx); memxor(tmp, src, BLOCK_BYTES);