chapoly_aead.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2015 Martin Willi
  3. * Copyright (C) 2015 revosec AG
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  12. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  13. * for more details.
  14. */
  15. /**
  16. * @defgroup chapoly_aead chapoly_aead
  17. * @{ @ingroup chapoly
  18. */
  19. #ifndef CHAPOLY_AEAD_H_
  20. #define CHAPOLY_AEAD_H_
  21. #include <crypto/aead.h>
  22. typedef struct chapoly_aead_t chapoly_aead_t;
  23. /**
  24. * ChaCha20/Poly1305 AEAD implementation.
  25. *
  26. * TODO-Chapoly: draft-ietf-ipsecme-chacha20-poly1305-05
  27. */
  28. struct chapoly_aead_t {
  29. /**
  30. * Implements aead_t interface.
  31. */
  32. aead_t aead;
  33. };
  34. /**
  35. * Create a chapoly_aead instance.
  36. *
  37. * @param algo algorithm to implement, ENCR_CHACHA20_POLY1305
  38. * @param key_size key size in bytes, 32
  39. * @param salt_size size of implicit salt length, 0
  40. * @return AEAD, NULL if not supported
  41. */
  42. chapoly_aead_t *chapoly_aead_create(encryption_algorithm_t algo,
  43. size_t key_size, size_t salt_size);
  44. #endif /** CHAPOLY_AEAD_H_ @}*/