summaryrefslogtreecommitdiff
path: root/src/or/routers.c
diff options
context:
space:
mode:
authorMatej Pjafjar <badbytes@freehaven.net>2002-08-22 07:30:03 +0000
committerMatej Pjafjar <badbytes@freehaven.net>2002-08-22 07:30:03 +0000
commit01aadefbfc7dbd99ddaff922b897996b768cf2f9 (patch)
tree1b179ece1205951776136d4976915e39c27410ee /src/or/routers.c
parentac942bb365d7f100c3ceabb7c3ed470b51aebde6 (diff)
downloadtor-01aadefbfc7dbd99ddaff922b897996b768cf2f9.tar.gz
tor-01aadefbfc7dbd99ddaff922b897996b768cf2f9.zip
Changed crypto calls to go through common/crypto.[hc] instead of calling OpenSSL directly.
svn:r76
Diffstat (limited to 'src/or/routers.c')
-rw-r--r--src/or/routers.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/or/routers.c b/src/or/routers.c
index 587c7a1261..53d34ac1ea 100644
--- a/src/or/routers.c
+++ b/src/or/routers.c
@@ -62,7 +62,7 @@ void delete_routerlist(routerinfo_t *list)
{
tmp=list->next;
free((void *)list->address);
- RSA_free(list->pkey);
+ crypto_free_pk_env(list->pkey);
free((void *)list);
list = tmp;
}
@@ -275,9 +275,8 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
log(LOG_DEBUG,"getrouters():Reading the key ...");
/* read the public key into router->pkey */
- router->pkey=NULL;
- router->pkey = PEM_read_RSAPublicKey(rf,&router->pkey,NULL,NULL);
- if (!router->pkey) /* something went wrong */
+ router->pkey = crypto_new_pk_env(CRYPTO_PK_RSA);
+ if (crypto_pk_read_public_key(router->pkey, rf)) /* something went wrong */
{
log(LOG_ERR,"Could not read public key for router %s:%u.",
router->address,router->or_port);
@@ -289,12 +288,12 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
}
else /* read the key */
{
- log(LOG_DEBUG,"getrouters():Public key size = %u.", RSA_size(router->pkey));
- if (RSA_size(router->pkey) != 128) /* keys MUST be 1024 bits in size */
+ log(LOG_DEBUG,"getrouters():Public key size = %u.", crypto_pk_keysize(router->pkey));
+ if (crypto_pk_keysize(router->pkey) != 128) /* keys MUST be 1024 bits in size */
{
log(LOG_ERR,"Key for router %s:%u is not 1024 bits. All keys must be exactly 1024 bits long.",router->address,router->or_port);
free((void *)router->address);
- RSA_free(router->pkey);
+ crypto_free_pk_env(router->pkey);
free((void *)router);
fclose(rf);
delete_routerlist(routerlist);
@@ -316,13 +315,13 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
{
log(LOG_DEBUG,"getrouters(): This entry is actually me. Ignoring.");
free((void *)router->address);
- RSA_free(router->pkey);
+ crypto_free_pk_env(router->pkey);
free((void *)router);
}
else /* router_is_me() returned an error */
{
free((void *)router->address);
- RSA_free(router->pkey);
+ crypto_free_pk_env(router->pkey);
free((void *)router);
fclose(rf);
delete_routerlist(routerlist);