X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilccipher.c;h=f7f64600b34633fc788f756d59dfffab5061f143;hb=52e57c880aba9c5e89f59d962eb9af75670b76e0;hp=ee722690356263061f8b04078ad169468296f2e4;hpb=8fd8212bcd16f2b53fbedff2a9b9a4e8c15b9695;p=silc.git diff --git a/lib/silccrypt/silccipher.c b/lib/silccrypt/silccipher.c index ee722690..f7f64600 100644 --- a/lib/silccrypt/silccipher.c +++ b/lib/silccrypt/silccipher.c @@ -60,12 +60,6 @@ const SilcCipherObject silc_default_ciphers[] = SILC_CIPHER_MODE_CBC), SILC_CIPHER_API_DEF("twofish-128-cbc", twofish_cbc, 128, 16, 16, SILC_CIPHER_MODE_CBC), - SILC_CIPHER_API_DEF("cast-256-cbc", cast_cbc, 256, 16, 16, - SILC_CIPHER_MODE_CBC), - SILC_CIPHER_API_DEF("cast-192-cbc", cast_cbc, 192, 16, 16, - SILC_CIPHER_MODE_CBC), - SILC_CIPHER_API_DEF("cast-128-cbc", cast_cbc, 128, 16, 16, - SILC_CIPHER_MODE_CBC), #ifdef SILC_DEBUG SILC_CIPHER_API_DEF("none", none, 0, 0, 0, 0), #endif /* SILC_DEBUG */ @@ -95,7 +89,13 @@ SilcBool silc_cipher_register(const SilcCipherObject *cipher) } new = silc_calloc(1, sizeof(*new)); + if (!new) + return FALSE; new->name = strdup(cipher->name); + if (!new->name) { + silc_free(new); + return FALSE; + } new->key_len = cipher->key_len; new->block_len = cipher->block_len; new->iv_len = cipher->iv_len; @@ -215,8 +215,14 @@ SilcBool silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher) if (entry) { *new_cipher = silc_calloc(1, sizeof(**new_cipher)); + if (!(*new_cipher)) + return FALSE; (*new_cipher)->cipher = entry; (*new_cipher)->context = silc_calloc(1, entry->context_len()); + if (!(*new_cipher)->context) { + silc_free(*new_cipher); + return FALSE; + } return TRUE; }