crypto_aes_aesni.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef CRYPTO_AES_AESNI_H_
  2. #define CRYPTO_AES_AESNI_H_
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. /**
  6. * crypto_aes_key_expand_aesni(key_unexpanded, len):
  7. * Expand the ${len}-byte unexpanded AES key ${key_unexpanded} into a
  8. * structure which can be passed to crypto_aes_encrypt_block_aesni(). The
  9. * length must be 16 or 32. This implementation uses x86 AESNI instructions,
  10. * and should only be used if CPUSUPPORT_X86_AESNI is defined and
  11. * cpusupport_x86_aesni() returns nonzero.
  12. */
  13. void * crypto_aes_key_expand_aesni(const uint8_t *, size_t);
  14. /**
  15. * crypto_aes_encrypt_block_aesni(in, out, key):
  16. * Using the expanded AES key ${key}, encrypt the block ${in} and write the
  17. * resulting ciphertext to ${out}. ${in} and ${out} can overlap. This
  18. * implementation uses x86 AESNI instructions, and should only be used if
  19. * CPUSUPPORT_X86_AESNI is defined and cpusupport_x86_aesni() returns nonzero.
  20. */
  21. void crypto_aes_encrypt_block_aesni(const uint8_t[16], uint8_t[16],
  22. const void *);
  23. /**
  24. * crypto_aes_key_free_aesni(key):
  25. * Free the expanded AES key ${key}.
  26. */
  27. void crypto_aes_key_free_aesni(void *);
  28. #endif /* !CRYPTO_AES_AESNI_H_ */