Skip to content
Snippets Groups Projects
Commit 836328be authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

r12777@catbus: nickm | 2007-05-16 21:52:23 -0400

 Fix dumb bug introduced in r10199


svn:r10202
parent b4bd9f77
Branches
Tags
No related merge requests found
......@@ -1494,12 +1494,14 @@ crypto_expand_key_material(const char *key_in, size_t key_in_len,
tor_assert(key_out_len <= DIGEST_LEN*256);
memcpy(tmp, key_in, key_in_len);
for (cp = key_out, i=0; key_out_len >= DIGEST_LEN;
for (cp = key_out, i=0; key_out_len;
++i, cp += DIGEST_LEN, key_out_len -= DIGEST_LEN) {
tmp[key_in_len] = i;
if (crypto_digest(digest, tmp, key_in_len+1))
goto err;
memcpy(cp, digest, MIN(DIGEST_LEN, key_out_len));
if (key_out_len < DIGEST_LEN)
break;
}
memset(tmp, 0, key_in_len+1);
tor_free(tmp);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment