aes_cbc.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. aes_expanded_key_t expanded_key; /* the cipher key */
  18. } aes_cbc_ctx_t;
  19. err_status_t
  20. aes_cbc_set_key(aes_cbc_ctx_t *c,
  21. const unsigned char *key);
  22. err_status_t
  23. aes_cbc_encrypt(aes_cbc_ctx_t *c,
  24. unsigned char *buf,
  25. unsigned int *bytes_in_data);
  26. err_status_t
  27. aes_cbc_context_init(aes_cbc_ctx_t *c, const uint8_t *key,
  28. int key_len, cipher_direction_t dir);
  29. err_status_t
  30. aes_cbc_set_iv(aes_cbc_ctx_t *c, void *iv);
  31. err_status_t
  32. aes_cbc_nist_encrypt(aes_cbc_ctx_t *c,
  33. unsigned char *data,
  34. unsigned int *bytes_in_data);
  35. err_status_t
  36. aes_cbc_nist_decrypt(aes_cbc_ctx_t *c,
  37. unsigned char *data,
  38. unsigned int *bytes_in_data);
  39. #endif /* AES_CBC_H */