|
@@ -1426,12 +1426,13 @@ circuit_init_cpath_crypto(crypt_path_t *cpath,
|
|
|
|
|
|
tor_assert(digest_len != 0);
|
|
tor_assert(digest_len != 0);
|
|
tor_assert(cipher_key_len != 0);
|
|
tor_assert(cipher_key_len != 0);
|
|
|
|
+ const int cipher_key_bits = (int) cipher_key_len * 8;
|
|
|
|
|
|
crypto_digest_add_bytes(cpath->f_digest, key_data, digest_len);
|
|
crypto_digest_add_bytes(cpath->f_digest, key_data, digest_len);
|
|
crypto_digest_add_bytes(cpath->b_digest, key_data+digest_len, digest_len);
|
|
crypto_digest_add_bytes(cpath->b_digest, key_data+digest_len, digest_len);
|
|
|
|
|
|
cpath->f_crypto = crypto_cipher_new_with_bits(key_data+(2*digest_len),
|
|
cpath->f_crypto = crypto_cipher_new_with_bits(key_data+(2*digest_len),
|
|
- cipher_key_len*8);
|
|
|
|
|
|
+ cipher_key_bits);
|
|
if (!cpath->f_crypto) {
|
|
if (!cpath->f_crypto) {
|
|
log_warn(LD_BUG,"Forward cipher initialization failed.");
|
|
log_warn(LD_BUG,"Forward cipher initialization failed.");
|
|
return -1;
|
|
return -1;
|
|
@@ -1439,7 +1440,7 @@ circuit_init_cpath_crypto(crypt_path_t *cpath,
|
|
|
|
|
|
cpath->b_crypto = crypto_cipher_new_with_bits(
|
|
cpath->b_crypto = crypto_cipher_new_with_bits(
|
|
key_data+(2*digest_len)+cipher_key_len,
|
|
key_data+(2*digest_len)+cipher_key_len,
|
|
- cipher_key_len*8);
|
|
|
|
|
|
+ cipher_key_bits);
|
|
if (!cpath->b_crypto) {
|
|
if (!cpath->b_crypto) {
|
|
log_warn(LD_BUG,"Backward cipher initialization failed.");
|
|
log_warn(LD_BUG,"Backward cipher initialization failed.");
|
|
return -1;
|
|
return -1;
|