v3_no_ass.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright 2023 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 <stdio.h>
  10. #include "internal/cryptlib.h"
  11. #include <openssl/asn1.h>
  12. #include <openssl/asn1t.h>
  13. #include <openssl/x509v3.h>
  14. #include "ext_dat.h"
  15. static int i2r_NO_ASSERTION(X509V3_EXT_METHOD *method,
  16. void *su, BIO *out,
  17. int indent)
  18. {
  19. return 1;
  20. }
  21. static void *r2i_NO_ASSERTION(X509V3_EXT_METHOD *method,
  22. X509V3_CTX *ctx, const char *value)
  23. {
  24. return ASN1_NULL_new();
  25. }
  26. static char *i2s_NO_ASSERTION(const X509V3_EXT_METHOD *method, void *val)
  27. {
  28. return OPENSSL_strdup("NULL");
  29. }
  30. static void *s2i_NO_ASSERTION(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str)
  31. {
  32. return ASN1_NULL_new();
  33. }
  34. /*
  35. * The noAssertion X.509v3 extension is defined in ITU Recommendation X.509
  36. * (2019), Section 17.5.2.7. See: https://www.itu.int/rec/T-REC-X.509-201910-I/en.
  37. */
  38. const X509V3_EXT_METHOD ossl_v3_no_assertion = {
  39. NID_no_assertion, 0, ASN1_ITEM_ref(ASN1_NULL),
  40. 0, 0, 0, 0,
  41. (X509V3_EXT_I2S)i2s_NO_ASSERTION,
  42. (X509V3_EXT_S2I)s2i_NO_ASSERTION,
  43. 0, 0,
  44. (X509V3_EXT_I2R)i2r_NO_ASSERTION,
  45. (X509V3_EXT_R2I)r2i_NO_ASSERTION,
  46. NULL
  47. };