x509_ext.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (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/stack.h>
  12. #include <openssl/asn1.h>
  13. #include <openssl/objects.h>
  14. #include <openssl/evp.h>
  15. #include <openssl/x509.h>
  16. #include "internal/x509_int.h"
  17. #include <openssl/x509v3.h>
  18. int X509_CRL_get_ext_count(const X509_CRL *x)
  19. {
  20. return (X509v3_get_ext_count(x->crl.extensions));
  21. }
  22. int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos)
  23. {
  24. return (X509v3_get_ext_by_NID(x->crl.extensions, nid, lastpos));
  25. }
  26. int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,
  27. int lastpos)
  28. {
  29. return (X509v3_get_ext_by_OBJ(x->crl.extensions, obj, lastpos));
  30. }
  31. int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos)
  32. {
  33. return (X509v3_get_ext_by_critical(x->crl.extensions, crit, lastpos));
  34. }
  35. X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc)
  36. {
  37. return (X509v3_get_ext(x->crl.extensions, loc));
  38. }
  39. X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc)
  40. {
  41. return (X509v3_delete_ext(x->crl.extensions, loc));
  42. }
  43. void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
  44. {
  45. return X509V3_get_d2i(x->crl.extensions, nid, crit, idx);
  46. }
  47. int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
  48. unsigned long flags)
  49. {
  50. return X509V3_add1_i2d(&x->crl.extensions, nid, value, crit, flags);
  51. }
  52. int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc)
  53. {
  54. return (X509v3_add_ext(&(x->crl.extensions), ex, loc) != NULL);
  55. }
  56. int X509_get_ext_count(const X509 *x)
  57. {
  58. return (X509v3_get_ext_count(x->cert_info.extensions));
  59. }
  60. int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos)
  61. {
  62. return (X509v3_get_ext_by_NID(x->cert_info.extensions, nid, lastpos));
  63. }
  64. int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos)
  65. {
  66. return (X509v3_get_ext_by_OBJ(x->cert_info.extensions, obj, lastpos));
  67. }
  68. int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos)
  69. {
  70. return (X509v3_get_ext_by_critical
  71. (x->cert_info.extensions, crit, lastpos));
  72. }
  73. X509_EXTENSION *X509_get_ext(const X509 *x, int loc)
  74. {
  75. return (X509v3_get_ext(x->cert_info.extensions, loc));
  76. }
  77. X509_EXTENSION *X509_delete_ext(X509 *x, int loc)
  78. {
  79. return (X509v3_delete_ext(x->cert_info.extensions, loc));
  80. }
  81. int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc)
  82. {
  83. return (X509v3_add_ext(&(x->cert_info.extensions), ex, loc) != NULL);
  84. }
  85. void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx)
  86. {
  87. return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);
  88. }
  89. int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
  90. unsigned long flags)
  91. {
  92. return X509V3_add1_i2d(&x->cert_info.extensions, nid, value, crit,
  93. flags);
  94. }
  95. int X509_REVOKED_get_ext_count(const X509_REVOKED *x)
  96. {
  97. return (X509v3_get_ext_count(x->extensions));
  98. }
  99. int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos)
  100. {
  101. return (X509v3_get_ext_by_NID(x->extensions, nid, lastpos));
  102. }
  103. int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
  104. int lastpos)
  105. {
  106. return (X509v3_get_ext_by_OBJ(x->extensions, obj, lastpos));
  107. }
  108. int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, int lastpos)
  109. {
  110. return (X509v3_get_ext_by_critical(x->extensions, crit, lastpos));
  111. }
  112. X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc)
  113. {
  114. return (X509v3_get_ext(x->extensions, loc));
  115. }
  116. X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc)
  117. {
  118. return (X509v3_delete_ext(x->extensions, loc));
  119. }
  120. int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc)
  121. {
  122. return (X509v3_add_ext(&(x->extensions), ex, loc) != NULL);
  123. }
  124. void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, int *idx)
  125. {
  126. return X509V3_get_d2i(x->extensions, nid, crit, idx);
  127. }
  128. int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
  129. unsigned long flags)
  130. {
  131. return X509V3_add1_i2d(&x->extensions, nid, value, crit, flags);
  132. }