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