aes_xts.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* $OpenBSD: aes_xts.h,v 1.1 2012/10/09 12:36:50 jsing Exp $ */
  2. /*
  3. * Copyright (C) 2008, Damien Miller
  4. *
  5. * Permission to use, copy, and modify this software with or without fee
  6. * is hereby granted, provided that this entire notice is included in
  7. * all copies of any software which is or includes a copy or
  8. * modification of this software.
  9. * You may use this code under the GNU public license if you so wish. Please
  10. * contribute changes back to the authors under this freer than GPL license
  11. * so that we may further the use of strong encryption without limitations to
  12. * all.
  13. *
  14. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
  15. * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
  16. * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
  17. * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
  18. * PURPOSE.
  19. */
  20. #include "rijndael.h"
  21. #define AES_XTS_BLOCKSIZE 16
  22. #define AES_XTS_IVSIZE 8
  23. #define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */
  24. struct aes_xts_ctx {
  25. rijndael_ctx key1;
  26. rijndael_ctx key2;
  27. u_int8_t tweak[AES_XTS_BLOCKSIZE];
  28. };
  29. int aes_xts_setkey(struct aes_xts_ctx *, u_int8_t *, int);
  30. void aes_xts_crypt(struct aes_xts_ctx *, u_int8_t *, u_int);
  31. void aes_xts_encrypt(struct aes_xts_ctx *, u_int8_t *);
  32. void aes_xts_decrypt(struct aes_xts_ctx *, u_int8_t *);
  33. void aes_xts_zerokey(struct aes_xts_ctx *);
  34. void aes_xts_reinit(struct aes_xts_ctx *, u_int8_t *);