-*/
-typedef struct {
- char *name;
- SilcUInt32 block_len;
- SilcUInt32 key_len;
-
- bool (*set_key)(void *, const unsigned char *, SilcUInt32);
- bool (*set_key_with_string)(void *, const unsigned char *, SilcUInt32);
- bool (*encrypt)(void *, const unsigned char *, unsigned char *,
- SilcUInt32, unsigned char *);
- bool (*decrypt)(void *, const unsigned char *, unsigned char *,
- SilcUInt32, unsigned char *);
- SilcUInt32 (*context_len)();
-} SilcCipherObject;
-
-#define SILC_CIPHER_MAX_IV_SIZE 16
-
-/* The main SilcCipher structure. Use SilcCipher instead of SilcCipherStruct.
- Also remember that SilcCipher is a pointer. */
-typedef struct SilcCipherStruct {
- SilcCipherObject *cipher;
- void *context;
- unsigned char iv[SILC_CIPHER_MAX_IV_SIZE];
- void (*set_iv)(struct SilcCipherStruct *, const unsigned char *);
- void (*get_iv)(struct SilcCipherStruct *, unsigned char *);
- SilcUInt32 (*get_key_len)(struct SilcCipherStruct *);
- SilcUInt32 (*get_block_len)(struct SilcCipherStruct *);
-} *SilcCipher;
+/* Twofish in CBC mode, in different key lengths */
+#define SILC_CIPHER_TWOFISH_256_CBC "twofish-256-cbc"
+#define SILC_CIPHER_TWOFISH_192_CBC "twofish-192-cbc"
+#define SILC_CIPHER_TWOFISH_128_CBC "twofish-128-cbc"
+
+/* Twofish in CFB mode, in different key lengths */
+#define SILC_CIPHER_TWOFISH_256_CFB "twofish-256-cfb"
+#define SILC_CIPHER_TWOFISH_192_CFB "twofish-192-cfb"
+#define SILC_CIPHER_TWOFISH_128_CFB "twofish-128-cfb"
+
+/* Twofish in ECB mode, in different key lengths */
+#define SILC_CIPHER_TWOFISH_256_ECB "twofish-256-ecb"
+#define SILC_CIPHER_TWOFISH_192_ECB "twofish-192-ecb"
+#define SILC_CIPHER_TWOFISH_128_ECB "twofish-128-ecb"
+
+/* CAST-128 in CTR, CBC, CFB, ECB modes, 128-bit key length */
+#define SILC_CIPHER_CAST5_128_CTR "cast5-128-ctr"
+#define SILC_CIPHER_CAST5_128_CBC "cast5-128-cbc"
+#define SILC_CIPHER_CAST5_128_CFB "cast5-128-cfb"
+#define SILC_CIPHER_CAST5_128_ECB "cast5-128-ecb"
+
+/* DES in CTR, CBC, CFB, ECB modes, 56-bit key length */
+#define SILC_CIPHER_DES_56_CTR "des-56-ctr"
+#define SILC_CIPHER_DES_56_CBC "des-56-cbc"
+#define SILC_CIPHER_DES_56_CFB "des-56-cfb"
+#define SILC_CIPHER_DES_56_ECB "des-56-ecb"
+
+/* 3DES in CTR, CBC, CFB, ECB modes, 168-bit (192-bit) key length */
+#define SILC_CIPHER_3DES_168_CTR "3des-168-ctr"
+#define SILC_CIPHER_3DES_168_CBC "3des-168-cbc"
+#define SILC_CIPHER_3DES_168_CFB "3des-168-cfb"
+#define SILC_CIPHER_3DES_168_ECB "3des-168-ecb"
+
+/* No encryption */
+#define SILC_CIPHER_NONE "none"
+/***/
+
+/****d* silccrypt/Cipher Algorithms
+ *
+ * NAME
+ *
+ * Cipher Algorithms
+ *
+ * DESCRIPTION
+ *
+ * Supported cipher algorithm names. These names can be give as argument
+ * to silc_cipher_alloc_full.
+ *
+ * SOURCE
+ */
+#define SILC_CIPHER_AES "aes" /* AES */
+#define SILC_CIPHER_TWOFISH "twofish" /* Twofish */
+#define SILC_CIPHER_CAST5 "cast5" /* CAST-128 */
+#define SILC_CIPHER_DES "des" /* DES */
+#define SILC_CIPHER_3DES "3des" /* Triple-DES */
+/***/
+
+/****d* silccrypt/SilcCipherMode
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcCipherMode;
+ *
+ * DESCRIPTION
+ *
+ * Cipher modes. Notes about cipher modes and implementation:
+ *
+ * SILC_CIPHER_MODE_CBC
+ *
+ * The Cipher-block Chaining mode. The plaintext length must be
+ * multiple by the cipher block size. If it isn't the plaintext must
+ * be padded.
+ *
+ * SILC_CIPHER_MODE_CTR
+ *
+ * The Counter mode. The CTR mode does not require the plaintext length
+ * to be multiple by the cipher block size. If the last plaintext block
+ * is shorter the remaining bits of the key stream are used next time
+ * silc_cipher_encrypt is called. If silc_cipher_set_iv is called it
+ * will reset the counter for a new block (discarding any remaining
+ * bits from previous key stream). The CTR mode expects MSB first
+ * ordered counter. Note also, the counter is incremented when
+ * silc_cipher_encrypt is called for the first time, before encrypting.
+ *
+ * SILC_CIPHER_MODE_CFB
+ *
+ * The Cipher Feedback mode. The CFB mode does not require the plaintext
+ * length to be multiple by the cipher block size. If the last plaintext
+ * block is shorter the remaining bits of the stream are used next time
+ * silc_cipher_encrypt is called. If silc_cipher_set_iv is called it
+ * will reset the feedback for a new block (discarding any remaining
+ * bits from previous stream).
+ *
+ * SILC_CIPHER_MODE_OFB
+ *
+ * The Output Feedback mode.
+ *
+ * SILC_CIPHER_MODE_ECB
+ *
+ * The Electronic Codebook mode. This mode does not provide sufficient
+ * security and should not be used alone.
+ *
+ * Each mode using and IV (initialization vector) modifies the IV of the
+ * cipher when silc_cipher_encrypt or silc_cipher_decrypt is called. The
+ * IV may be set/reset by calling silc_cipher_set_iv and the current IV
+ * can be retrieved by calling silc_cipher_get_iv.
+ *
+ * SOURCE
+ */
+typedef enum {
+ SILC_CIPHER_MODE_ECB = 1, /* ECB mode */
+ SILC_CIPHER_MODE_CBC = 2, /* CBC mode */
+ SILC_CIPHER_MODE_CTR = 3, /* CTR mode */
+ SILC_CIPHER_MODE_CFB = 4, /* CFB mode */
+ SILC_CIPHER_MODE_OFB = 5, /* OFB mode */
+} SilcCipherMode;
+/***/
+
+#define SILC_CIPHER_MAX_IV_SIZE 16 /* Maximum IV size */