updates. New data types.
[silc.git] / lib / silccrypt / silccipher.c
index 74b8bb98a3d5167f3fa55842a861bad5b98215b9..c321f6f9ea3258d76bb75ed499de3280d1387917 100644 (file)
@@ -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,10 +314,28 @@ char *silc_cipher_get_supported()
   return list;
 }
 
+/* Encrypts */
+
+int silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
+                       unsigned char *dst, uint32 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, uint32 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,
-                       unsigned int keylen)
+                       uint32 keylen)
 {
   return cipher->cipher->set_key(cipher->context, key, keylen);
 }
@@ -340,15 +358,14 @@ 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)
+uint32 silc_cipher_get_key_len(SilcCipher cipher)
 {
   return cipher->cipher->key_len;
 }
 
 /* Returns the block size of the cipher. */
 
-unsigned int silc_cipher_get_block_len(SilcCipher cipher)
+uint32 silc_cipher_get_block_len(SilcCipher cipher)
 {
   return cipher->cipher->block_len;
 }