ess_asn1.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include <openssl/err.h>
  10. #include <openssl/asn1t.h>
  11. #include <openssl/cms.h>
  12. #include <openssl/ess.h>
  13. #include <openssl/x509v3.h>
  14. #include "crypto/ess.h"
  15. /* ASN1 stuff for ESS Structure */
  16. ASN1_SEQUENCE(ESS_ISSUER_SERIAL) = {
  17. ASN1_SEQUENCE_OF(ESS_ISSUER_SERIAL, issuer, GENERAL_NAME),
  18. ASN1_SIMPLE(ESS_ISSUER_SERIAL, serial, ASN1_INTEGER)
  19. } static_ASN1_SEQUENCE_END(ESS_ISSUER_SERIAL)
  20. IMPLEMENT_ASN1_FUNCTIONS(ESS_ISSUER_SERIAL)
  21. IMPLEMENT_ASN1_DUP_FUNCTION(ESS_ISSUER_SERIAL)
  22. ASN1_SEQUENCE(ESS_CERT_ID) = {
  23. ASN1_SIMPLE(ESS_CERT_ID, hash, ASN1_OCTET_STRING),
  24. ASN1_OPT(ESS_CERT_ID, issuer_serial, ESS_ISSUER_SERIAL)
  25. } static_ASN1_SEQUENCE_END(ESS_CERT_ID)
  26. IMPLEMENT_ASN1_FUNCTIONS(ESS_CERT_ID)
  27. IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID)
  28. ASN1_SEQUENCE(ESS_SIGNING_CERT) = {
  29. ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID),
  30. ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO)
  31. } ASN1_SEQUENCE_END(ESS_SIGNING_CERT)
  32. IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT)
  33. IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT)
  34. ASN1_SEQUENCE(ESS_CERT_ID_V2) = {
  35. ASN1_OPT(ESS_CERT_ID_V2, hash_alg, X509_ALGOR),
  36. ASN1_SIMPLE(ESS_CERT_ID_V2, hash, ASN1_OCTET_STRING),
  37. ASN1_OPT(ESS_CERT_ID_V2, issuer_serial, ESS_ISSUER_SERIAL)
  38. } static_ASN1_SEQUENCE_END(ESS_CERT_ID_V2)
  39. IMPLEMENT_ASN1_FUNCTIONS(ESS_CERT_ID_V2)
  40. IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID_V2)
  41. ASN1_SEQUENCE(ESS_SIGNING_CERT_V2) = {
  42. ASN1_SEQUENCE_OF(ESS_SIGNING_CERT_V2, cert_ids, ESS_CERT_ID_V2),
  43. ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT_V2, policy_info, POLICYINFO)
  44. } ASN1_SEQUENCE_END(ESS_SIGNING_CERT_V2)
  45. IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT_V2)
  46. IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT_V2)