crypto_kernel.txt 1.6 KB

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