pkcs7_parser.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* PKCS#7 crypto data parser internal definitions
  2. *
  3. * Copyright (C) 2012 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. #include <linux/oid_registry.h>
  12. #include <crypto/pkcs7.h>
  13. #include "x509_parser.h"
  14. #define kenter(FMT, ...) \
  15. pr_devel("==> %s("FMT")\n", __func__, ##__VA_ARGS__)
  16. #define kleave(FMT, ...) \
  17. pr_devel("<== %s()"FMT"\n", __func__, ##__VA_ARGS__)
  18. struct pkcs7_signed_info {
  19. struct pkcs7_signed_info *next;
  20. struct x509_certificate *signer; /* Signing certificate (in msg->certs) */
  21. unsigned index;
  22. bool unsupported_crypto; /* T if not usable due to missing crypto */
  23. bool blacklisted;
  24. /* Message digest - the digest of the Content Data (or NULL) */
  25. const void *msgdigest;
  26. unsigned msgdigest_len;
  27. /* Authenticated Attribute data (or NULL) */
  28. unsigned authattrs_len;
  29. const void *authattrs;
  30. unsigned long aa_set;
  31. #define sinfo_has_content_type 0
  32. #define sinfo_has_signing_time 1
  33. #define sinfo_has_message_digest 2
  34. #define sinfo_has_smime_caps 3
  35. #define sinfo_has_ms_opus_info 4
  36. #define sinfo_has_ms_statement_type 5
  37. time64_t signing_time;
  38. /* Message signature.
  39. *
  40. * This contains the generated digest of _either_ the Content Data or
  41. * the Authenticated Attributes [RFC2315 9.3]. If the latter, one of
  42. * the attributes contains the digest of the the Content Data within
  43. * it.
  44. *
  45. * THis also contains the issuing cert serial number and issuer's name
  46. * [PKCS#7 or CMS ver 1] or issuing cert's SKID [CMS ver 3].
  47. */
  48. struct public_key_signature *sig;
  49. };
  50. struct pkcs7_message {
  51. struct x509_certificate *certs; /* Certificate list */
  52. struct x509_certificate *crl; /* Revocation list */
  53. struct pkcs7_signed_info *signed_infos;
  54. u8 version; /* Version of cert (1 -> PKCS#7 or CMS; 3 -> CMS) */
  55. bool have_authattrs; /* T if have authattrs */
  56. /* Content Data (or NULL) */
  57. enum OID data_type; /* Type of Data */
  58. size_t data_len; /* Length of Data */
  59. size_t data_hdrlen; /* Length of Data ASN.1 header */
  60. const void *data; /* Content Data (or 0) */
  61. };