cryptouser.h 3.3 KB

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