keyctl.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* keyctl kernel bits
  3. *
  4. * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  5. * Written by David Howells (dhowells@redhat.com)
  6. */
  7. #ifndef __LINUX_KEYCTL_H
  8. #define __LINUX_KEYCTL_H
  9. #include <uapi/linux/keyctl.h>
  10. struct kernel_pkey_query {
  11. __u32 supported_ops; /* Which ops are supported */
  12. __u32 key_size; /* Size of the key in bits */
  13. __u16 max_data_size; /* Maximum size of raw data to sign in bytes */
  14. __u16 max_sig_size; /* Maximum size of signature in bytes */
  15. __u16 max_enc_size; /* Maximum size of encrypted blob in bytes */
  16. __u16 max_dec_size; /* Maximum size of decrypted blob in bytes */
  17. };
  18. enum kernel_pkey_operation {
  19. kernel_pkey_encrypt,
  20. kernel_pkey_decrypt,
  21. kernel_pkey_sign,
  22. kernel_pkey_verify,
  23. };
  24. struct kernel_pkey_params {
  25. struct key *key;
  26. const char *encoding; /* Encoding (eg. "oaep" or "raw" for none) */
  27. const char *hash_algo; /* Digest algorithm used (eg. "sha1") or NULL if N/A */
  28. char *info; /* Modified info string to be released later */
  29. __u32 in_len; /* Input data size */
  30. union {
  31. __u32 out_len; /* Output buffer size (enc/dec/sign) */
  32. __u32 in2_len; /* 2nd input data size (verify) */
  33. };
  34. enum kernel_pkey_operation op : 8;
  35. };
  36. #endif /* __LINUX_KEYCTL_H */