From: Guus Sliepen <guus@tinc-vpn.org>
Date: Mon, 17 Apr 2017 11:07:15 +0000 (+0200)
Subject: Fix compiler warnings on *BSD.
X-Git-Tag: release-1.1pre15~24
X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=1be0c284c7c8d34c2dd6c2160ce49aeae468e867;p=tinc

Fix compiler warnings on *BSD.
---

diff --git a/src/net.c b/src/net.c
index 4369ff49..8cb7ed73 100644
--- a/src/net.c
+++ b/src/net.c
@@ -209,7 +209,7 @@ static void timeout_handler(void *data) {
 
 		// timeout during ping
 		if(c->status.pinged) {
-			logger(DEBUG_CONNECTIONS, LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds", c->name, c->hostname, (long)now.tv_sec - c->last_ping_time);
+			logger(DEBUG_CONNECTIONS, LOG_INFO, "%s (%s) didn't respond to PING in %ld seconds", c->name, c->hostname, (long)(now.tv_sec - c->last_ping_time));
 			terminate_connection(c, c->edge);
 			continue;
 		}
diff --git a/src/openssl/cipher.c b/src/openssl/cipher.c
index e362325a..a8032ea0 100644
--- a/src/openssl/cipher.c
+++ b/src/openssl/cipher.c
@@ -137,7 +137,7 @@ bool cipher_encrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou
 		int len, pad;
 		if(EVP_EncryptInit_ex(cipher->ctx, NULL, NULL, NULL, NULL)
 				&& EVP_EncryptUpdate(cipher->ctx, (unsigned char *)outdata, &len, indata, inlen)
-				&& EVP_EncryptFinal(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
+				&& EVP_EncryptFinal_ex(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
 			if(outlen) *outlen = len + pad;
 			return true;
 		}
@@ -158,7 +158,7 @@ bool cipher_decrypt(cipher_t *cipher, const void *indata, size_t inlen, void *ou
 		int len, pad;
 		if(EVP_DecryptInit_ex(cipher->ctx, NULL, NULL, NULL, NULL)
 				&& EVP_DecryptUpdate(cipher->ctx, (unsigned char *)outdata, &len, indata, inlen)
-				&& EVP_DecryptFinal(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
+				&& EVP_DecryptFinal_ex(cipher->ctx, (unsigned char *)outdata + len, &pad)) {
 			if(outlen) *outlen = len + pad;
 			return true;
 		}
diff --git a/test/pong.c b/test/pong.c
index 6e212bf2..a4f2be73 100644
--- a/test/pong.c
+++ b/test/pong.c
@@ -154,7 +154,7 @@ int main(int argc, char *argv[]) {
 #endif
 
 		default:
-			fprintf(stderr, "Multicast for address family %hx unsupported\n", ai->ai_family);
+			fprintf(stderr, "Multicast for address family %x unsupported\n", ai->ai_family);
 			return 1;
 	}