aes_icm.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * aes_icm.h
  3. *
  4. * Header for AES Integer Counter Mode.
  5. *
  6. * David A. McGrew
  7. * Cisco Systems, Inc.
  8. *
  9. */
  10. #ifndef AES_ICM_H
  11. #define AES_ICM_H
  12. #include "aes.h"
  13. #include "cipher.h"
  14. typedef struct {
  15. v128_t counter; /* holds the counter value */
  16. v128_t offset; /* initial offset value */
  17. v128_t keystream_buffer; /* buffers bytes of keystream */
  18. aes_expanded_key_t expanded_key; /* the cipher key */
  19. int bytes_in_buffer; /* number of unused bytes in buffer */
  20. } aes_icm_ctx_t;
  21. err_status_t
  22. aes_icm_context_init(aes_icm_ctx_t *c,
  23. const unsigned char *key,
  24. int key_len);
  25. err_status_t
  26. aes_icm_set_iv(aes_icm_ctx_t *c, void *iv);
  27. err_status_t
  28. aes_icm_encrypt(aes_icm_ctx_t *c,
  29. unsigned char *buf, unsigned int *bytes_to_encr);
  30. err_status_t
  31. aes_icm_output(aes_icm_ctx_t *c,
  32. unsigned char *buf, int bytes_to_output);
  33. err_status_t
  34. aes_icm_dealloc(cipher_t *c);
  35. err_status_t
  36. aes_icm_encrypt_ismacryp(aes_icm_ctx_t *c,
  37. unsigned char *buf,
  38. unsigned int *enc_len,
  39. int forIsmacryp);
  40. err_status_t
  41. aes_icm_alloc_ismacryp(cipher_t **c,
  42. int key_len,
  43. int forIsmacryp);
  44. #endif /* AES_ICM_H */