aes_cbc.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * aes_cbc.h
  3. *
  4. * Header for AES Cipher Blobk Chaining Mode.
  5. *
  6. * David A. McGrew
  7. * Cisco Systems, Inc.
  8. *
  9. */
  10. #ifndef AES_CBC_H
  11. #define AES_CBC_H
  12. #include "aes.h"
  13. #include "cipher.h"
  14. typedef struct {
  15. v128_t state; /* cipher chaining state */
  16. v128_t previous; /* previous ciphertext block */
  17. uint8_t key[32];
  18. int key_len;
  19. aes_expanded_key_t expanded_key; /* the cipher key */
  20. } aes_cbc_ctx_t;
  21. err_status_t
  22. aes_cbc_set_key(aes_cbc_ctx_t *c,
  23. const unsigned char *key);
  24. err_status_t
  25. aes_cbc_encrypt(aes_cbc_ctx_t *c,
  26. unsigned char *buf,
  27. unsigned int *bytes_in_data);
  28. err_status_t
  29. aes_cbc_context_init(aes_cbc_ctx_t *c, const uint8_t *key,
  30. int key_len);
  31. err_status_t
  32. aes_cbc_set_iv(aes_cbc_ctx_t *c, void *iv, int direction);
  33. err_status_t
  34. aes_cbc_nist_encrypt(aes_cbc_ctx_t *c,
  35. unsigned char *data,
  36. unsigned int *bytes_in_data);
  37. err_status_t
  38. aes_cbc_nist_decrypt(aes_cbc_ctx_t *c,
  39. unsigned char *data,
  40. unsigned int *bytes_in_data);
  41. #endif /* AES_CBC_H */