1 /** 2 3 @defgroup CryptoKernel Cryptographic Kernel 4 5 All of the cryptographic functions are contained in a kernel. 6 7 */ 8 9 /** 10 11 @defgroup CipherImplementations Ciphers 12 @ingroup CryptoKernel 13 14 @brief A generic cipher type enables cipher agility, that is, the 15 ability to write code that runs with multiple cipher types. 16 Ciphers can be used through the crypto kernel, or can be accessed 17 directly, if need be. 18 19 @{ 20 21 */ 22 23 /** 24 * @brief Allocates a cipher of a particular type. 25 * @warning May be implemented as a macro. 26 */ 27 err_status_t 28 cipher_type_alloc(cipher_type_t *ctype, cipher_t **cipher, 29 unsigned key_len); 30 31 /** 32 * @brief Initialized a cipher to use a particular key. May 33 * be invoked more than once on the same cipher. 34 * @warning May be implemented as a macro. 35 */ 36 37 err_status_t 38 cipher_init(cipher_t *cipher, const uint8_t *key); 39 40 /** 41 * @brief Sets the initialization vector of a given cipher. 42 * @warning May be implemented as a macro. 43 */ 44 45 err_status_t 46 cipher_set_iv(cipher_t *cipher, void *iv); 47 48 /** 49 * @brief Encrypts a buffer with a given cipher. 50 * @warning May be implemented as a macro. 51 */ 52 53 err_status_t 54 cipher_encrypt(cipher_t *cipher, void *buf, unsigned int *len); 55 56 /** 57 * @brief Sets a buffer to the keystream generated by the cipher. 58 * @warning May be implemented as a macro. 59 */ 60 err_status_t 61 cipher_output(cipher_t *c, uint8_t *buffer, int num_octets_to_output); 62 63 /** 64 * @brief Deallocates a cipher. 65 * @warning May be implemented as a macro. 66 */ 67 err_status_t 68 cipher_dealloc(cipher_t *cipher); 69 70 71 72 /** 73 * @} 74 */ 75 76 */