diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-28 20:31:32 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-28 20:31:32 +0000 |
commit | ddb15b8f679c0c6b095a734947fe3ae668607887 (patch) | |
tree | c60355dee5276253aff49bf5adf782e4fcba79ed /src/or | |
parent | 5d1510883ea583b12b1d66156c31f03700c79245 (diff) | |
download | tor-ddb15b8f679c0c6b095a734947fe3ae668607887.tar tor-ddb15b8f679c0c6b095a734947fe3ae668607887.tar.gz |
Remove IVs from cipher code, since AES-ctr has none.
svn:r1742
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuit.c | 7 | ||||
-rw-r--r-- | src/or/test.c | 4 |
2 files changed, 2 insertions, 9 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c index 4298922f0..b97ea14eb 100644 --- a/src/or/circuit.c +++ b/src/or/circuit.c @@ -1627,7 +1627,6 @@ int circuit_extend(cell_t *cell, circuit_t *circ) { */ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse) { - unsigned char iv[_ARRAYSIZE(CIPHER_IV_LEN)]; crypto_digest_env_t *tmp_digest; crypto_cipher_env_t *tmp_crypto; @@ -1635,8 +1634,6 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse) tor_assert(!(cpath->f_crypto || cpath->b_crypto || cpath->f_digest || cpath->b_digest)); - memset(iv, 0, CIPHER_IV_LEN); - log_fn(LOG_DEBUG,"hop init digest forward 0x%.8x, backward 0x%.8x.", (unsigned int)*(uint32_t*)key_data, (unsigned int)*(uint32_t*)(key_data+20)); cpath->f_digest = crypto_new_digest_env(); @@ -1647,12 +1644,12 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse) log_fn(LOG_DEBUG,"hop init cipher forward 0x%.8x, backward 0x%.8x.", (unsigned int)*(uint32_t*)(key_data+40), (unsigned int)*(uint32_t*)(key_data+40+16)); if (!(cpath->f_crypto = - crypto_create_init_cipher(key_data+(2*DIGEST_LEN),iv,1))) { + crypto_create_init_cipher(key_data+(2*DIGEST_LEN),1))) { log(LOG_WARN,"forward cipher initialization failed."); return -1; } if (!(cpath->b_crypto = - crypto_create_init_cipher(key_data+(2*DIGEST_LEN)+CIPHER_KEY_LEN,iv,0))) { + crypto_create_init_cipher(key_data+(2*DIGEST_LEN)+CIPHER_KEY_LEN,0))) { log(LOG_WARN,"backward cipher initialization failed."); return -1; } diff --git a/src/or/test.c b/src/or/test.c index 48e4a4f9a..536511949 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -260,7 +260,6 @@ test_crypto() env1 = crypto_new_cipher_env(CRYPTO_CIPHER_IDENTITY); test_neq(env1, 0); test_eq(crypto_cipher_generate_key(env1), 0); - test_eq(crypto_cipher_set_iv(env1, ""), 0); test_eq(crypto_cipher_encrypt_init_cipher(env1), 0); for(i = 0; i < 1024; ++i) { data1[i] = (char) i*73; @@ -283,8 +282,6 @@ test_crypto() test_neq(env2, 0); j = crypto_cipher_generate_key(env1); crypto_cipher_set_key(env2, crypto_cipher_get_key(env1)); - crypto_cipher_set_iv(env1, "12345678901234567890"); - crypto_cipher_set_iv(env2, "12345678901234567890"); crypto_cipher_encrypt_init_cipher(env1); crypto_cipher_decrypt_init_cipher(env2); @@ -318,7 +315,6 @@ test_crypto() env2 = crypto_new_cipher_env(); test_neq(env2, 0); crypto_cipher_set_key(env2, crypto_cipher_get_key(env1)); - crypto_cipher_set_iv(env2, "12345678901234567890"); crypto_cipher_encrypt_init_cipher(env2); for (j = 0; j < 1024-16; j += 17) { crypto_cipher_encrypt(env2, data1+j, 17, data3+j); |