aes256.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Byte-oriented AES-256 implementation.
  3. * All lookup tables replaced with 'on the fly' calculations.
  4. *
  5. * Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com
  6. * Other contributors: Hal Finney
  7. *
  8. * Permission to use, copy, modify, and distribute this software for any
  9. * purpose with or without fee is hereby granted, provided that the above
  10. * copyright notice and this permission notice appear in all copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  13. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  15. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  16. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  17. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  18. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19. */
  20. #ifndef AES_256_H
  21. #define AES_256_H
  22. #include "core/typedefs.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. typedef struct {
  27. uint8_t key[32];
  28. uint8_t enckey[32];
  29. uint8_t deckey[32];
  30. } aes256_context;
  31. void aes256_init(aes256_context *, uint8_t * /* key */);
  32. void aes256_done(aes256_context *);
  33. void aes256_encrypt_ecb(aes256_context *, uint8_t * /* plaintext */);
  34. void aes256_decrypt_ecb(aes256_context *, uint8_t * /* cipertext */);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif