-/* The default SILC Cipher object to represent any cipher in SILC. */
-typedef struct {
- char *name;
- SilcBool (*set_key)(void *, const unsigned char *, SilcUInt32, SilcBool);
- SilcBool (*encrypt)(void *, const unsigned char *, unsigned char *,
- SilcUInt32, unsigned char *);
- SilcBool (*decrypt)(void *, const unsigned char *, unsigned char *,
- SilcUInt32, unsigned char *);
- SilcUInt32 (*context_len)();
- unsigned int key_len : 12;
- unsigned int block_len : 10;
- unsigned int iv_len : 10;
-} SilcCipherObject;
-
-#define SILC_CIPHER_MAX_IV_SIZE 16
+/****d* silccrypt/SilcCipherAPI/SilcCipherMode
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcCipherMode;
+ *
+ * DESCRIPTION
+ *
+ * Cipher modes. Notes about cipher modes and implementation:
+ *
+ * SILC_CIPHER_MODE_CBC
+ *
+ * The Cipher-block Chaining mode. The CBC is mode is a standard CBC
+ * 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 is normal 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 counter
+ * 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 is normal 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.
+ *
+ * Each mode modifies the IV (initialization vector) 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 */
+#define SILC_DEFAULT_CIPHER "aes-256-cbc" /* Default cipher */