Fix all warnings when compiling with -Wall -W -pedantic.
[tinc] / src / openssl / prf.c
index 4f5a52b..37af2ef 100644 (file)
    We use SHA512 instead of MD5 and SHA1.
  */
 
-static bool prf_xor(int nid, const char *secret, size_t secretlen, char *seed, size_t seedlen, char *out, ssize_t outlen) {
+static bool prf_xor(int nid, const char *secret, size_t secretlen, char *seed, size_t seedlen, char *out, size_t outlen) {
        digest_t *digest = digest_open_by_nid(nid, -1);
 
-       if(!digest)
+       if(!digest) {
                return false;
+       }
 
        if(!digest_set_key(digest, secret, secretlen)) {
                digest_close(digest);
@@ -66,8 +67,9 @@ static bool prf_xor(int nid, const char *secret, size_t secretlen, char *seed, s
                }
 
                /* XOR the results of the outer HMAC into the out buffer */
-               for(int i = 0; i < len && i < outlen; i++)
+               for(size_t i = 0; i < len && i < outlen; i++) {
                        *out++ ^= hash[i];
+               }
 
                outlen -= len;
        }