noekeon.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* noekeon.h */
  2. /*
  3. This file is part of the ARM-Crypto-Lib.
  4. Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef NOEKEON_H_
  17. #define NOEKEON_H_
  18. /**
  19. * \file noekeon.h
  20. * \author Daniel Otte
  21. * \email daniel.otte@rub.de
  22. * \date 2008-04-11
  23. * \license GPLv3 or later
  24. * \brief Implementation of the Noekeon block cipher
  25. * \ingroup Noekeon
  26. * This is an implementation of the Noekeon block cipher.
  27. * For more details on Noekeon see http://gro.noekeon.org/
  28. */
  29. #include <stdint.h>
  30. /** \typedef noekeon_ctx_t
  31. * \brief holds key data for indirect mode
  32. *
  33. * A variable of this type may hold the key data for the indirect mode.
  34. * For direct mode simply pass the key directly to the encryption or
  35. * decryption function.
  36. */
  37. typedef uint8_t noekeon_ctx_t[16];
  38. /** \fn void noekeon_enc(void* buffer, const void* key)
  39. * \brief noekeon encrytion funtion
  40. *
  41. * This function encrypts a block (64 bit = 8 byte) with the noekeon encrytion
  42. * algorithm. Due to the two modes of noekeon (direct mode and indirect mode)
  43. * the second parameter either points directly to the key (direct mode) or to a
  44. * context generated by the noekeon_init() function (indirect mode).
  45. * \param buffer pointer to the 64 bit (8 byte) block to encrypt
  46. * \param key pointer to either the key (128 bit = 16 byte; direct mode) or
  47. * to the context (indirect mode)
  48. */
  49. void noekeon_enc(void* buffer, const void* key);
  50. /** \fn void noekeon_dec(void* buffer, const void* key)
  51. * \brief noekeon encrytion funtion
  52. *
  53. * This function decrypts a block (64 bit = 8 byte) encrypted with the noekeon
  54. * encrytion algorithm. Due to the two modes of noekeon (direct mode and
  55. * indirect mode) the second parameter either points directly to the key
  56. * (direct mode) or to a context generated by the noekeon_init() function
  57. * (indirect mode).
  58. * \param buffer pointer to the 64 bit (8 byte) block to decrypt
  59. * \param key pointer to either the key (128 bit = 16 byte; direct mode) or
  60. * to the context (indirect mode)
  61. */
  62. void noekeon_dec(void* buffer, const void* key);
  63. /** \fn void noekeon_init(const void* key, noekeon_ctx_t* ctx)
  64. * \brief noekeon context generation function for indirect mode
  65. *
  66. * This function generates a context from the supplied key for using
  67. * noekeon in indirect mode. For using noekeon in direct mode supply the key
  68. * direct to the noekeon_enc() and noekeon_dec() functions.
  69. * \param key pointer to the key (128 bit = 16 byte)
  70. * \param ctx pointer to the context to fill with key material
  71. * to the context (indirect mode)
  72. */
  73. void noekeon_init(const void* key, noekeon_ctx_t* ctx);
  74. #endif /*NOEKEON_H_*/