3 * 'OpenSSL for Ruby' project
4 * Copyright (C) 2003 Michal Rokos <m.rokos@sh.cvut.cz>
5 * Copyright (C) 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
9 * This program is licenced under the same licence as Ruby.
10 * (See the file 'LICENCE'.)
14 #if defined(OSSL_OCSP_ENABLED)
16 #define WrapOCSPReq(klass, obj, req) do { \
17 if(!req) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
18 obj = Data_Wrap_Struct(klass, 0, OCSP_REQUEST_free, req); \
20 #define GetOCSPReq(obj, req) do { \
21 Data_Get_Struct(obj, OCSP_REQUEST, req); \
22 if(!req) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
24 #define SafeGetOCSPReq(obj, req) do { \
25 OSSL_Check_Kind(obj, cOCSPReq); \
26 GetOCSPReq(obj, req); \
29 #define WrapOCSPRes(klass, obj, res) do { \
30 if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
31 obj = Data_Wrap_Struct(klass, 0, OCSP_RESPONSE_free, res); \
33 #define GetOCSPRes(obj, res) do { \
34 Data_Get_Struct(obj, OCSP_RESPONSE, res); \
35 if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
37 #define SafeGetOCSPRes(obj, res) do { \
38 OSSL_Check_Kind(obj, cOCSPRes); \
39 GetOCSPRes(obj, res); \
42 #define WrapOCSPBasicRes(klass, obj, res) do { \
43 if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
44 obj = Data_Wrap_Struct(klass, 0, OCSP_BASICRESP_free, res); \
46 #define GetOCSPBasicRes(obj, res) do { \
47 Data_Get_Struct(obj, OCSP_BASICRESP, res); \
48 if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
50 #define SafeGetOCSPBasicRes(obj, res) do { \
51 OSSL_Check_Kind(obj, cOCSPBasicRes); \
52 GetOCSPBasicRes(obj, res); \
55 #define WrapOCSPCertId(klass, obj, cid) do { \
56 if(!cid) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
57 obj = Data_Wrap_Struct(klass, 0, OCSP_CERTID_free, cid); \
59 #define GetOCSPCertId(obj, cid) do { \
60 Data_Get_Struct(obj, OCSP_CERTID, cid); \
61 if(!cid) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
63 #define SafeGetOCSPCertId(obj, cid) do { \
64 OSSL_Check_Kind(obj, cOCSPCertId); \
65 GetOCSPCertId(obj, cid); \
79 ossl_ocspcertid_new(OCSP_CERTID
*cid
)
82 WrapOCSPCertId(cOCSPCertId
, obj
, cid
);
90 ossl_ocspreq_alloc(VALUE klass
)
95 if (!(req
= OCSP_REQUEST_new()))
96 ossl_raise(eOCSPError
, NULL
);
97 WrapOCSPReq(klass
, obj
, req
);
103 ossl_ocspreq_initialize(int argc
, VALUE
*argv
, VALUE self
)
106 const unsigned char *p
;
108 rb_scan_args(argc
, argv
, "01", &arg
);
110 OCSP_REQUEST
*req
= DATA_PTR(self
);
111 arg
= ossl_to_der_if_possible(arg
);
113 p
= (unsigned char*)RSTRING_PTR(arg
);
114 if(!d2i_OCSP_REQUEST(&req
, &p
, RSTRING_LEN(arg
)) && (DATA_PTR(self
) = req
, 1)){
115 ossl_raise(eOCSPError
, "cannot load DER encoded request");
123 ossl_ocspreq_add_nonce(int argc
, VALUE
*argv
, VALUE self
)
129 rb_scan_args(argc
, argv
, "01", &val
);
131 GetOCSPReq(self
, req
);
132 ret
= OCSP_request_add1_nonce(req
, NULL
, -1);
136 GetOCSPReq(self
, req
);
137 ret
= OCSP_request_add1_nonce(req
, (unsigned char *)RSTRING_PTR(val
), RSTRING_LEN(val
));
139 if(!ret
) ossl_raise(eOCSPError
, NULL
);
144 /* Check nonce validity in a request and response.
145 * Return value reflects result:
146 * 1: nonces present and equal.
147 * 2: nonces both absent.
148 * 3: nonce present in response only.
149 * 0: nonces both present and not equal.
150 * -1: nonce in request only.
152 * For most responders clients can check return > 0.
153 * If responder doesn't handle nonces return != 0 may be
154 * necessary. return == 0 is always an error.
157 ossl_ocspreq_check_nonce(VALUE self
, VALUE basic_resp
)
163 GetOCSPReq(self
, req
);
164 SafeGetOCSPBasicRes(basic_resp
, bs
);
165 res
= OCSP_check_nonce(req
, bs
);
171 ossl_ocspreq_add_certid(VALUE self
, VALUE certid
)
176 GetOCSPReq(self
, req
);
177 GetOCSPCertId(certid
, id
);
178 if(!OCSP_request_add0_id(req
, OCSP_CERTID_dup(id
)))
179 ossl_raise(eOCSPError
, NULL
);
185 ossl_ocspreq_get_certid(VALUE self
)
193 GetOCSPReq(self
, req
);
194 count
= OCSP_request_onereq_count(req
);
195 ary
= (count
> 0) ? rb_ary_new() : Qnil
;
196 for(i
= 0; i
< count
; i
++){
197 one
= OCSP_request_onereq_get0(req
, i
);
198 if(!(id
= OCSP_CERTID_dup(OCSP_onereq_get0_id(one
))))
199 ossl_raise(eOCSPError
, NULL
);
200 WrapOCSPCertId(cOCSPCertId
, tmp
, id
);
201 rb_ary_push(ary
, tmp
);
208 ossl_ocspreq_sign(int argc
, VALUE
*argv
, VALUE self
)
210 VALUE signer_cert
, signer_key
, certs
, flags
;
214 STACK_OF(X509
) *x509s
;
218 rb_scan_args(argc
, argv
, "22", &signer_cert
, &signer_key
, &certs
, &flags
);
219 signer
= GetX509CertPtr(signer_cert
);
220 key
= GetPrivPKeyPtr(signer_key
);
221 flg
= NIL_P(flags
) ? 0 : NUM2INT(flags
);
223 x509s
= sk_X509_new_null();
224 flags
|= OCSP_NOCERTS
;
226 else x509s
= ossl_x509_ary2sk(certs
);
227 GetOCSPReq(self
, req
);
228 ret
= OCSP_request_sign(req
, signer
, key
, EVP_sha1(), x509s
, flg
);
229 sk_X509_pop_free(x509s
, X509_free
);
230 if(!ret
) ossl_raise(eOCSPError
, NULL
);
236 ossl_ocspreq_verify(int argc
, VALUE
*argv
, VALUE self
)
238 VALUE certs
, store
, flags
;
240 STACK_OF(X509
) *x509s
;
244 rb_scan_args(argc
, argv
, "21", &certs
, &store
, &flags
);
245 x509st
= GetX509StorePtr(store
);
246 flg
= NIL_P(flags
) ? 0 : INT2NUM(flags
);
247 x509s
= ossl_x509_ary2sk(certs
);
248 GetOCSPReq(self
, req
);
249 result
= OCSP_request_verify(req
, x509s
, x509st
, flg
);
250 sk_X509_pop_free(x509s
, X509_free
);
251 if(!result
) rb_warn("%s", ERR_error_string(ERR_peek_error(), NULL
));
253 return result
? Qtrue
: Qfalse
;
257 ossl_ocspreq_to_der(VALUE self
)
264 GetOCSPReq(self
, req
);
265 if((len
= i2d_OCSP_REQUEST(req
, NULL
)) <= 0)
266 ossl_raise(eOCSPError
, NULL
);
267 str
= rb_str_new(0, len
);
268 p
= (unsigned char *)RSTRING_PTR(str
);
269 if(i2d_OCSP_REQUEST(req
, &p
) <= 0)
270 ossl_raise(eOCSPError
, NULL
);
271 ossl_str_adjust(str
, p
);
280 ossl_ocspres_s_create(VALUE klass
, VALUE status
, VALUE basic_resp
)
285 int st
= NUM2INT(status
);
287 if(NIL_P(basic_resp
)) bs
= NULL
;
288 else GetOCSPBasicRes(basic_resp
, bs
); /* NO NEED TO DUP */
289 if(!(res
= OCSP_response_create(st
, bs
)))
290 ossl_raise(eOCSPError
, NULL
);
291 WrapOCSPRes(klass
, obj
, res
);
297 ossl_ocspres_alloc(VALUE klass
)
302 if(!(res
= OCSP_RESPONSE_new()))
303 ossl_raise(eOCSPError
, NULL
);
304 WrapOCSPRes(klass
, obj
, res
);
310 ossl_ocspres_initialize(int argc
, VALUE
*argv
, VALUE self
)
313 const unsigned char *p
;
315 rb_scan_args(argc
, argv
, "01", &arg
);
317 OCSP_RESPONSE
*res
= DATA_PTR(self
);
318 arg
= ossl_to_der_if_possible(arg
);
320 p
= (unsigned char *)RSTRING_PTR(arg
);
321 if(!d2i_OCSP_RESPONSE(&res
, &p
, RSTRING_LEN(arg
)) &&
322 (DATA_PTR(self
) = res
, 1)){
323 ossl_raise(eOCSPError
, "cannot load DER encoded response");
331 ossl_ocspres_status(VALUE self
)
336 GetOCSPRes(self
, res
);
337 st
= OCSP_response_status(res
);
343 ossl_ocspres_status_string(VALUE self
)
348 GetOCSPRes(self
, res
);
349 st
= OCSP_response_status(res
);
351 return rb_str_new2(OCSP_response_status_str(st
));
355 ossl_ocspres_get_basic(VALUE self
)
361 GetOCSPRes(self
, res
);
362 if(!(bs
= OCSP_response_get1_basic(res
)))
364 WrapOCSPBasicRes(cOCSPBasicRes
, ret
, bs
);
370 ossl_ocspres_to_der(VALUE self
)
377 GetOCSPRes(self
, res
);
378 if((len
= i2d_OCSP_RESPONSE(res
, NULL
)) <= 0)
379 ossl_raise(eOCSPError
, NULL
);
380 str
= rb_str_new(0, len
);
381 p
= (unsigned char *)RSTRING_PTR(str
);
382 if(i2d_OCSP_RESPONSE(res
, NULL
) <= 0)
383 ossl_raise(eOCSPError
, NULL
);
384 ossl_str_adjust(str
, p
);
390 * OCSP::BasicResponse
393 ossl_ocspbres_alloc(VALUE klass
)
398 if(!(bs
= OCSP_BASICRESP_new()))
399 ossl_raise(eOCSPError
, NULL
);
400 WrapOCSPBasicRes(klass
, obj
, bs
);
406 ossl_ocspbres_initialize(int argc
, VALUE
*argv
, VALUE self
)
412 ossl_ocspbres_copy_nonce(VALUE self
, VALUE request
)
418 GetOCSPBasicRes(self
, bs
);
419 SafeGetOCSPReq(request
, req
);
420 ret
= OCSP_copy_nonce(bs
, req
);
426 ossl_ocspbres_add_nonce(int argc
, VALUE
*argv
, VALUE self
)
432 rb_scan_args(argc
, argv
, "01", &val
);
434 GetOCSPBasicRes(self
, bs
);
435 ret
= OCSP_basic_add1_nonce(bs
, NULL
, -1);
439 GetOCSPBasicRes(self
, bs
);
440 ret
= OCSP_basic_add1_nonce(bs
, (unsigned char *)RSTRING_PTR(val
), RSTRING_LEN(val
));
442 if(!ret
) ossl_raise(eOCSPError
, NULL
);
448 ossl_ocspbres_add_status(VALUE self
, VALUE cid
, VALUE status
,
449 VALUE reason
, VALUE revtime
,
450 VALUE thisupd
, VALUE nextupd
, VALUE ext
)
453 OCSP_SINGLERESP
*single
;
456 ASN1_TIME
*ths
, *nxt
, *rev
;
457 int error
, i
, rstatus
= 0;
460 st
= NUM2INT(status
);
461 rsn
= NIL_P(status
) ? 0 : NUM2INT(reason
);
463 /* All ary's members should be X509Extension */
464 Check_Type(ext
, T_ARRAY
);
465 for (i
= 0; i
< RARRAY_LEN(ext
); i
++)
466 OSSL_Check_Kind(RARRAY_PTR(ext
)[i
], cX509Ext
);
470 ths
= nxt
= rev
= NULL
;
472 tmp
= rb_protect(rb_Integer
, revtime
, &rstatus
);
473 if(rstatus
) goto err
;
474 rev
= X509_gmtime_adj(NULL
, NUM2INT(tmp
));
476 tmp
= rb_protect(rb_Integer
, thisupd
, &rstatus
);
477 if(rstatus
) goto err
;
478 ths
= X509_gmtime_adj(NULL
, NUM2INT(tmp
));
479 tmp
= rb_protect(rb_Integer
, nextupd
, &rstatus
);
480 if(rstatus
) goto err
;
481 nxt
= X509_gmtime_adj(NULL
, NUM2INT(tmp
));
483 GetOCSPBasicRes(self
, bs
);
484 SafeGetOCSPCertId(cid
, id
);
485 if(!(single
= OCSP_basic_add1_status(bs
, id
, st
, rsn
, rev
, ths
, nxt
))){
491 X509_EXTENSION
*x509ext
;
492 sk_X509_EXTENSION_pop_free(single
->singleExtensions
, X509_EXTENSION_free
);
493 single
->singleExtensions
= NULL
;
494 for(i
= 0; i
< RARRAY_LEN(ext
); i
++){
495 x509ext
= DupX509ExtPtr(RARRAY_PTR(ext
)[i
]);
496 if(!OCSP_SINGLERESP_add_ext(single
, x509ext
, -1)){
497 X509_EXTENSION_free(x509ext
);
501 X509_EXTENSION_free(x509ext
);
509 if(error
) ossl_raise(eOCSPError
, NULL
);
510 if(rstatus
) rb_jump_tag(rstatus
);
516 ossl_ocspbres_get_status(VALUE self
)
519 OCSP_SINGLERESP
*single
;
521 ASN1_TIME
*revtime
, *thisupd
, *nextupd
;
523 X509_EXTENSION
*x509ext
;
525 int count
, ext_count
, i
, j
;
527 GetOCSPBasicRes(self
, bs
);
529 count
= OCSP_resp_count(bs
);
530 for(i
= 0; i
< count
; i
++){
531 single
= OCSP_resp_get0(bs
, i
);
532 if(!single
) continue;
534 revtime
= thisupd
= nextupd
= NULL
;
535 status
= OCSP_single_get0_status(single
, &reason
, &revtime
,
537 if(status
< 0) continue;
538 if(!(cid
= OCSP_CERTID_dup(single
->certId
)))
539 ossl_raise(eOCSPError
, NULL
);
541 rb_ary_push(ary
, ossl_ocspcertid_new(cid
));
542 rb_ary_push(ary
, INT2NUM(status
));
543 rb_ary_push(ary
, INT2NUM(reason
));
544 rb_ary_push(ary
, revtime
? asn1time_to_time(revtime
) : Qnil
);
545 rb_ary_push(ary
, thisupd
? asn1time_to_time(thisupd
) : Qnil
);
546 rb_ary_push(ary
, nextupd
? asn1time_to_time(nextupd
) : Qnil
);
548 ext_count
= OCSP_SINGLERESP_get_ext_count(single
);
549 for(j
= 0; j
< ext_count
; j
++){
550 x509ext
= OCSP_SINGLERESP_get_ext(single
, j
);
551 rb_ary_push(ext
, ossl_x509ext_new(x509ext
));
553 rb_ary_push(ary
, ext
);
554 rb_ary_push(ret
, ary
);
561 ossl_ocspbres_sign(int argc
, VALUE
*argv
, VALUE self
)
563 VALUE signer_cert
, signer_key
, certs
, flags
;
567 STACK_OF(X509
) *x509s
;
571 rb_scan_args(argc
, argv
, "22", &signer_cert
, &signer_key
, &certs
, &flags
);
572 signer
= GetX509CertPtr(signer_cert
);
573 key
= GetPrivPKeyPtr(signer_key
);
574 flg
= NIL_P(flags
) ? 0 : NUM2INT(flags
);
576 x509s
= sk_X509_new_null();
580 x509s
= ossl_x509_ary2sk(certs
);
582 GetOCSPBasicRes(self
, bs
);
583 ret
= OCSP_basic_sign(bs
, signer
, key
, EVP_sha1(), x509s
, flg
);
584 sk_X509_pop_free(x509s
, X509_free
);
585 if(!ret
) ossl_raise(eOCSPError
, NULL
);
591 ossl_ocspbres_verify(int argc
, VALUE
*argv
, VALUE self
)
593 VALUE certs
, store
, flags
;
595 STACK_OF(X509
) *x509s
;
599 rb_scan_args(argc
, argv
, "21", &certs
, &store
, &flags
);
600 x509st
= GetX509StorePtr(store
);
601 flg
= NIL_P(flags
) ? 0 : INT2NUM(flags
);
602 x509s
= ossl_x509_ary2sk(certs
);
603 GetOCSPBasicRes(self
, bs
);
604 result
= OCSP_basic_verify(bs
, x509s
, x509st
, flg
);
605 sk_X509_pop_free(x509s
, X509_free
);
606 if(!result
) rb_warn("%s", ERR_error_string(ERR_peek_error(), NULL
));
608 return result
? Qtrue
: Qfalse
;
612 * OCSP::CertificateId
615 ossl_ocspcid_alloc(VALUE klass
)
620 if(!(id
= OCSP_CERTID_new()))
621 ossl_raise(eOCSPError
, NULL
);
622 WrapOCSPCertId(klass
, obj
, id
);
628 ossl_ocspcid_initialize(VALUE self
, VALUE subject
, VALUE issuer
)
630 OCSP_CERTID
*id
, *newid
;
633 x509s
= GetX509CertPtr(subject
); /* NO NEED TO DUP */
634 x509i
= GetX509CertPtr(issuer
); /* NO NEED TO DUP */
635 if(!(newid
= OCSP_cert_to_id(NULL
, x509s
, x509i
)))
636 ossl_raise(eOCSPError
, NULL
);
637 GetOCSPCertId(self
, id
);
638 OCSP_CERTID_free(id
);
639 RDATA(self
)->data
= newid
;
645 ossl_ocspcid_cmp(VALUE self
, VALUE other
)
647 OCSP_CERTID
*id
, *id2
;
650 GetOCSPCertId(self
, id
);
651 SafeGetOCSPCertId(other
, id2
);
652 result
= OCSP_id_cmp(id
, id2
);
654 return (result
== 0) ? Qtrue
: Qfalse
;
658 ossl_ocspcid_cmp_issuer(VALUE self
, VALUE other
)
660 OCSP_CERTID
*id
, *id2
;
663 GetOCSPCertId(self
, id
);
664 SafeGetOCSPCertId(other
, id2
);
665 result
= OCSP_id_issuer_cmp(id
, id2
);
667 return (result
== 0) ? Qtrue
: Qfalse
;
671 ossl_ocspcid_get_serial(VALUE self
)
675 GetOCSPCertId(self
, id
);
677 return asn1integer_to_num(id
->serialNumber
);
683 mOCSP
= rb_define_module_under(mOSSL
, "OCSP");
685 eOCSPError
= rb_define_class_under(mOCSP
, "OCSPError", eOSSLError
);
687 cOCSPReq
= rb_define_class_under(mOCSP
, "Request", rb_cObject
);
688 rb_define_alloc_func(cOCSPReq
, ossl_ocspreq_alloc
);
689 rb_define_method(cOCSPReq
, "initialize", ossl_ocspreq_initialize
, -1);
690 rb_define_method(cOCSPReq
, "add_nonce", ossl_ocspreq_add_nonce
, -1);
691 rb_define_method(cOCSPReq
, "check_nonce", ossl_ocspreq_check_nonce
, 1);
692 rb_define_method(cOCSPReq
, "add_certid", ossl_ocspreq_add_certid
, 1);
693 rb_define_method(cOCSPReq
, "certid", ossl_ocspreq_get_certid
, 0);
694 rb_define_method(cOCSPReq
, "sign", ossl_ocspreq_sign
, -1);
695 rb_define_method(cOCSPReq
, "verify", ossl_ocspreq_verify
, -1);
696 rb_define_method(cOCSPReq
, "to_der", ossl_ocspreq_to_der
, 0);
698 cOCSPRes
= rb_define_class_under(mOCSP
, "Response", rb_cObject
);
699 rb_define_singleton_method(cOCSPRes
, "create", ossl_ocspres_s_create
, 2);
700 rb_define_alloc_func(cOCSPRes
, ossl_ocspres_alloc
);
701 rb_define_method(cOCSPRes
, "initialize", ossl_ocspres_initialize
, -1);
702 rb_define_method(cOCSPRes
, "status", ossl_ocspres_status
, 0);
703 rb_define_method(cOCSPRes
, "status_string", ossl_ocspres_status_string
, 0);
704 rb_define_method(cOCSPRes
, "basic", ossl_ocspres_get_basic
, 0);
705 rb_define_method(cOCSPRes
, "to_der", ossl_ocspres_to_der
, 0);
707 cOCSPBasicRes
= rb_define_class_under(mOCSP
, "BasicResponse", rb_cObject
);
708 rb_define_alloc_func(cOCSPBasicRes
, ossl_ocspbres_alloc
);
709 rb_define_method(cOCSPBasicRes
, "initialize", ossl_ocspbres_initialize
, -1);
710 rb_define_method(cOCSPBasicRes
, "copy_nonce", ossl_ocspbres_copy_nonce
, 1);
711 rb_define_method(cOCSPBasicRes
, "add_nonce", ossl_ocspbres_add_nonce
, -1);
712 rb_define_method(cOCSPBasicRes
, "add_status", ossl_ocspbres_add_status
, 7);
713 rb_define_method(cOCSPBasicRes
, "status", ossl_ocspbres_get_status
, 0);
714 rb_define_method(cOCSPBasicRes
, "sign", ossl_ocspbres_sign
, -1);
715 rb_define_method(cOCSPBasicRes
, "verify", ossl_ocspbres_verify
, -1);
717 cOCSPCertId
= rb_define_class_under(mOCSP
, "CertificateId", rb_cObject
);
718 rb_define_alloc_func(cOCSPCertId
, ossl_ocspcid_alloc
);
719 rb_define_method(cOCSPCertId
, "initialize", ossl_ocspcid_initialize
, 2);
720 rb_define_method(cOCSPCertId
, "cmp", ossl_ocspcid_cmp
, 1);
721 rb_define_method(cOCSPCertId
, "cmp_issuer", ossl_ocspcid_cmp_issuer
, 1);
722 rb_define_method(cOCSPCertId
, "serial", ossl_ocspcid_get_serial
, 0);
724 #define DefOCSPConst(x) rb_define_const(mOCSP, #x, INT2NUM(OCSP_##x))
726 DefOCSPConst(RESPONSE_STATUS_SUCCESSFUL
);
727 DefOCSPConst(RESPONSE_STATUS_MALFORMEDREQUEST
);
728 DefOCSPConst(RESPONSE_STATUS_INTERNALERROR
);
729 DefOCSPConst(RESPONSE_STATUS_TRYLATER
);
730 DefOCSPConst(RESPONSE_STATUS_SIGREQUIRED
);
731 DefOCSPConst(RESPONSE_STATUS_UNAUTHORIZED
);
733 DefOCSPConst(REVOKED_STATUS_NOSTATUS
);
734 DefOCSPConst(REVOKED_STATUS_UNSPECIFIED
);
735 DefOCSPConst(REVOKED_STATUS_KEYCOMPROMISE
);
736 DefOCSPConst(REVOKED_STATUS_CACOMPROMISE
);
737 DefOCSPConst(REVOKED_STATUS_AFFILIATIONCHANGED
);
738 DefOCSPConst(REVOKED_STATUS_SUPERSEDED
);
739 DefOCSPConst(REVOKED_STATUS_CESSATIONOFOPERATION
);
740 DefOCSPConst(REVOKED_STATUS_CERTIFICATEHOLD
);
741 DefOCSPConst(REVOKED_STATUS_REMOVEFROMCRL
);
743 DefOCSPConst(NOCERTS
);
744 DefOCSPConst(NOINTERN
);
745 DefOCSPConst(NOSIGS
);
746 DefOCSPConst(NOCHAIN
);
747 DefOCSPConst(NOVERIFY
);
748 DefOCSPConst(NOEXPLICIT
);
749 DefOCSPConst(NOCASIGN
);
750 DefOCSPConst(NODELEGATED
);
751 DefOCSPConst(NOCHECKS
);
752 DefOCSPConst(TRUSTOTHER
);
753 DefOCSPConst(RESPID_KEY
);
754 DefOCSPConst(NOTIME
);
756 #define DefOCSPVConst(x) rb_define_const(mOCSP, "V_" #x, INT2NUM(V_OCSP_##x))
758 DefOCSPVConst(CERTSTATUS_GOOD
);
759 DefOCSPVConst(CERTSTATUS_REVOKED
);
760 DefOCSPVConst(CERTSTATUS_UNKNOWN
);
761 DefOCSPVConst(RESPID_NAME
);
762 DefOCSPVConst(RESPID_KEY
);
765 #else /* ! OSSL_OCSP_ENABLED */