tcrypt.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. unsigned int klen; /* key length */
  27. };
  28. /*
  29. * DES test vectors.
  30. */
  31. #define DES3_SPEED_VECTORS 1
  32. static struct cipher_speed_template des3_speed_template[] = {
  33. {
  34. .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
  35. "\x55\x55\x55\x55\x55\x55\x55\x55"
  36. "\xfe\xdc\xba\x98\x76\x54\x32\x10",
  37. .klen = 24,
  38. }
  39. };
  40. /*
  41. * Cipher speed tests
  42. */
  43. static u8 speed_template_8[] = {8, 0};
  44. static u8 speed_template_24[] = {24, 0};
  45. static u8 speed_template_8_32[] = {8, 32, 0};
  46. static u8 speed_template_16_32[] = {16, 32, 0};
  47. static u8 speed_template_16_24_32[] = {16, 24, 32, 0};
  48. static u8 speed_template_32_40_48[] = {32, 40, 48, 0};
  49. static u8 speed_template_32_48_64[] = {32, 48, 64, 0};
  50. /*
  51. * Digest speed tests
  52. */
  53. static struct hash_speed generic_hash_speed_template[] = {
  54. { .blen = 16, .plen = 16, },
  55. { .blen = 64, .plen = 16, },
  56. { .blen = 64, .plen = 64, },
  57. { .blen = 256, .plen = 16, },
  58. { .blen = 256, .plen = 64, },
  59. { .blen = 256, .plen = 256, },
  60. { .blen = 1024, .plen = 16, },
  61. { .blen = 1024, .plen = 256, },
  62. { .blen = 1024, .plen = 1024, },
  63. { .blen = 2048, .plen = 16, },
  64. { .blen = 2048, .plen = 256, },
  65. { .blen = 2048, .plen = 1024, },
  66. { .blen = 2048, .plen = 2048, },
  67. { .blen = 4096, .plen = 16, },
  68. { .blen = 4096, .plen = 256, },
  69. { .blen = 4096, .plen = 1024, },
  70. { .blen = 4096, .plen = 4096, },
  71. { .blen = 8192, .plen = 16, },
  72. { .blen = 8192, .plen = 256, },
  73. { .blen = 8192, .plen = 1024, },
  74. { .blen = 8192, .plen = 4096, },
  75. { .blen = 8192, .plen = 8192, },
  76. /* End marker */
  77. { .blen = 0, .plen = 0, }
  78. };
  79. static struct hash_speed hash_speed_template_16[] = {
  80. { .blen = 16, .plen = 16, .klen = 16, },
  81. { .blen = 64, .plen = 16, .klen = 16, },
  82. { .blen = 64, .plen = 64, .klen = 16, },
  83. { .blen = 256, .plen = 16, .klen = 16, },
  84. { .blen = 256, .plen = 64, .klen = 16, },
  85. { .blen = 256, .plen = 256, .klen = 16, },
  86. { .blen = 1024, .plen = 16, .klen = 16, },
  87. { .blen = 1024, .plen = 256, .klen = 16, },
  88. { .blen = 1024, .plen = 1024, .klen = 16, },
  89. { .blen = 2048, .plen = 16, .klen = 16, },
  90. { .blen = 2048, .plen = 256, .klen = 16, },
  91. { .blen = 2048, .plen = 1024, .klen = 16, },
  92. { .blen = 2048, .plen = 2048, .klen = 16, },
  93. { .blen = 4096, .plen = 16, .klen = 16, },
  94. { .blen = 4096, .plen = 256, .klen = 16, },
  95. { .blen = 4096, .plen = 1024, .klen = 16, },
  96. { .blen = 4096, .plen = 4096, .klen = 16, },
  97. { .blen = 8192, .plen = 16, .klen = 16, },
  98. { .blen = 8192, .plen = 256, .klen = 16, },
  99. { .blen = 8192, .plen = 1024, .klen = 16, },
  100. { .blen = 8192, .plen = 4096, .klen = 16, },
  101. { .blen = 8192, .plen = 8192, .klen = 16, },
  102. /* End marker */
  103. { .blen = 0, .plen = 0, .klen = 0, }
  104. };
  105. #endif /* _CRYPTO_TCRYPT_H */