aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-09-10 00:47:24 +0000
committerNick Mathewson <nickm@torproject.org>2003-09-10 00:47:24 +0000
commit9955b265ab77c712861f33411e521c9761184226 (patch)
tree3cd11789926945c80a6f34ae0101437fe60cb12b /src/or
parent67697d5ab197c09f90adafef7d82895cfdbbb085 (diff)
downloadtor-9955b265ab77c712861f33411e521c9761184226.tar.gz
tor-9955b265ab77c712861f33411e521c9761184226.zip
Make crypto structures private to crypto.c
svn:r437
Diffstat (limited to 'src/or')
-rw-r--r--src/or/connection_or.c12
-rw-r--r--src/or/test.c4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index f70a78a3c8..6250eba9a6 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -249,9 +249,9 @@ or_handshake_op_send_keys(connection_t *conn) {
/* compose the message */
*(uint16_t *)(message) = htons(HANDSHAKE_AS_OP);
memcpy((void *)(message+FLAGS_LEN),
- (void *)conn->f_crypto->key, 16);
+ (void *)crypto_cipher_get_key(conn->f_crypto), 16);
memcpy((void *)(message+FLAGS_LEN+KEY_LEN),
- (void *)conn->b_crypto->key, 16);
+ (void *)crypto_cipher_get_key(conn->b_crypto), 16);
/* encrypt with RSA */
if(crypto_pk_public_encrypt(conn->pkey, message, sizeof(message), cipher, RSA_PKCS1_PADDING) < 0) {
@@ -322,9 +322,9 @@ or_handshake_client_send_auth(connection_t *conn) {
*(uint32_t*)(buf+FLAGS_LEN+ADDR_LEN+PORT_LEN) = htonl(conn->addr); /* remote address */
*(uint16_t*)(buf+FLAGS_LEN+ADDR_LEN+PORT_LEN+ADDR_LEN) = htons(conn->port); /* remote port */
memcpy(buf+FLAGS_LEN+ADDR_LEN+PORT_LEN+ADDR_LEN+PORT_LEN,
- conn->f_crypto->key,16); /* keys */
+ crypto_cipher_get_key(conn->f_crypto),16); /* keys */
memcpy(buf+FLAGS_LEN+ADDR_LEN+PORT_LEN+ADDR_LEN+PORT_LEN+KEY_LEN,
- conn->b_crypto->key,16);
+ crypto_cipher_get_key(conn->b_crypto),16);
log(LOG_DEBUG,"or_handshake_client_send_auth() : Generated first authentication message.");
/* encrypt message */
@@ -406,8 +406,8 @@ or_handshake_client_process_auth(connection_t *conn) {
log(LOG_ERR,"client_process_auth: Router %s:%u: bad address info.", conn->address,conn->port);
return -1;
}
- if ( (memcmp(conn->f_crypto->key, buf+12, 16)) || /* keys */
- (memcmp(conn->b_crypto->key, buf+28, 16)) ) {
+ if ( (memcmp(crypto_cipher_get_key(conn->f_crypto), buf+12, 16)) ||/* keys */
+ (memcmp(crypto_cipher_get_key(conn->b_crypto), buf+28, 16)) ) {
log(LOG_ERR,"client_process_auth: Router %s:%u: bad key info.",conn->address,conn->port);
return -1;
}
diff --git a/src/or/test.c b/src/or/test.c
index da982cd0be..e8a9c18d1e 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -269,7 +269,7 @@ test_crypto()
test_neq(env2, 0);
j = crypto_cipher_generate_key(env1);
if (str_ciphers[i] != CRYPTO_CIPHER_IDENTITY) {
- crypto_cipher_set_key(env2, env1->key);
+ crypto_cipher_set_key(env2, crypto_cipher_get_key(env1));
}
crypto_cipher_set_iv(env1, "12345678901234567890");
crypto_cipher_set_iv(env2, "12345678901234567890");
@@ -309,7 +309,7 @@ test_crypto()
env2 = crypto_new_cipher_env(str_ciphers[i]);
test_neq(env2, 0);
if (str_ciphers[i] != CRYPTO_CIPHER_IDENTITY) {
- crypto_cipher_set_key(env2, env1->key);
+ crypto_cipher_set_key(env2, crypto_cipher_get_key(env1));
}
crypto_cipher_set_iv(env2, "12345678901234567890");
crypto_cipher_encrypt_init_cipher(env2);