cryptouser.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Crypto user configuration API.
  3. *
  4. * Copyright (C) 2011 secunet Security Networks AG
  5. * Copyright (C) 2011 Steffen Klassert <steffen.klassert@secunet.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms and conditions of the GNU General Public License,
  9. * version 2, as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. * more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along with
  17. * this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  19. */
  20. /* Netlink configuration messages. */
  21. enum {
  22. CRYPTO_MSG_BASE = 0x10,
  23. CRYPTO_MSG_NEWALG = 0x10,
  24. CRYPTO_MSG_DELALG,
  25. CRYPTO_MSG_UPDATEALG,
  26. CRYPTO_MSG_GETALG,
  27. __CRYPTO_MSG_MAX
  28. };
  29. #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
  30. #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
  31. #define CRYPTO_MAX_NAME CRYPTO_MAX_ALG_NAME
  32. /* Netlink message attributes. */
  33. enum crypto_attr_type_t {
  34. CRYPTOCFGA_UNSPEC,
  35. CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
  36. CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
  37. CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
  38. CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
  39. CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
  40. CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
  41. CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
  42. CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
  43. __CRYPTOCFGA_MAX
  44. #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
  45. };
  46. struct crypto_user_alg {
  47. char cru_name[CRYPTO_MAX_ALG_NAME];
  48. char cru_driver_name[CRYPTO_MAX_ALG_NAME];
  49. char cru_module_name[CRYPTO_MAX_ALG_NAME];
  50. __u32 cru_type;
  51. __u32 cru_mask;
  52. __u32 cru_refcnt;
  53. __u32 cru_flags;
  54. };
  55. struct crypto_report_larval {
  56. char type[CRYPTO_MAX_NAME];
  57. };
  58. struct crypto_report_hash {
  59. char type[CRYPTO_MAX_NAME];
  60. unsigned int blocksize;
  61. unsigned int digestsize;
  62. };
  63. struct crypto_report_cipher {
  64. char type[CRYPTO_MAX_ALG_NAME];
  65. unsigned int blocksize;
  66. unsigned int min_keysize;
  67. unsigned int max_keysize;
  68. };
  69. struct crypto_report_blkcipher {
  70. char type[CRYPTO_MAX_NAME];
  71. char geniv[CRYPTO_MAX_NAME];
  72. unsigned int blocksize;
  73. unsigned int min_keysize;
  74. unsigned int max_keysize;
  75. unsigned int ivsize;
  76. };
  77. struct crypto_report_aead {
  78. char type[CRYPTO_MAX_NAME];
  79. char geniv[CRYPTO_MAX_NAME];
  80. unsigned int blocksize;
  81. unsigned int maxauthsize;
  82. unsigned int ivsize;
  83. };
  84. struct crypto_report_comp {
  85. char type[CRYPTO_MAX_NAME];
  86. };
  87. struct crypto_report_rng {
  88. char type[CRYPTO_MAX_NAME];
  89. unsigned int seedsize;
  90. };
  91. #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
  92. sizeof(struct crypto_report_blkcipher))