Moved silc_client_ch[u]mode[_char] to client library from silc/.
[silc.git] / lib / silccrypt / silccipher.c
index c3d2087017f1f9bab79f5141b3db6f8c09b27a6b..d98f86d07273461ed0bc7fb74099fd73cbd23e10 100644 (file)
 /*
  * $Id$
  * $Log$
+ * Revision 1.5  2000/10/09 11:37:21  priikone
+ *     bugfixes. Made public/private keys protocol compliant.
+ *
+ * Revision 1.4  2000/10/02 18:31:46  priikone
+ *     Added rijndael (AES) to cipher list.
+ *
+ * Revision 1.3  2000/09/28 11:28:20  priikone
+ *     Changed cipher list order.
+ *
+ * Revision 1.2  2000/07/05 06:08:43  priikone
+ *     Global cosmetic change.
+ *
  * Revision 1.1.1.1  2000/06/27 11:36:54  priikone
- *     Importet from internal CVS/Added Log headers.
+ *     Imported from internal CVS/Added Log headers.
  *
  *
  */
@@ -47,18 +59,21 @@ struct SilcCipherListStruct *silc_cipher_list = NULL;
    support SIM's. */
 SilcCipherObject silc_cipher_builtin_list[] =
 {
-  { "none", 0, 0, silc_none_set_key, silc_none_set_key_with_string,
-    silc_none_encrypt_cbc, silc_none_decrypt_cbc, 
-    silc_none_context_len },
   { "twofish", 16, 16, silc_twofish_set_key, silc_twofish_set_key_with_string,
     silc_twofish_encrypt_cbc, silc_twofish_decrypt_cbc, 
     silc_twofish_context_len },
+  { "aes", 16, 16, silc_rijndael_set_key, 
+    silc_rijndael_set_key_with_string, silc_rijndael_encrypt_cbc,
+    silc_rijndael_decrypt_cbc, silc_rijndael_context_len },
   { "rc6", 16, 16, silc_rc6_set_key, silc_rc6_set_key_with_string,
     silc_rc6_encrypt_cbc, silc_rc6_decrypt_cbc, 
     silc_rc6_context_len },
   { "mars", 16, 16, silc_mars_set_key, silc_mars_set_key_with_string,
     silc_mars_encrypt_cbc, silc_mars_decrypt_cbc, 
     silc_mars_context_len },
+  { "none", 0, 0, silc_none_set_key, silc_none_set_key_with_string,
+    silc_none_encrypt_cbc, silc_none_decrypt_cbc, 
+    silc_none_context_len },
 
   { NULL, 0, 0, NULL, NULL, NULL, NULL, NULL }
 };
@@ -75,18 +90,7 @@ int silc_cipher_register(SilcCipherObject *cipher)
   SILC_LOG_DEBUG(("Registering new cipher"));
 
   new = silc_calloc(1, sizeof(*new));
-  if (!new) {
-    SILC_LOG_ERROR(("Could not allocate new cipher list object: %s",
-                   strerror(errno)));
-    return FALSE;
-  }
-
   new->cipher = silc_calloc(1, sizeof(*new->cipher));
-  if (!new->cipher) {
-    SILC_LOG_ERROR(("Could not allocate new cipher object: %s",
-                   strerror(errno)));
-    return FALSE;
-  }
 
   /* Set the pointers */
   new->cipher->name = strdup(cipher->name);
@@ -180,10 +184,6 @@ int silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher)
 
   /* Allocate the new object */
   *new_cipher = silc_calloc(1, sizeof(**new_cipher));
-  if (*new_cipher == NULL) {
-    SILC_LOG_ERROR(("Could not allocate new cipher object"));
-    return FALSE;
-  }
   
   if (silc_cipher_list) {