aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.h
diff options
context:
space:
mode:
authorMatej Pjafjar <badbytes@freehaven.net>2002-07-25 08:17:22 +0000
committerMatej Pjafjar <badbytes@freehaven.net>2002-07-25 08:17:22 +0000
commite01522bbed6eea575be75c18860db17bd65d9ddb (patch)
treebf2fa7cccf6f79cd4959d1d4ef8ec5c6ebf60cca /src/common/crypto.h
parent5af5a963438bfde26e354e59dfd5b3e27b78b5c3 (diff)
downloadtor-e01522bbed6eea575be75c18860db17bd65d9ddb.tar.gz
tor-e01522bbed6eea575be75c18860db17bd65d9ddb.zip
Added the crypto abstraction to libor. Need to test and change the code to use this instead of OpenSSL.
svn:r74
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r--src/common/crypto.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 63615a13b9..e35c8e74c5 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -53,22 +53,29 @@ 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_check_key(crypto_pk_env_t *env);
int crypto_pk_set_key(crypto_pk_env_t *env, unsigned char *key);
+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);
+
/* symmetric crypto */
int crypto_cipher_set_iv(crypto_cipher_env_t *env, unsigned char *iv);
int crypto_cipher_set_key(crypto_cipher_env_t *env, unsigned char *key);
-int crypto_cipher_init_cipher();
+int crypto_cipher_encrypt_init_cipher(crypto_cipher_env_t *env);
+int crypto_cipher_decrypt_init_cipher(crypto_cipher_env_t *env);
int crypto_cipher_encrypt(crypto_cipher_env_t *env, unsigned char *from, unsigned int fromlen, unsigned char *to);
int crypto_cipher_decrypt(crypto_cipher_env_t *env, unsigned char *from, unsigned int fromlen, unsigned char *to);
/* SHA-1 */
-int crypto_SHA_digest(unsigned char *m, unsigned char *digest);
+int crypto_SHA_digest(unsigned char *m, int len, unsigned char *digest);
/* random numbers */
int crypto_rand(unsigned int n, unsigned char *to);
int crypto_pseudo_rand(unsigned int n, unsigned char *to);
+/* errors */
+char *crypto_perror();
#endif