From b50d6a7f2ad98239018bc5ce7a5739e3bf4f50f7 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 26 Dec 2011 23:04:40 +0100 Subject: [PATCH] Fix compiler warnings. --- src/openssl/ecdsa.c | 8 ++++---- src/openssl/ecdsagen.c | 2 +- src/protocol_auth.c | 1 - src/tincctl.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/openssl/ecdsa.c b/src/openssl/ecdsa.c index 85c6a47b..f3640a50 100644 --- a/src/openssl/ecdsa.c +++ b/src/openssl/ecdsa.c @@ -34,7 +34,7 @@ bool ecdsa_set_base64_public_key(ecdsa_t *ecdsa, const char *p) { int len = strlen(p); unsigned char pubkey[len / 4 * 3 + 3]; const unsigned char *ppubkey = pubkey; - len = b64decode(p, pubkey, len); + len = b64decode(p, (char *)pubkey, len); if(!o2i_ECPublicKey(ecdsa, &ppubkey, len)) { logger(LOG_DEBUG, "o2i_ECPublicKey failed: %s", ERR_error_string(ERR_get_error(), NULL)); @@ -49,7 +49,7 @@ char *ecdsa_get_base64_public_key(ecdsa_t *ecdsa) { int len = i2o_ECPublicKey(*ecdsa, &pubkey); char *base64 = malloc(len * 4 / 3 + 5); - b64encode(pubkey, base64, len); + b64encode((char *)pubkey, base64, len); free(pubkey); @@ -87,7 +87,7 @@ size_t ecdsa_size(ecdsa_t *ecdsa) { bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t len, void *sig) { unsigned int siglen = ECDSA_size(*ecdsa); - char hash[SHA512_DIGEST_LENGTH]; + unsigned char hash[SHA512_DIGEST_LENGTH]; SHA512(in, len, hash); memset(sig, 0, siglen); @@ -107,7 +107,7 @@ bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t len, void *sig) { bool ecdsa_verify(ecdsa_t *ecdsa, const void *in, size_t len, const void *sig) { unsigned int siglen = ECDSA_size(*ecdsa); - char hash[SHA512_DIGEST_LENGTH]; + unsigned char hash[SHA512_DIGEST_LENGTH]; SHA512(in, len, hash); if(!ECDSA_verify(0, hash, sizeof hash, sig, siglen, *ecdsa)) { diff --git a/src/openssl/ecdsagen.c b/src/openssl/ecdsagen.c index 86b79a25..883c77e7 100644 --- a/src/openssl/ecdsagen.c +++ b/src/openssl/ecdsagen.c @@ -67,7 +67,7 @@ char *ecdsa_get_base64_public_key(ecdsa_t *ecdsa) { int len = i2o_ECPublicKey(*ecdsa, &pubkey); char *base64 = malloc(len * 4 / 3 + 5); - b64encode(pubkey, base64, len); + b64encode((char *)pubkey, base64, len); free(pubkey); diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 4eb61bdf..4e2bd871 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -226,7 +226,6 @@ bool send_metakey(connection_t *c) { static bool metakey_ec_h(connection_t *c, const char *request) { size_t siglen = ecdsa_size(&c->ecdsa); char key[MAX_STRING_SIZE]; - char sig[siglen]; logger(LOG_DEBUG, "Got ECDH metakey from %s", c->name); diff --git a/src/tincctl.c b/src/tincctl.c index f0515c92..4f06daa6 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -577,7 +577,7 @@ int main(int argc, char *argv[]) { #endif if (slash++) { c = xmalloc((slash - argv[0]) + sizeof("tincd")); - sprintf(c, "%.*stincd", slash - argv[0], argv[0]); + sprintf(c, "%.*stincd", (int)(slash - argv[0]), argv[0]); } else c = "tincd"; -- 2.20.1