mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
r12777@catbus: nickm | 2007-05-16 21:52:23 -0400
Fix dumb bug introduced in r10199 svn:r10202
This commit is contained in:
parent
b4bd9f772c
commit
836328be2e
@ -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);
|
tor_assert(key_out_len <= DIGEST_LEN*256);
|
||||||
|
|
||||||
memcpy(tmp, key_in, key_in_len);
|
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) {
|
++i, cp += DIGEST_LEN, key_out_len -= DIGEST_LEN) {
|
||||||
tmp[key_in_len] = i;
|
tmp[key_in_len] = i;
|
||||||
if (crypto_digest(digest, tmp, key_in_len+1))
|
if (crypto_digest(digest, tmp, key_in_len+1))
|
||||||
goto err;
|
goto err;
|
||||||
memcpy(cp, digest, MIN(DIGEST_LEN, key_out_len));
|
memcpy(cp, digest, MIN(DIGEST_LEN, key_out_len));
|
||||||
|
if (key_out_len < DIGEST_LEN)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
memset(tmp, 0, key_in_len+1);
|
memset(tmp, 0, key_in_len+1);
|
||||||
tor_free(tmp);
|
tor_free(tmp);
|
||||||
|
Loading…
Reference in New Issue
Block a user