bcal_rc5.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* bcal_rc5.c */
  2. /*
  3. This file is part of the ARM-Crypto-Lib.
  4. Copyright (C) 2006-2010 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. /**
  17. * \file bcal_rc5.c
  18. * \email daniel.otte@rub.de
  19. * \author Daniel Otte
  20. * \date 2009-01-09
  21. * \license GPLv3 or later
  22. *
  23. */
  24. #include <stdlib.h>
  25. #include <crypto/blockcipher_descriptor.h>
  26. #include <crypto/rc5.h>
  27. #include <crypto/keysize_descriptor.h>
  28. #define RC5_ROUNDS 12
  29. const char rc5_str[] = "RC5";
  30. const uint8_t rc5_keysize_desc[] = { KS_TYPE_RANGE, KS_INT(1), KS_INT(2040),
  31. KS_TYPE_TERMINATOR };
  32. static
  33. void rc5_dummy_init(void* key, uint16_t keysize_b, void* ctx){
  34. rc5_init(key, keysize_b, RC5_ROUNDS, ctx);
  35. }
  36. const bcdesc_t rc5_desc = {
  37. BCDESC_TYPE_BLOCKCIPHER,
  38. BC_INIT_TYPE_2,
  39. rc5_str,
  40. sizeof(rc5_ctx_t),
  41. 128,
  42. {(void_fpt)rc5_dummy_init},
  43. {(void_fpt)rc5_enc},
  44. {(void_fpt)rc5_dec},
  45. (bc_free_fpt)rc5_free,
  46. rc5_keysize_desc
  47. };