]> git.meshlink.io Git - meshlink/blobdiff - src/openssl/cipher.c
Remove everything GPL that is not copyright Guus Sliepen, update copyright statements.
[meshlink] / src / openssl / cipher.c
index b01f5267c04c17456f16f55646b95d18a2758906..8faed39d0577aafa1ee233549d430cd056bedd4a 100644 (file)
@@ -1,6 +1,6 @@
 /*
     cipher.c -- Symmetric block cipher handling
-    Copyright (C) 2007-2013 Guus Sliepen <guus@tinc-vpn.org>
+    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
 
     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
@@ -160,7 +160,7 @@ bool cipher_gcm_encrypt_start(cipher_t *cipher, const void *indata, size_t inlen
 
 bool cipher_gcm_encrypt_finish(cipher_t *cipher, const void *indata, size_t inlen, void *outdata, size_t *outlen) {
        int len = 0, pad = 0;
-       if(!(inlen && EVP_EncryptUpdate(&cipher->ctx, (unsigned char *)outdata, &len, (unsigned char *)indata, inlen))
+       if((inlen && !EVP_EncryptUpdate(&cipher->ctx, (unsigned char *)outdata, &len, (unsigned char *)indata, inlen))
                        || !EVP_EncryptFinal(&cipher->ctx, (unsigned char *)outdata + len, &pad)) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Error while encrypting: %s", ERR_error_string(ERR_get_error(), NULL));
                return false;