File indexing completed on 2025-01-18 10:05:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef OPENSSL_OCSP_H
0016 # define OPENSSL_OCSP_H
0017 # pragma once
0018
0019 # include <openssl/macros.h>
0020 # ifndef OPENSSL_NO_DEPRECATED_3_0
0021 # define HEADER_OCSP_H
0022 # endif
0023
0024 # include <openssl/opensslconf.h>
0025 # include <openssl/http.h>
0026 # include <openssl/asn1.h>
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 # define OCSP_REVOKED_STATUS_NOSTATUS -1
0048 # define OCSP_REVOKED_STATUS_UNSPECIFIED 0
0049 # define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1
0050 # define OCSP_REVOKED_STATUS_CACOMPROMISE 2
0051 # define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3
0052 # define OCSP_REVOKED_STATUS_SUPERSEDED 4
0053 # define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5
0054 # define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6
0055 # define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8
0056 # define OCSP_REVOKED_STATUS_PRIVILEGEWITHDRAWN 9
0057 # define OCSP_REVOKED_STATUS_AACOMPROMISE 10
0058
0059
0060 # ifndef OPENSSL_NO_OCSP
0061
0062 # include <openssl/x509.h>
0063 # include <openssl/x509v3.h>
0064 # include <openssl/safestack.h>
0065 # include <openssl/ocsperr.h>
0066
0067 # ifdef __cplusplus
0068 extern "C" {
0069 # endif
0070
0071
0072
0073 # define OCSP_DEFAULT_NONCE_LENGTH 16
0074
0075 # define OCSP_NOCERTS 0x1
0076 # define OCSP_NOINTERN 0x2
0077 # define OCSP_NOSIGS 0x4
0078 # define OCSP_NOCHAIN 0x8
0079 # define OCSP_NOVERIFY 0x10
0080 # define OCSP_NOEXPLICIT 0x20
0081 # define OCSP_NOCASIGN 0x40
0082 # define OCSP_NODELEGATED 0x80
0083 # define OCSP_NOCHECKS 0x100
0084 # define OCSP_TRUSTOTHER 0x200
0085 # define OCSP_RESPID_KEY 0x400
0086 # define OCSP_NOTIME 0x800
0087 # define OCSP_PARTIAL_CHAIN 0x1000
0088
0089 typedef struct ocsp_cert_id_st OCSP_CERTID;
0090 typedef struct ocsp_one_request_st OCSP_ONEREQ;
0091 typedef struct ocsp_req_info_st OCSP_REQINFO;
0092 typedef struct ocsp_signature_st OCSP_SIGNATURE;
0093 typedef struct ocsp_request_st OCSP_REQUEST;
0094
0095 SKM_DEFINE_STACK_OF_INTERNAL(OCSP_CERTID, OCSP_CERTID, OCSP_CERTID)
0096 #define sk_OCSP_CERTID_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_CERTID_sk_type(sk))
0097 #define sk_OCSP_CERTID_value(sk, idx) ((OCSP_CERTID *)OPENSSL_sk_value(ossl_check_const_OCSP_CERTID_sk_type(sk), (idx)))
0098 #define sk_OCSP_CERTID_new(cmp) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_new(ossl_check_OCSP_CERTID_compfunc_type(cmp)))
0099 #define sk_OCSP_CERTID_new_null() ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_new_null())
0100 #define sk_OCSP_CERTID_new_reserve(cmp, n) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_CERTID_compfunc_type(cmp), (n)))
0101 #define sk_OCSP_CERTID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_CERTID_sk_type(sk), (n))
0102 #define sk_OCSP_CERTID_free(sk) OPENSSL_sk_free(ossl_check_OCSP_CERTID_sk_type(sk))
0103 #define sk_OCSP_CERTID_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_CERTID_sk_type(sk))
0104 #define sk_OCSP_CERTID_delete(sk, i) ((OCSP_CERTID *)OPENSSL_sk_delete(ossl_check_OCSP_CERTID_sk_type(sk), (i)))
0105 #define sk_OCSP_CERTID_delete_ptr(sk, ptr) ((OCSP_CERTID *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr)))
0106 #define sk_OCSP_CERTID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr))
0107 #define sk_OCSP_CERTID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr))
0108 #define sk_OCSP_CERTID_pop(sk) ((OCSP_CERTID *)OPENSSL_sk_pop(ossl_check_OCSP_CERTID_sk_type(sk)))
0109 #define sk_OCSP_CERTID_shift(sk) ((OCSP_CERTID *)OPENSSL_sk_shift(ossl_check_OCSP_CERTID_sk_type(sk)))
0110 #define sk_OCSP_CERTID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_CERTID_sk_type(sk),ossl_check_OCSP_CERTID_freefunc_type(freefunc))
0111 #define sk_OCSP_CERTID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr), (idx))
0112 #define sk_OCSP_CERTID_set(sk, idx, ptr) ((OCSP_CERTID *)OPENSSL_sk_set(ossl_check_OCSP_CERTID_sk_type(sk), (idx), ossl_check_OCSP_CERTID_type(ptr)))
0113 #define sk_OCSP_CERTID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr))
0114 #define sk_OCSP_CERTID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr))
0115 #define sk_OCSP_CERTID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_type(ptr), pnum)
0116 #define sk_OCSP_CERTID_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_CERTID_sk_type(sk))
0117 #define sk_OCSP_CERTID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_CERTID_sk_type(sk))
0118 #define sk_OCSP_CERTID_dup(sk) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_dup(ossl_check_const_OCSP_CERTID_sk_type(sk)))
0119 #define sk_OCSP_CERTID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_CERTID) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_copyfunc_type(copyfunc), ossl_check_OCSP_CERTID_freefunc_type(freefunc)))
0120 #define sk_OCSP_CERTID_set_cmp_func(sk, cmp) ((sk_OCSP_CERTID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_CERTID_sk_type(sk), ossl_check_OCSP_CERTID_compfunc_type(cmp)))
0121 SKM_DEFINE_STACK_OF_INTERNAL(OCSP_ONEREQ, OCSP_ONEREQ, OCSP_ONEREQ)
0122 #define sk_OCSP_ONEREQ_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_ONEREQ_sk_type(sk))
0123 #define sk_OCSP_ONEREQ_value(sk, idx) ((OCSP_ONEREQ *)OPENSSL_sk_value(ossl_check_const_OCSP_ONEREQ_sk_type(sk), (idx)))
0124 #define sk_OCSP_ONEREQ_new(cmp) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_new(ossl_check_OCSP_ONEREQ_compfunc_type(cmp)))
0125 #define sk_OCSP_ONEREQ_new_null() ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_new_null())
0126 #define sk_OCSP_ONEREQ_new_reserve(cmp, n) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_ONEREQ_compfunc_type(cmp), (n)))
0127 #define sk_OCSP_ONEREQ_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_ONEREQ_sk_type(sk), (n))
0128 #define sk_OCSP_ONEREQ_free(sk) OPENSSL_sk_free(ossl_check_OCSP_ONEREQ_sk_type(sk))
0129 #define sk_OCSP_ONEREQ_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_ONEREQ_sk_type(sk))
0130 #define sk_OCSP_ONEREQ_delete(sk, i) ((OCSP_ONEREQ *)OPENSSL_sk_delete(ossl_check_OCSP_ONEREQ_sk_type(sk), (i)))
0131 #define sk_OCSP_ONEREQ_delete_ptr(sk, ptr) ((OCSP_ONEREQ *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr)))
0132 #define sk_OCSP_ONEREQ_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr))
0133 #define sk_OCSP_ONEREQ_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr))
0134 #define sk_OCSP_ONEREQ_pop(sk) ((OCSP_ONEREQ *)OPENSSL_sk_pop(ossl_check_OCSP_ONEREQ_sk_type(sk)))
0135 #define sk_OCSP_ONEREQ_shift(sk) ((OCSP_ONEREQ *)OPENSSL_sk_shift(ossl_check_OCSP_ONEREQ_sk_type(sk)))
0136 #define sk_OCSP_ONEREQ_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_ONEREQ_sk_type(sk),ossl_check_OCSP_ONEREQ_freefunc_type(freefunc))
0137 #define sk_OCSP_ONEREQ_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr), (idx))
0138 #define sk_OCSP_ONEREQ_set(sk, idx, ptr) ((OCSP_ONEREQ *)OPENSSL_sk_set(ossl_check_OCSP_ONEREQ_sk_type(sk), (idx), ossl_check_OCSP_ONEREQ_type(ptr)))
0139 #define sk_OCSP_ONEREQ_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr))
0140 #define sk_OCSP_ONEREQ_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr))
0141 #define sk_OCSP_ONEREQ_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_type(ptr), pnum)
0142 #define sk_OCSP_ONEREQ_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_ONEREQ_sk_type(sk))
0143 #define sk_OCSP_ONEREQ_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_ONEREQ_sk_type(sk))
0144 #define sk_OCSP_ONEREQ_dup(sk) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_dup(ossl_check_const_OCSP_ONEREQ_sk_type(sk)))
0145 #define sk_OCSP_ONEREQ_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_ONEREQ) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_copyfunc_type(copyfunc), ossl_check_OCSP_ONEREQ_freefunc_type(freefunc)))
0146 #define sk_OCSP_ONEREQ_set_cmp_func(sk, cmp) ((sk_OCSP_ONEREQ_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_ONEREQ_sk_type(sk), ossl_check_OCSP_ONEREQ_compfunc_type(cmp)))
0147
0148
0149 # define OCSP_RESPONSE_STATUS_SUCCESSFUL 0
0150 # define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1
0151 # define OCSP_RESPONSE_STATUS_INTERNALERROR 2
0152 # define OCSP_RESPONSE_STATUS_TRYLATER 3
0153 # define OCSP_RESPONSE_STATUS_SIGREQUIRED 5
0154 # define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6
0155
0156 typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES;
0157
0158 # define V_OCSP_RESPID_NAME 0
0159 # define V_OCSP_RESPID_KEY 1
0160
0161 SKM_DEFINE_STACK_OF_INTERNAL(OCSP_RESPID, OCSP_RESPID, OCSP_RESPID)
0162 #define sk_OCSP_RESPID_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_RESPID_sk_type(sk))
0163 #define sk_OCSP_RESPID_value(sk, idx) ((OCSP_RESPID *)OPENSSL_sk_value(ossl_check_const_OCSP_RESPID_sk_type(sk), (idx)))
0164 #define sk_OCSP_RESPID_new(cmp) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_new(ossl_check_OCSP_RESPID_compfunc_type(cmp)))
0165 #define sk_OCSP_RESPID_new_null() ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_new_null())
0166 #define sk_OCSP_RESPID_new_reserve(cmp, n) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_RESPID_compfunc_type(cmp), (n)))
0167 #define sk_OCSP_RESPID_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_RESPID_sk_type(sk), (n))
0168 #define sk_OCSP_RESPID_free(sk) OPENSSL_sk_free(ossl_check_OCSP_RESPID_sk_type(sk))
0169 #define sk_OCSP_RESPID_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_RESPID_sk_type(sk))
0170 #define sk_OCSP_RESPID_delete(sk, i) ((OCSP_RESPID *)OPENSSL_sk_delete(ossl_check_OCSP_RESPID_sk_type(sk), (i)))
0171 #define sk_OCSP_RESPID_delete_ptr(sk, ptr) ((OCSP_RESPID *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr)))
0172 #define sk_OCSP_RESPID_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr))
0173 #define sk_OCSP_RESPID_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr))
0174 #define sk_OCSP_RESPID_pop(sk) ((OCSP_RESPID *)OPENSSL_sk_pop(ossl_check_OCSP_RESPID_sk_type(sk)))
0175 #define sk_OCSP_RESPID_shift(sk) ((OCSP_RESPID *)OPENSSL_sk_shift(ossl_check_OCSP_RESPID_sk_type(sk)))
0176 #define sk_OCSP_RESPID_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_RESPID_sk_type(sk),ossl_check_OCSP_RESPID_freefunc_type(freefunc))
0177 #define sk_OCSP_RESPID_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr), (idx))
0178 #define sk_OCSP_RESPID_set(sk, idx, ptr) ((OCSP_RESPID *)OPENSSL_sk_set(ossl_check_OCSP_RESPID_sk_type(sk), (idx), ossl_check_OCSP_RESPID_type(ptr)))
0179 #define sk_OCSP_RESPID_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr))
0180 #define sk_OCSP_RESPID_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr))
0181 #define sk_OCSP_RESPID_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_type(ptr), pnum)
0182 #define sk_OCSP_RESPID_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_RESPID_sk_type(sk))
0183 #define sk_OCSP_RESPID_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_RESPID_sk_type(sk))
0184 #define sk_OCSP_RESPID_dup(sk) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_dup(ossl_check_const_OCSP_RESPID_sk_type(sk)))
0185 #define sk_OCSP_RESPID_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_RESPID) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_copyfunc_type(copyfunc), ossl_check_OCSP_RESPID_freefunc_type(freefunc)))
0186 #define sk_OCSP_RESPID_set_cmp_func(sk, cmp) ((sk_OCSP_RESPID_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_RESPID_sk_type(sk), ossl_check_OCSP_RESPID_compfunc_type(cmp)))
0187
0188
0189 typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO;
0190
0191 # define V_OCSP_CERTSTATUS_GOOD 0
0192 # define V_OCSP_CERTSTATUS_REVOKED 1
0193 # define V_OCSP_CERTSTATUS_UNKNOWN 2
0194
0195 typedef struct ocsp_cert_status_st OCSP_CERTSTATUS;
0196 typedef struct ocsp_single_response_st OCSP_SINGLERESP;
0197
0198 SKM_DEFINE_STACK_OF_INTERNAL(OCSP_SINGLERESP, OCSP_SINGLERESP, OCSP_SINGLERESP)
0199 #define sk_OCSP_SINGLERESP_num(sk) OPENSSL_sk_num(ossl_check_const_OCSP_SINGLERESP_sk_type(sk))
0200 #define sk_OCSP_SINGLERESP_value(sk, idx) ((OCSP_SINGLERESP *)OPENSSL_sk_value(ossl_check_const_OCSP_SINGLERESP_sk_type(sk), (idx)))
0201 #define sk_OCSP_SINGLERESP_new(cmp) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_new(ossl_check_OCSP_SINGLERESP_compfunc_type(cmp)))
0202 #define sk_OCSP_SINGLERESP_new_null() ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_new_null())
0203 #define sk_OCSP_SINGLERESP_new_reserve(cmp, n) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_new_reserve(ossl_check_OCSP_SINGLERESP_compfunc_type(cmp), (n)))
0204 #define sk_OCSP_SINGLERESP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_OCSP_SINGLERESP_sk_type(sk), (n))
0205 #define sk_OCSP_SINGLERESP_free(sk) OPENSSL_sk_free(ossl_check_OCSP_SINGLERESP_sk_type(sk))
0206 #define sk_OCSP_SINGLERESP_zero(sk) OPENSSL_sk_zero(ossl_check_OCSP_SINGLERESP_sk_type(sk))
0207 #define sk_OCSP_SINGLERESP_delete(sk, i) ((OCSP_SINGLERESP *)OPENSSL_sk_delete(ossl_check_OCSP_SINGLERESP_sk_type(sk), (i)))
0208 #define sk_OCSP_SINGLERESP_delete_ptr(sk, ptr) ((OCSP_SINGLERESP *)OPENSSL_sk_delete_ptr(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr)))
0209 #define sk_OCSP_SINGLERESP_push(sk, ptr) OPENSSL_sk_push(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr))
0210 #define sk_OCSP_SINGLERESP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr))
0211 #define sk_OCSP_SINGLERESP_pop(sk) ((OCSP_SINGLERESP *)OPENSSL_sk_pop(ossl_check_OCSP_SINGLERESP_sk_type(sk)))
0212 #define sk_OCSP_SINGLERESP_shift(sk) ((OCSP_SINGLERESP *)OPENSSL_sk_shift(ossl_check_OCSP_SINGLERESP_sk_type(sk)))
0213 #define sk_OCSP_SINGLERESP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_OCSP_SINGLERESP_sk_type(sk),ossl_check_OCSP_SINGLERESP_freefunc_type(freefunc))
0214 #define sk_OCSP_SINGLERESP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr), (idx))
0215 #define sk_OCSP_SINGLERESP_set(sk, idx, ptr) ((OCSP_SINGLERESP *)OPENSSL_sk_set(ossl_check_OCSP_SINGLERESP_sk_type(sk), (idx), ossl_check_OCSP_SINGLERESP_type(ptr)))
0216 #define sk_OCSP_SINGLERESP_find(sk, ptr) OPENSSL_sk_find(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr))
0217 #define sk_OCSP_SINGLERESP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr))
0218 #define sk_OCSP_SINGLERESP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_type(ptr), pnum)
0219 #define sk_OCSP_SINGLERESP_sort(sk) OPENSSL_sk_sort(ossl_check_OCSP_SINGLERESP_sk_type(sk))
0220 #define sk_OCSP_SINGLERESP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_OCSP_SINGLERESP_sk_type(sk))
0221 #define sk_OCSP_SINGLERESP_dup(sk) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_dup(ossl_check_const_OCSP_SINGLERESP_sk_type(sk)))
0222 #define sk_OCSP_SINGLERESP_deep_copy(sk, copyfunc, freefunc) ((STACK_OF(OCSP_SINGLERESP) *)OPENSSL_sk_deep_copy(ossl_check_const_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_copyfunc_type(copyfunc), ossl_check_OCSP_SINGLERESP_freefunc_type(freefunc)))
0223 #define sk_OCSP_SINGLERESP_set_cmp_func(sk, cmp) ((sk_OCSP_SINGLERESP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_OCSP_SINGLERESP_sk_type(sk), ossl_check_OCSP_SINGLERESP_compfunc_type(cmp)))
0224
0225
0226 typedef struct ocsp_response_data_st OCSP_RESPDATA;
0227
0228 typedef struct ocsp_basic_response_st OCSP_BASICRESP;
0229
0230 typedef struct ocsp_crl_id_st OCSP_CRLID;
0231 typedef struct ocsp_service_locator_st OCSP_SERVICELOC;
0232
0233 # define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
0234 # define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
0235
0236 # define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
0237
0238 # define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
0239
0240 # define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
0241 (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST, \
0242 bp,(char **)(x),cb,NULL)
0243
0244 # define PEM_read_bio_OCSP_RESPONSE(bp,x,cb) (OCSP_RESPONSE *)PEM_ASN1_read_bio(\
0245 (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE, \
0246 bp,(char **)(x),cb,NULL)
0247
0248 # define PEM_write_bio_OCSP_REQUEST(bp,o) \
0249 PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
0250 bp,(char *)(o), NULL,NULL,0,NULL,NULL)
0251
0252 # define PEM_write_bio_OCSP_RESPONSE(bp,o) \
0253 PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
0254 bp,(char *)(o), NULL,NULL,0,NULL,NULL)
0255
0256 # define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
0257
0258 # define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
0259
0260 # define ASN1_BIT_STRING_digest(data,type,md,len) \
0261 ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
0262
0263 # define OCSP_CERTSTATUS_dup(cs)\
0264 (OCSP_CERTSTATUS*)ASN1_dup((i2d_of_void *)i2d_OCSP_CERTSTATUS,\
0265 (d2i_of_void *)d2i_OCSP_CERTSTATUS,(char *)(cs))
0266
0267 DECLARE_ASN1_DUP_FUNCTION(OCSP_CERTID)
0268
0269 OSSL_HTTP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path,
0270 const OCSP_REQUEST *req, int buf_size);
0271 OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req);
0272
0273 # ifndef OPENSSL_NO_DEPRECATED_3_0
0274 typedef OSSL_HTTP_REQ_CTX OCSP_REQ_CTX;
0275 # define OCSP_REQ_CTX_new(io, buf_size) \
0276 OSSL_HTTP_REQ_CTX_new(io, io, buf_size)
0277 # define OCSP_REQ_CTX_free OSSL_HTTP_REQ_CTX_free
0278 # define OCSP_REQ_CTX_http(rctx, op, path) \
0279 (OSSL_HTTP_REQ_CTX_set_expected(rctx, NULL, 1 , 0, 0) && \
0280 OSSL_HTTP_REQ_CTX_set_request_line(rctx, strcmp(op, "POST") == 0, \
0281 NULL, NULL, path))
0282 # define OCSP_REQ_CTX_add1_header OSSL_HTTP_REQ_CTX_add1_header
0283 # define OCSP_REQ_CTX_i2d(r, it, req) \
0284 OSSL_HTTP_REQ_CTX_set1_req(r, "application/ocsp-request", it, req)
0285 # define OCSP_REQ_CTX_set1_req(r, req) \
0286 OCSP_REQ_CTX_i2d(r, ASN1_ITEM_rptr(OCSP_REQUEST), (ASN1_VALUE *)(req))
0287 # define OCSP_REQ_CTX_nbio OSSL_HTTP_REQ_CTX_nbio
0288 # define OCSP_REQ_CTX_nbio_d2i OSSL_HTTP_REQ_CTX_nbio_d2i
0289 # define OCSP_sendreq_nbio(p, r) \
0290 OSSL_HTTP_REQ_CTX_nbio_d2i(r, (ASN1_VALUE **)(p), \
0291 ASN1_ITEM_rptr(OCSP_RESPONSE))
0292 # define OCSP_REQ_CTX_get0_mem_bio OSSL_HTTP_REQ_CTX_get0_mem_bio
0293 # define OCSP_set_max_response_length OSSL_HTTP_REQ_CTX_set_max_response_length
0294 # endif
0295
0296 OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject,
0297 const X509 *issuer);
0298
0299 OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
0300 const X509_NAME *issuerName,
0301 const ASN1_BIT_STRING *issuerKey,
0302 const ASN1_INTEGER *serialNumber);
0303
0304 OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
0305
0306 int OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
0307 int OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);
0308 int OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);
0309 int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);
0310
0311 int OCSP_request_set1_name(OCSP_REQUEST *req, const X509_NAME *nm);
0312 int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
0313
0314 int OCSP_request_sign(OCSP_REQUEST *req,
0315 X509 *signer,
0316 EVP_PKEY *key,
0317 const EVP_MD *dgst,
0318 STACK_OF(X509) *certs, unsigned long flags);
0319
0320 int OCSP_response_status(OCSP_RESPONSE *resp);
0321 OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
0322
0323 const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs);
0324 const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs);
0325 const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs);
0326 int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer,
0327 STACK_OF(X509) *extra_certs);
0328
0329 int OCSP_resp_count(OCSP_BASICRESP *bs);
0330 OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
0331 const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs);
0332 const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);
0333 int OCSP_resp_get0_id(const OCSP_BASICRESP *bs,
0334 const ASN1_OCTET_STRING **pid,
0335 const X509_NAME **pname);
0336 int OCSP_resp_get1_id(const OCSP_BASICRESP *bs,
0337 ASN1_OCTET_STRING **pid,
0338 X509_NAME **pname);
0339
0340 int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
0341 int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
0342 ASN1_GENERALIZEDTIME **revtime,
0343 ASN1_GENERALIZEDTIME **thisupd,
0344 ASN1_GENERALIZEDTIME **nextupd);
0345 int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
0346 int *reason,
0347 ASN1_GENERALIZEDTIME **revtime,
0348 ASN1_GENERALIZEDTIME **thisupd,
0349 ASN1_GENERALIZEDTIME **nextupd);
0350 int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
0351 ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec);
0352
0353 int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs,
0354 X509_STORE *store, unsigned long flags);
0355
0356 # define OCSP_parse_url(url, host, port, path, ssl) \
0357 OSSL_HTTP_parse_url(url, ssl, NULL, host, port, NULL, path, NULL, NULL)
0358
0359 int OCSP_id_issuer_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);
0360 int OCSP_id_cmp(const OCSP_CERTID *a, const OCSP_CERTID *b);
0361
0362 int OCSP_request_onereq_count(OCSP_REQUEST *req);
0363 OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
0364 OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);
0365 int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
0366 ASN1_OCTET_STRING **pikeyHash,
0367 ASN1_INTEGER **pserial, OCSP_CERTID *cid);
0368 int OCSP_request_is_signed(OCSP_REQUEST *req);
0369 OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
0370 OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp,
0371 OCSP_CERTID *cid,
0372 int status, int reason,
0373 ASN1_TIME *revtime,
0374 ASN1_TIME *thisupd,
0375 ASN1_TIME *nextupd);
0376 int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);
0377 int OCSP_basic_sign(OCSP_BASICRESP *brsp,
0378 X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
0379 STACK_OF(X509) *certs, unsigned long flags);
0380 int OCSP_basic_sign_ctx(OCSP_BASICRESP *brsp,
0381 X509 *signer, EVP_MD_CTX *ctx,
0382 STACK_OF(X509) *certs, unsigned long flags);
0383 int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert);
0384 int OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert,
0385 OSSL_LIB_CTX *libctx, const char *propq);
0386 int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert);
0387 int OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx,
0388 const char *propq);
0389 int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert);
0390
0391 X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim);
0392
0393 X509_EXTENSION *OCSP_accept_responses_new(char **oids);
0394
0395 X509_EXTENSION *OCSP_archive_cutoff_new(char *tim);
0396
0397 X509_EXTENSION *OCSP_url_svcloc_new(const X509_NAME *issuer, const char **urls);
0398
0399 int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);
0400 int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);
0401 int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj,
0402 int lastpos);
0403 int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);
0404 X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
0405 X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
0406 void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit,
0407 int *idx);
0408 int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,
0409 unsigned long flags);
0410 int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);
0411
0412 int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
0413 int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);
0414 int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos);
0415 int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);
0416 X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
0417 X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
0418 void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
0419 int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
0420 unsigned long flags);
0421 int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);
0422
0423 int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
0424 int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);
0425 int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj,
0426 int lastpos);
0427 int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit,
0428 int lastpos);
0429 X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
0430 X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
0431 void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit,
0432 int *idx);
0433 int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value,
0434 int crit, unsigned long flags);
0435 int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);
0436
0437 int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
0438 int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);
0439 int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj,
0440 int lastpos);
0441 int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit,
0442 int lastpos);
0443 X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
0444 X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
0445 void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit,
0446 int *idx);
0447 int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value,
0448 int crit, unsigned long flags);
0449 int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);
0450 const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x);
0451
0452 DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)
0453 DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
0454 DECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)
0455 DECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP)
0456 DECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA)
0457 DECLARE_ASN1_FUNCTIONS(OCSP_RESPID)
0458 DECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE)
0459 DECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES)
0460 DECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ)
0461 DECLARE_ASN1_FUNCTIONS(OCSP_CERTID)
0462 DECLARE_ASN1_FUNCTIONS(OCSP_REQUEST)
0463 DECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)
0464 DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)
0465 DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
0466 DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
0467
0468 const char *OCSP_response_status_str(long s);
0469 const char *OCSP_cert_status_str(long s);
0470 const char *OCSP_crl_reason_str(long s);
0471
0472 int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags);
0473 int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags);
0474
0475 int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
0476 X509_STORE *st, unsigned long flags);
0477
0478
0479 # ifdef __cplusplus
0480 }
0481 # endif
0482 # endif
0483 #endif