tcrypt.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Quick & dirty crypto testing module.
  3. *
  4. * This will only exist until we have a better testing mechanism
  5. * (e.g. a char device).
  6. *
  7. * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
  8. * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
  9. * Copyright (c) 2007 Nokia Siemens Networks
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the Free
  13. * Software Foundation; either version 2 of the License, or (at your option)
  14. * any later version.
  15. *
  16. */
  17. #ifndef _CRYPTO_TCRYPT_H
  18. #define _CRYPTO_TCRYPT_H
  19. struct cipher_speed_template {
  20. const char *key;
  21. unsigned int klen;
  22. };
  23. struct hash_speed {
  24. unsigned int blen; /* buffer length */
  25. unsigned int plen; /* per-update length */
  26. };
  27. /*
  28. * DES test vectors.
  29. */
  30. #define DES3_SPEED_VECTORS 1
  31. static struct cipher_speed_template des3_speed_template[] = {
  32. {
  33. .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
  34. "\x55\x55\x55\x55\x55\x55\x55\x55"
  35. "\xfe\xdc\xba\x98\x76\x54\x32\x10",
  36. .klen = 24,
  37. }
  38. };
  39. /*
  40. * Cipher speed tests
  41. */
  42. static u8 speed_template_8[] = {8, 0};
  43. static u8 speed_template_24[] = {24, 0};
  44. static u8 speed_template_8_32[] = {8, 32, 0};
  45. static u8 speed_template_16_32[] = {16, 32, 0};
  46. static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
  47. static u8 speed_template_32_40_48[] = {32, 40, 48, 0};
  48. static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
  49. /*
  50. * Digest speed tests
  51. */
  52. static struct hash_speed generic_hash_speed_template[] = {
  53. { .blen = 16, .plen = 16, },
  54. { .blen = 64, .plen = 16, },
  55. { .blen = 64, .plen = 64, },
  56. { .blen = 256, .plen = 16, },
  57. { .blen = 256, .plen = 64, },
  58. { .blen = 256, .plen = 256, },
  59. { .blen = 1024, .plen = 16, },
  60. { .blen = 1024, .plen = 256, },
  61. { .blen = 1024, .plen = 1024, },
  62. { .blen = 2048, .plen = 16, },
  63. { .blen = 2048, .plen = 256, },
  64. { .blen = 2048, .plen = 1024, },
  65. { .blen = 2048, .plen = 2048, },
  66. { .blen = 4096, .plen = 16, },
  67. { .blen = 4096, .plen = 256, },
  68. { .blen = 4096, .plen = 1024, },
  69. { .blen = 4096, .plen = 4096, },
  70. { .blen = 8192, .plen = 16, },
  71. { .blen = 8192, .plen = 256, },
  72. { .blen = 8192, .plen = 1024, },
  73. { .blen = 8192, .plen = 4096, },
  74. { .blen = 8192, .plen = 8192, },
  75. /* End marker */
  76. { .blen = 0, .plen = 0, }
  77. };
  78. #endif /* _CRYPTO_TCRYPT_H */