X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilccipher.c;h=5eba8bcae6562293268833c56968a90cd452635c;hp=74b8bb98a3d5167f3fa55842a861bad5b98215b9;hb=3ef234937ec402fb77006783624375ef61ffa65d;hpb=a0688142e66b5c6927a11a412a095b43779719ce diff --git a/lib/silccrypt/silccipher.c b/lib/silccrypt/silccipher.c index 74b8bb98..5eba8bca 100644 --- a/lib/silccrypt/silccipher.c +++ b/lib/silccrypt/silccipher.c @@ -93,7 +93,7 @@ int silc_cipher_register(SilcCipherObject *cipher) { struct SilcCipherListStruct *new, *c; - SILC_LOG_DEBUG(("Registering new cipher")); + SILC_LOG_DEBUG(("Registering new cipher `%s'", cipher->name)); new = silc_calloc(1, sizeof(*new)); new->cipher = silc_calloc(1, sizeof(*new->cipher)); @@ -314,6 +314,24 @@ char *silc_cipher_get_supported() return list; } +/* Encrypts */ + +int silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src, + unsigned char *dst, unsigned int len, + unsigned char *iv) +{ + return cipher->cipher->encrypt(cipher->context, src, dst, len, iv); +} + +/* Decrypts */ + +int silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src, + unsigned char *dst, unsigned int len, + unsigned char *iv) +{ + return cipher->cipher->decrypt(cipher->context, src, dst, len, iv); +} + /* Sets the key for the cipher */ int silc_cipher_set_key(SilcCipher cipher, const unsigned char *key, @@ -340,8 +358,7 @@ void silc_cipher_get_iv(SilcCipher cipher, unsigned char *iv) /* Returns the key length of the cipher. */ -unsigned int silc_cipher_get_key_len(SilcCipher cipher, - const unsigned char *name) +unsigned int silc_cipher_get_key_len(SilcCipher cipher) { return cipher->cipher->key_len; }