pkcs7_parser.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 trusted;
  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. /* Issuing cert serial number and issuer's name */
  30. const void *raw_serial;
  31. unsigned raw_serial_size;
  32. unsigned raw_issuer_size;
  33. const void *raw_issuer;
  34. /* Message signature.
  35. *
  36. * This contains the generated digest of _either_ the Content Data or
  37. * the Authenticated Attributes [RFC2315 9.3]. If the latter, one of
  38. * the attributes contains the digest of the the Content Data within
  39. * it.
  40. */
  41. struct public_key_signature sig;
  42. };
  43. struct pkcs7_message {
  44. struct x509_certificate *certs; /* Certificate list */
  45. struct x509_certificate *crl; /* Revocation list */
  46. struct pkcs7_signed_info *signed_infos;
  47. /* Content Data (or NULL) */
  48. enum OID data_type; /* Type of Data */
  49. size_t data_len; /* Length of Data */
  50. size_t data_hdrlen; /* Length of Data ASN.1 header */
  51. const void *data; /* Content Data (or 0) */
  52. };