X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fopenssl%2Fcipher.c;h=553b4adb4e2a6fc823ab51753283806a6336e01d;hb=70a1a5594af5d4e6a364186b42ba4e34c676009b;hp=1ca15abb1817693f9a37b73946f116bd9e90f94d;hpb=86c2990327fdf7ec1197aa73cb2b9a926a734db4;p=tinc diff --git a/src/openssl/cipher.c b/src/openssl/cipher.c index 1ca15abb..553b4adb 100644 --- a/src/openssl/cipher.c +++ b/src/openssl/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 @@ -65,10 +65,8 @@ bool cipher_open_blowfish_ofb(cipher_t *cipher) { void cipher_close(cipher_t *cipher) { EVP_CIPHER_CTX_cleanup(&cipher->ctx); - if(cipher->counter) { - free(cipher->counter); - cipher->counter = 0; - } + free(cipher->counter); + cipher->counter = NULL; } size_t cipher_keylength(const cipher_t *cipher) { @@ -145,7 +143,7 @@ bool cipher_counter_xor(cipher_t *cipher, const void *indata, size_t inlen, void unsigned char *out = outdata; while(inlen--) { - // Encrypt the new counter value if we need it + // Encrypt the new counter value if we need it if(!cipher->counter->n) { int len; if(!EVP_EncryptUpdate(&cipher->ctx, cipher->counter->block, &len, cipher->counter->counter, cipher->cipher->block_size)) {