From 253f0f160e1185cbab507920b6391064757be677 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 24 Sep 2002 10:43:57 +0000 Subject: laying the groundwork for dynamic router lists revamped the router reading section reference counting for crypto pk env's (so we can dup them) we now read and write pem pk keys from string rather than from FILE*, in anticipation of fetching directories over a socket (so now on startup we slurp in the whole file, then parse it as a string) fixed a bug in the proxy side, where you could get some circuits wedged if they showed up while the connection was being made svn:r110 --- src/common/crypto.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/common/crypto.h') diff --git a/src/common/crypto.h b/src/common/crypto.h index b58b300a4c..71a7a3cf4e 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -18,6 +18,7 @@ typedef struct { int type; + int refs; /* reference counting; so we don't have to copy keys */ unsigned char *key; /* auxiliary data structure(s) used by the underlying crypto library */ unsigned char *aux; @@ -46,15 +47,18 @@ void crypto_free_cipher_env(crypto_cipher_env_t *env); /* public key crypto */ int crypto_pk_generate_key(crypto_pk_env_t *env); -int crypto_pk_read_private_key(crypto_pk_env_t *env, FILE *src); -int crypto_pk_read_public_key(crypto_pk_env_t *env, FILE *src); -int crypto_pk_write_private_key(crypto_pk_env_t *env, FILE *dest); -int crypto_pk_write_public_key(crypto_pk_env_t *env, FILE *dest); +int crypto_pk_read_private_key_from_file(crypto_pk_env_t *env, FILE *src); +int crypto_pk_read_public_key_from_file(crypto_pk_env_t *env, FILE *src); +int crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest, int *len); +int crypto_pk_read_public_key_from_string(crypto_pk_env_t *env, char *src, int len); +int crypto_pk_write_private_key_to_file(crypto_pk_env_t *env, FILE *dest); +int crypto_pk_write_public_key_to_file(crypto_pk_env_t *env, FILE *dest); int crypto_pk_check_key(crypto_pk_env_t *env); -int crypto_pk_read_private_key_filename(crypto_pk_env_t *env, unsigned char *keyfile); +int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, unsigned char *keyfile); int crypto_pk_set_key(crypto_pk_env_t *env, unsigned char *key); int crypto_pk_cmp_keys(crypto_pk_env_t *a, crypto_pk_env_t *b); +crypto_pk_env_t *crypto_pk_dup_key(crypto_pk_env_t *orig); int crypto_pk_keysize(crypto_pk_env_t *env); int crypto_pk_public_encrypt(crypto_pk_env_t *env, unsigned char *from, int fromlen, unsigned char *to, int padding); -- cgit v1.2.3-54-g00ecf