X-Git-Url: http://git.silcnet.org/gitweb/?p=crypto.git;a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilccipher.h;fp=lib%2Fsilccrypt%2Fsilccipher.h;h=77475fde69cc58c47f6cc6c7cb9da4ac82df45ac;hp=d86de0ebb82becae19e663af2b6b49f58d05637d;hb=87f7fe2aac95581dbd3e6258b6276da08952c13d;hpb=bd548b5771a325d3dc051887d3fd0225550d4418 diff --git a/lib/silccrypt/silccipher.h b/lib/silccrypt/silccipher.h index d86de0eb..77475fde 100644 --- a/lib/silccrypt/silccipher.h +++ b/lib/silccrypt/silccipher.h @@ -17,7 +17,7 @@ */ -/****h* silccrypt/SILC Cipher Interface +/****h* silccrypt/Cipher Interface * * DESCRIPTION * @@ -25,6 +25,22 @@ * registering and unregistering routines, encryption and decryption * routines. * + * EXAMPLE + * + * // Allocate AES-128 cipher in CBC mode + * SilcCipher aes; + * + * silc_cipher_alloc(SILC_CIPHER_AES_128_CBC, &aes); + * + * // Set key for encryption, key length must in bits + * silc_cipher_set_key(aes, key, key_len * 8, TRUE); + * + * // Set IV + * silc_cipher_set_iv(aes, iv); + * + * // Encrypt data + * silc_cipher_encrypt(aes, src, dst, len, NULL); + * ***/ #ifndef SILCCIPHER_H @@ -125,7 +141,7 @@ typedef struct SilcCipherStruct *SilcCipher; #define SILC_CIPHER_NONE "none" /***/ -/****d* silccrypt/Cipher Algorithms +/****d* silccrypt/Cipher-Algorithms * * NAME * @@ -292,10 +308,12 @@ SilcBool silc_cipher_unregister_all(void); * argument. The caller must set the key to the cipher after this * function has returned by calling the silc_cipher_set_key. * + * See Ciphers for supported ciphers. + * ***/ SilcBool silc_cipher_alloc(const char *name, SilcCipher *new_cipher); -/****f* silccrypt/silc_cipher_alloc +/****f* silccrypt/silc_cipher_alloc_full * * SYNOPSIS * @@ -308,6 +326,8 @@ SilcBool silc_cipher_alloc(const char *name, SilcCipher *new_cipher); * Same as silc_cipher_alloc but takes the cipher algorithm name, * key length and mode as separate arguments. * + * See Cipher-Algorithms for supported algorithms. + * ***/ SilcBool silc_cipher_alloc_full(const char *alg_name, SilcUInt32 key_len, SilcCipherMode mode, SilcCipher *new_cipher);