Round up the size of the secret parts after splitting it in two.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 4 Jul 2011 05:51:47 +0000 (07:51 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 4 Jul 2011 05:51:47 +0000 (07:51 +0200)
src/openssl/prf.c

index 59e8a3aa845caf136b43cae43ac011dce649f4f6..df7f445c4940adda32449a944009cb8febda2a85 100644 (file)
@@ -71,6 +71,6 @@ bool prf(char *secret, size_t secretlen, char *seed, size_t seedlen, char *out,
 
        memset(out, 0, outlen);
 
-       return prf_xor(NID_sha512, secret, secretlen / 2, seed, seedlen, out, outlen)
-               && prf_xor(NID_whirlpool, secret, secretlen / 2, seed, seedlen, out, outlen);
+       return prf_xor(NID_sha512, secret, (secretlen + 1) / 2, seed, seedlen, out, outlen)
+               && prf_xor(NID_whirlpool, secret + secretlen / 2, (secretlen + 1) / 2, seed, seedlen, out, outlen);
 }