verification.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Signature verification
  2. *
  3. * Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _LINUX_VERIFICATION_H
  12. #define _LINUX_VERIFICATION_H
  13. /*
  14. * Indicate that both builtin trusted keys and secondary trusted keys
  15. * should be used.
  16. */
  17. #define VERIFY_USE_SECONDARY_KEYRING ((struct key *)1UL)
  18. /*
  19. * The use to which an asymmetric key is being put.
  20. */
  21. enum key_being_used_for {
  22. VERIFYING_MODULE_SIGNATURE,
  23. VERIFYING_FIRMWARE_SIGNATURE,
  24. VERIFYING_KEXEC_PE_SIGNATURE,
  25. VERIFYING_KEY_SIGNATURE,
  26. VERIFYING_KEY_SELF_SIGNATURE,
  27. VERIFYING_UNSPECIFIED_SIGNATURE,
  28. NR__KEY_BEING_USED_FOR
  29. };
  30. extern const char *const key_being_used_for[NR__KEY_BEING_USED_FOR];
  31. #ifdef CONFIG_SYSTEM_DATA_VERIFICATION
  32. struct key;
  33. extern int verify_pkcs7_signature(const void *data, size_t len,
  34. const void *raw_pkcs7, size_t pkcs7_len,
  35. struct key *trusted_keys,
  36. enum key_being_used_for usage,
  37. int (*view_content)(void *ctx,
  38. const void *data, size_t len,
  39. size_t asn1hdrlen),
  40. void *ctx);
  41. #ifdef CONFIG_SIGNED_PE_FILE_VERIFICATION
  42. extern int verify_pefile_signature(const void *pebuf, unsigned pelen,
  43. struct key *trusted_keys,
  44. enum key_being_used_for usage);
  45. #endif
  46. #endif /* CONFIG_SYSTEM_DATA_VERIFICATION */
  47. #endif /* _LINUX_VERIFY_PEFILE_H */