Code auditing weekend results and fixes committing.
[silc.git] / lib / silccrypt / silccipher.c
index c3d2087017f1f9bab79f5141b3db6f8c09b27a6b..824bcbe21fa081e4b0f868b9895d2835efc7e3b0 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
 
-  Copyright (C) 1997 - 2000 Pekka Riikonen
+  Copyright (C) 1997 - 2001 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   GNU General Public License for more details.
 
 */
-/*
- * $Id$
- * $Log$
- * Revision 1.1.1.1  2000/06/27 11:36:54  priikone
- *     Importet from internal CVS/Added Log headers.
- *
- *
- */
+/* $Id$ */
 
 #include "silcincludes.h"
 
@@ -47,18 +40,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 +71,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 +165,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) {