pkcs7_parser.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. /* Message digest - the digest of the Content Data (or NULL) */
  24. const void *msgdigest;
  25. unsigned msgdigest_len;
  26. /* Authenticated Attribute data (or NULL) */
  27. unsigned authattrs_len;
  28. const void *authattrs;
  29. unsigned long aa_set;
  30. #define sinfo_has_content_type 0
  31. #define sinfo_has_signing_time 1
  32. #define sinfo_has_message_digest 2
  33. #define sinfo_has_smime_caps 3
  34. #define sinfo_has_ms_opus_info 4
  35. #define sinfo_has_ms_statement_type 5
  36. time64_t signing_time;
  37. /* Message signature.
  38. *
  39. * This contains the generated digest of _either_ the Content Data or
  40. * the Authenticated Attributes [RFC2315 9.3]. If the latter, one of
  41. * the attributes contains the digest of the the Content Data within
  42. * it.
  43. *
  44. * THis also contains the issuing cert serial number and issuer's name
  45. * [PKCS#7 or CMS ver 1] or issuing cert's SKID [CMS ver 3].
  46. */
  47. struct public_key_signature *sig;
  48. };
  49. struct pkcs7_message {
  50. struct x509_certificate *certs; /* Certificate list */
  51. struct x509_certificate *crl; /* Revocation list */
  52. struct pkcs7_signed_info *signed_infos;
  53. u8 version; /* Version of cert (1 -> PKCS#7 or CMS; 3 -> CMS) */
  54. bool have_authattrs; /* T if have authattrs */
  55. /* Content Data (or NULL) */
  56. enum OID data_type; /* Type of Data */
  57. size_t data_len; /* Length of Data */
  58. size_t data_hdrlen; /* Length of Data ASN.1 header */
  59. const void *data; /* Content Data (or 0) */
  60. };