summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2017-02-07 10:20:58 +0100
committerJustus Winter <justus@g10code.com>2017-02-07 10:20:58 +0100
commit75d91ffeaf83098ade325bb3b6b2c8a76eb1f6a6 (patch)
treeff436e7344f653db9139d3f189cd3b34110e039c
parentd1ee9a660571ce4a998c9ab2299d4f2419f99127 (diff)
downloadlibgcrypt-75d91ffeaf83098ade325bb3b6b2c8a76eb1f6a6.tar.gz
Fix building with a pre C99 compiler.
* cipher/cipher-cfb.c (_gcry_cipher_cfb8_encrypt): Move the declaration of 'i' out of the loop. (_gcry_cipher_cfb8_decrypt): Likewise. -- Fixes build on OpenBSD. Fixes-commit: d1ee9a660571ce4a998c9ab2299d4f2419f99127 Signed-off-by: Justus Winter <justus@g10code.com>
-rw-r--r--cipher/cipher-cfb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cipher/cipher-cfb.c b/cipher/cipher-cfb.c
index cca5c1fb..c888e70a 100644
--- a/cipher/cipher-cfb.c
+++ b/cipher/cipher-cfb.c
@@ -251,6 +251,8 @@ _gcry_cipher_cfb8_encrypt (gcry_cipher_hd_t c,
while ( inbuflen > 0)
{
+ int i;
+
/* Encrypt the IV. */
nburn = enc_fn ( &c->context.c, c->lastiv, c->u_iv.iv );
burn = nburn > burn ? nburn : burn;
@@ -258,7 +260,7 @@ _gcry_cipher_cfb8_encrypt (gcry_cipher_hd_t c,
outbuf[0] = c->lastiv[0] ^ inbuf[0];
/* Bitshift iv by 8 bit to the left */
- for (int i = 0; i < blocksize-1; i++)
+ for (i = 0; i < blocksize-1; i++)
c->u_iv.iv[i] = c->u_iv.iv[i+1];
/* append cipher text to iv */
@@ -293,6 +295,8 @@ _gcry_cipher_cfb8_decrypt (gcry_cipher_hd_t c,
while (inbuflen > 0)
{
+ int i;
+
/* Encrypt the IV. */
nburn = enc_fn ( &c->context.c, c->lastiv, c->u_iv.iv );
burn = nburn > burn ? nburn : burn;
@@ -304,7 +308,7 @@ _gcry_cipher_cfb8_decrypt (gcry_cipher_hd_t c,
outbuf[0] = inbuf[0] ^ c->lastiv[0];
/* Bitshift iv by 8 bit to the left */
- for (int i = 0; i < blocksize-1; i++)
+ for (i = 0; i < blocksize-1; i++)
c->u_iv.iv[i] = c->u_iv.iv[i+1];
c->u_iv.iv[blocksize-1] = appendee;