vmac.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Modified to interface to the Linux kernel
  3. * Copyright (c) 2009, Intel Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  16. * Place - Suite 330, Boston, MA 02111-1307 USA.
  17. */
  18. #ifndef __CRYPTO_VMAC_H
  19. #define __CRYPTO_VMAC_H
  20. /* --------------------------------------------------------------------------
  21. * VMAC and VHASH Implementation by Ted Krovetz (tdk@acm.org) and Wei Dai.
  22. * This implementation is herby placed in the public domain.
  23. * The authors offers no warranty. Use at your own risk.
  24. * Please send bug reports to the authors.
  25. * Last modified: 17 APR 08, 1700 PDT
  26. * ----------------------------------------------------------------------- */
  27. /*
  28. * User definable settings.
  29. */
  30. #define VMAC_TAG_LEN 64
  31. #define VMAC_KEY_SIZE 128/* Must be 128, 192 or 256 */
  32. #define VMAC_KEY_LEN (VMAC_KEY_SIZE/8)
  33. #define VMAC_NHBYTES 128/* Must 2^i for any 3 < i < 13 Standard = 128*/
  34. /*
  35. * This implementation uses u32 and u64 as names for unsigned 32-
  36. * and 64-bit integer types. These are defined in C99 stdint.h. The
  37. * following may need adaptation if you are not running a C99 or
  38. * Microsoft C environment.
  39. */
  40. struct vmac_ctx {
  41. u64 nhkey[(VMAC_NHBYTES/8)+2*(VMAC_TAG_LEN/64-1)];
  42. u64 polykey[2*VMAC_TAG_LEN/64];
  43. u64 l3key[2*VMAC_TAG_LEN/64];
  44. u64 polytmp[2*VMAC_TAG_LEN/64];
  45. u64 cached_nonce[2];
  46. u64 cached_aes[2];
  47. int first_block_processed;
  48. };
  49. typedef u64 vmac_t;
  50. struct vmac_ctx_t {
  51. struct crypto_cipher *child;
  52. struct vmac_ctx __vmac_ctx;
  53. };
  54. #endif /* __CRYPTO_VMAC_H */