SILC_LOG_DEBUG(("Registering new cipher `%s'", cipher->name));
+ /* Check if exists already */
+ if (silc_cipher_list) {
+ SilcCipherObject *entry;
+ silc_dlist_start(silc_cipher_list);
+ while ((entry = silc_dlist_get(silc_cipher_list)) != SILC_LIST_END) {
+ if (!strcmp(entry->name, cipher->name))
+ return FALSE;
+ }
+ }
+
new = silc_calloc(1, sizeof(*new));
new->name = strdup(cipher->name);
new->block_len = cipher->block_len;
/* Encrypts */
bool silc_cipher_encrypt(SilcCipher cipher, const unsigned char *src,
- unsigned char *dst, uint32 len,
+ unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
return cipher->cipher->encrypt(cipher->context, src, dst, len, iv);
/* Decrypts */
bool silc_cipher_decrypt(SilcCipher cipher, const unsigned char *src,
- unsigned char *dst, uint32 len,
+ unsigned char *dst, SilcUInt32 len,
unsigned char *iv)
{
return cipher->cipher->decrypt(cipher->context, src, dst, len, iv);
/* Sets the key for the cipher */
bool silc_cipher_set_key(SilcCipher cipher, const unsigned char *key,
- uint32 keylen)
+ SilcUInt32 keylen)
{
return cipher->cipher->set_key(cipher->context, key, keylen);
}
/* Returns the key length of the cipher. */
-uint32 silc_cipher_get_key_len(SilcCipher cipher)
+SilcUInt32 silc_cipher_get_key_len(SilcCipher cipher)
{
return cipher->cipher->key_len;
}
/* Returns the block size of the cipher. */
-uint32 silc_cipher_get_block_len(SilcCipher cipher)
+SilcUInt32 silc_cipher_get_block_len(SilcCipher cipher)
{
return cipher->cipher->block_len;
}