From: Guus Sliepen Date: Mon, 4 Jul 2011 05:51:47 +0000 (+0200) Subject: Round up the size of the secret parts after splitting it in two. X-Git-Tag: import-tinc-1.1~448 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=b99656d84a88dad7935d5981fcdb43a5b2bfa417;p=meshlink Round up the size of the secret parts after splitting it in two. --- diff --git a/src/openssl/prf.c b/src/openssl/prf.c index 59e8a3aa..df7f445c 100644 --- a/src/openssl/prf.c +++ b/src/openssl/prf.c @@ -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); }