serpent.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* serpent.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. /** \file serpent.h
  17. * \author Daniel Otte
  18. * \license GPLv3
  19. * \brief a implementation of the serpent cipher for avr microcontrollers
  20. */
  21. #ifndef SERPENT_H_
  22. #define SERPENT_H_
  23. #include <stdint.h>
  24. typedef uint32_t serpent_subkey_t[4];
  25. typedef struct serpent_ctx_st {
  26. serpent_subkey_t k[33];
  27. } serpent_ctx_t;
  28. #define SERPENT_KEY128 128
  29. #define SERPENT_KEY192 192
  30. #define SERPENT_KEY256 256
  31. /* key must be 256bit (32 byte) large! */
  32. void serpent_init(const void* key, uint16_t keysize_b, serpent_ctx_t* ctx);
  33. void serpent_enc(void* buffer, const serpent_ctx_t* ctx);
  34. void serpent_dec(void* buffer, const serpent_ctx_t* ctx);
  35. #endif /*SERPENT_H_*/