cryptouser.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. #ifndef _LINUX_CRYPTOUSER_H
  22. #define _LINUX_CRYPTOUSER_H
  23. #include <linux/types.h>
  24. /* Netlink configuration messages. */
  25. enum {
  26. CRYPTO_MSG_BASE = 0x10,
  27. CRYPTO_MSG_NEWALG = 0x10,
  28. CRYPTO_MSG_DELALG,
  29. CRYPTO_MSG_UPDATEALG,
  30. CRYPTO_MSG_GETALG,
  31. CRYPTO_MSG_DELRNG,
  32. CRYPTO_MSG_GETSTAT,
  33. __CRYPTO_MSG_MAX
  34. };
  35. #define CRYPTO_MSG_MAX (__CRYPTO_MSG_MAX - 1)
  36. #define CRYPTO_NR_MSGTYPES (CRYPTO_MSG_MAX + 1 - CRYPTO_MSG_BASE)
  37. #define CRYPTO_MAX_NAME 64
  38. /* Netlink message attributes. */
  39. enum crypto_attr_type_t {
  40. CRYPTOCFGA_UNSPEC,
  41. CRYPTOCFGA_PRIORITY_VAL, /* __u32 */
  42. CRYPTOCFGA_REPORT_LARVAL, /* struct crypto_report_larval */
  43. CRYPTOCFGA_REPORT_HASH, /* struct crypto_report_hash */
  44. CRYPTOCFGA_REPORT_BLKCIPHER, /* struct crypto_report_blkcipher */
  45. CRYPTOCFGA_REPORT_AEAD, /* struct crypto_report_aead */
  46. CRYPTOCFGA_REPORT_COMPRESS, /* struct crypto_report_comp */
  47. CRYPTOCFGA_REPORT_RNG, /* struct crypto_report_rng */
  48. CRYPTOCFGA_REPORT_CIPHER, /* struct crypto_report_cipher */
  49. CRYPTOCFGA_REPORT_AKCIPHER, /* struct crypto_report_akcipher */
  50. CRYPTOCFGA_REPORT_KPP, /* struct crypto_report_kpp */
  51. CRYPTOCFGA_REPORT_ACOMP, /* struct crypto_report_acomp */
  52. CRYPTOCFGA_STAT_LARVAL, /* struct crypto_stat */
  53. CRYPTOCFGA_STAT_HASH, /* struct crypto_stat */
  54. CRYPTOCFGA_STAT_BLKCIPHER, /* struct crypto_stat */
  55. CRYPTOCFGA_STAT_AEAD, /* struct crypto_stat */
  56. CRYPTOCFGA_STAT_COMPRESS, /* struct crypto_stat */
  57. CRYPTOCFGA_STAT_RNG, /* struct crypto_stat */
  58. CRYPTOCFGA_STAT_CIPHER, /* struct crypto_stat */
  59. CRYPTOCFGA_STAT_AKCIPHER, /* struct crypto_stat */
  60. CRYPTOCFGA_STAT_KPP, /* struct crypto_stat */
  61. CRYPTOCFGA_STAT_ACOMP, /* struct crypto_stat */
  62. __CRYPTOCFGA_MAX
  63. #define CRYPTOCFGA_MAX (__CRYPTOCFGA_MAX - 1)
  64. };
  65. struct crypto_user_alg {
  66. char cru_name[CRYPTO_MAX_NAME];
  67. char cru_driver_name[CRYPTO_MAX_NAME];
  68. char cru_module_name[CRYPTO_MAX_NAME];
  69. __u32 cru_type;
  70. __u32 cru_mask;
  71. __u32 cru_refcnt;
  72. __u32 cru_flags;
  73. };
  74. struct crypto_stat_aead {
  75. char type[CRYPTO_MAX_NAME];
  76. __u64 stat_encrypt_cnt;
  77. __u64 stat_encrypt_tlen;
  78. __u64 stat_decrypt_cnt;
  79. __u64 stat_decrypt_tlen;
  80. __u64 stat_err_cnt;
  81. };
  82. struct crypto_stat_akcipher {
  83. char type[CRYPTO_MAX_NAME];
  84. __u64 stat_encrypt_cnt;
  85. __u64 stat_encrypt_tlen;
  86. __u64 stat_decrypt_cnt;
  87. __u64 stat_decrypt_tlen;
  88. __u64 stat_verify_cnt;
  89. __u64 stat_sign_cnt;
  90. __u64 stat_err_cnt;
  91. };
  92. struct crypto_stat_cipher {
  93. char type[CRYPTO_MAX_NAME];
  94. __u64 stat_encrypt_cnt;
  95. __u64 stat_encrypt_tlen;
  96. __u64 stat_decrypt_cnt;
  97. __u64 stat_decrypt_tlen;
  98. __u64 stat_err_cnt;
  99. };
  100. struct crypto_stat_compress {
  101. char type[CRYPTO_MAX_NAME];
  102. __u64 stat_compress_cnt;
  103. __u64 stat_compress_tlen;
  104. __u64 stat_decompress_cnt;
  105. __u64 stat_decompress_tlen;
  106. __u64 stat_err_cnt;
  107. };
  108. struct crypto_stat_hash {
  109. char type[CRYPTO_MAX_NAME];
  110. __u64 stat_hash_cnt;
  111. __u64 stat_hash_tlen;
  112. __u64 stat_err_cnt;
  113. };
  114. struct crypto_stat_kpp {
  115. char type[CRYPTO_MAX_NAME];
  116. __u64 stat_setsecret_cnt;
  117. __u64 stat_generate_public_key_cnt;
  118. __u64 stat_compute_shared_secret_cnt;
  119. __u64 stat_err_cnt;
  120. };
  121. struct crypto_stat_rng {
  122. char type[CRYPTO_MAX_NAME];
  123. __u64 stat_generate_cnt;
  124. __u64 stat_generate_tlen;
  125. __u64 stat_seed_cnt;
  126. __u64 stat_err_cnt;
  127. };
  128. struct crypto_stat_larval {
  129. char type[CRYPTO_MAX_NAME];
  130. };
  131. struct crypto_report_larval {
  132. char type[CRYPTO_MAX_NAME];
  133. };
  134. struct crypto_report_hash {
  135. char type[CRYPTO_MAX_NAME];
  136. unsigned int blocksize;
  137. unsigned int digestsize;
  138. };
  139. struct crypto_report_cipher {
  140. char type[CRYPTO_MAX_NAME];
  141. unsigned int blocksize;
  142. unsigned int min_keysize;
  143. unsigned int max_keysize;
  144. };
  145. struct crypto_report_blkcipher {
  146. char type[CRYPTO_MAX_NAME];
  147. char geniv[CRYPTO_MAX_NAME];
  148. unsigned int blocksize;
  149. unsigned int min_keysize;
  150. unsigned int max_keysize;
  151. unsigned int ivsize;
  152. };
  153. struct crypto_report_aead {
  154. char type[CRYPTO_MAX_NAME];
  155. char geniv[CRYPTO_MAX_NAME];
  156. unsigned int blocksize;
  157. unsigned int maxauthsize;
  158. unsigned int ivsize;
  159. };
  160. struct crypto_report_comp {
  161. char type[CRYPTO_MAX_NAME];
  162. };
  163. struct crypto_report_rng {
  164. char type[CRYPTO_MAX_NAME];
  165. unsigned int seedsize;
  166. };
  167. struct crypto_report_akcipher {
  168. char type[CRYPTO_MAX_NAME];
  169. };
  170. struct crypto_report_kpp {
  171. char type[CRYPTO_MAX_NAME];
  172. };
  173. struct crypto_report_acomp {
  174. char type[CRYPTO_MAX_NAME];
  175. };
  176. #define CRYPTO_REPORT_MAXSIZE (sizeof(struct crypto_user_alg) + \
  177. sizeof(struct crypto_report_blkcipher))
  178. #endif /* _LINUX_CRYPTOUSER_H */