X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fgcrypt%2Fcipher.c;h=b9b32244b0d19d31beef339a1fe1b4610ad07927;hb=3a316823b971396a428f020f401b9fe41252d98d;hp=cf46dec8220ab320b9553bc20a96c40441297ffe;hpb=248d300f1be0d5f2aae39202041699ab2b46c56b;p=tinc diff --git a/src/gcrypt/cipher.c b/src/gcrypt/cipher.c index cf46dec8..b9b32244 100644 --- a/src/gcrypt/cipher.c +++ b/src/gcrypt/cipher.c @@ -1,6 +1,6 @@ /* cipher.c -- Symmetric block cipher handling - Copyright (C) 2007 Guus Sliepen + Copyright (C) 2007-2012 Guus Sliepen 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 @@ -55,7 +55,7 @@ static struct { static bool nametocipher(const char *name, int *algo, int *mode) { size_t i; - for(i = 0; i < sizeof ciphertable / sizeof *ciphertable; i++) { + for(i = 0; i < sizeof(ciphertable) / sizeof *ciphertable; i++) { if(ciphertable[i].name && !strcasecmp(name, ciphertable[i].name)) { *algo = ciphertable[i].algo; *mode = ciphertable[i].mode; @@ -69,7 +69,7 @@ static bool nametocipher(const char *name, int *algo, int *mode) { static bool nidtocipher(int nid, int *algo, int *mode) { size_t i; - for(i = 0; i < sizeof ciphertable / sizeof *ciphertable; i++) { + for(i = 0; i < sizeof(ciphertable) / sizeof *ciphertable; i++) { if(nid == ciphertable[i].nid) { *algo = ciphertable[i].algo; *mode = ciphertable[i].mode; @@ -83,7 +83,7 @@ static bool nidtocipher(int nid, int *algo, int *mode) { static bool ciphertonid(int algo, int mode, int *nid) { size_t i; - for(i = 0; i < sizeof ciphertable / sizeof *ciphertable; i++) { + for(i = 0; i < sizeof(ciphertable) / sizeof *ciphertable; i++) { if(algo == ciphertable[i].algo && mode == ciphertable[i].mode) { *nid = ciphertable[i].nid; return true; @@ -212,7 +212,7 @@ bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou else pad[i] = padbyte; } - + if(oneshot) gcry_cipher_setiv(cipher->handle, cipher->key + cipher->keylen, cipher->blklen);