diff options
author | Roger Dingledine <arma@torproject.org> | 2002-09-24 10:43:57 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2002-09-24 10:43:57 +0000 |
commit | 253f0f160e1185cbab507920b6391064757be677 (patch) | |
tree | 19ca43835dff932ff14921ac32b78ead6150c253 /src/common/crypto.h | |
parent | c262b34a3c49b7ab6ae9d826b86c5ad16088cf5f (diff) | |
download | tor-253f0f160e1185cbab507920b6391064757be677.tar.gz tor-253f0f160e1185cbab507920b6391064757be677.zip |
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
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r-- | src/common/crypto.h | 14 |
1 files changed, 9 insertions, 5 deletions
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); |