diff options
author | Nick Mathewson <nickm@torproject.org> | 2003-05-01 00:53:46 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2003-05-01 00:53:46 +0000 |
commit | 6af79f3a03fe23342ff4e41d0405238905643b67 (patch) | |
tree | b7af162280bf474db782fff1d94c0a63c4ecf072 /src/common/crypto.h | |
parent | e0d734eb69c61123bd7940bdd6ad00676bc0ae99 (diff) | |
download | tor-6af79f3a03fe23342ff4e41d0405238905643b67.tar tor-6af79f3a03fe23342ff4e41d0405238905643b67.tar.gz |
Basic diffie-helman wrappers with fixed modulus and tests
svn:r257
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r-- | src/common/crypto.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h index 5f2d3e29b..af0cc904c 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -64,7 +64,19 @@ 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); int crypto_pk_private_decrypt(crypto_pk_env_t *env, unsigned char *from, int fromlen, unsigned char *to, int padding); - + +/* Key negotiation */ +typedef struct crypto_dh_env_st crypto_dh_env_t; +#define CRYPTO_DH_SIZE (1536 / 8) +crypto_dh_env_t *crypto_dh_new(); +int crypto_dh_get_bytes(crypto_dh_env_t *dh); +int crypto_dh_get_public(crypto_dh_env_t *dh, char *pubkey_out, + int pubkey_out_len); +int crypto_dh_compute_secret(crypto_dh_env_t *dh, + char *pubkey, int pubkey_len, + char *secret_out); +void crypto_dh_free(crypto_dh_env_t *dh); + /* symmetric crypto */ int crypto_cipher_generate_key(crypto_cipher_env_t *env); int crypto_cipher_set_iv(crypto_cipher_env_t *env, unsigned char *iv); |