2 * $Id: ossl_ocsp.c 11708 2007-02-12 23:01:19Z shyouhei $
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
)
108 rb_scan_args(argc
, argv
, "01", &arg
);
110 arg
= ossl_to_der_if_possible(arg
);
112 p
= (unsigned char*)RSTRING(arg
)->ptr
;
113 if(!d2i_OCSP_REQUEST((OCSP_REQUEST
**)&DATA_PTR(self
), &p
,
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
, RSTRING(val
)->ptr
, RSTRING(val
)->len
);
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
= RSTRING(str
)->ptr
;
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
)
315 rb_scan_args(argc
, argv
, "01", &arg
);
317 arg
= ossl_to_der_if_possible(arg
);
319 p
= RSTRING(arg
)->ptr
;
320 if(!d2i_OCSP_RESPONSE((OCSP_RESPONSE
**)&DATA_PTR(self
), &p
,
322 ossl_raise(eOCSPError
, "cannot load DER encoded response");
330 ossl_ocspres_status(VALUE self
)
335 GetOCSPRes(self
, res
);
336 st
= OCSP_response_status(res
);
342 ossl_ocspres_status_string(VALUE self
)
347 GetOCSPRes(self
, res
);
348 st
= OCSP_response_status(res
);
350 return rb_str_new2(OCSP_response_status_str(st
));
354 ossl_ocspres_get_basic(VALUE self
)
360 GetOCSPRes(self
, res
);
361 if(!(bs
= OCSP_response_get1_basic(res
)))
363 WrapOCSPBasicRes(cOCSPBasicRes
, ret
, bs
);
369 ossl_ocspres_to_der(VALUE self
)
376 GetOCSPRes(self
, res
);
377 if((len
= i2d_OCSP_RESPONSE(res
, NULL
)) <= 0)
378 ossl_raise(eOCSPError
, NULL
);
379 str
= rb_str_new(0, len
);
380 p
= RSTRING(str
)->ptr
;
381 if(i2d_OCSP_RESPONSE(res
, NULL
) <= 0)
382 ossl_raise(eOCSPError
, NULL
);
383 ossl_str_adjust(str
, p
);
389 * OCSP::BasicResponse
392 ossl_ocspbres_alloc(VALUE klass
)
397 if(!(bs
= OCSP_BASICRESP_new()))
398 ossl_raise(eOCSPError
, NULL
);
399 WrapOCSPBasicRes(klass
, obj
, bs
);
405 ossl_ocspbres_initialize(int argc
, VALUE
*argv
, VALUE self
)
411 ossl_ocspbres_copy_nonce(VALUE self
, VALUE request
)
417 GetOCSPBasicRes(self
, bs
);
418 SafeGetOCSPReq(request
, req
);
419 ret
= OCSP_copy_nonce(bs
, req
);
425 ossl_ocspbres_add_nonce(int argc
, VALUE
*argv
, VALUE self
)
431 rb_scan_args(argc
, argv
, "01", &val
);
433 GetOCSPBasicRes(self
, bs
);
434 ret
= OCSP_basic_add1_nonce(bs
, NULL
, -1);
438 GetOCSPBasicRes(self
, bs
);
439 ret
= OCSP_basic_add1_nonce(bs
, RSTRING(val
)->ptr
, RSTRING(val
)->len
);
441 if(!ret
) ossl_raise(eOCSPError
, NULL
);
447 ossl_ocspbres_add_status(VALUE self
, VALUE cid
, VALUE status
,
448 VALUE reason
, VALUE revtime
,
449 VALUE thisupd
, VALUE nextupd
, VALUE ext
)
452 OCSP_SINGLERESP
*single
;
455 ASN1_TIME
*ths
, *nxt
, *rev
;
456 int error
, i
, rstatus
= 0;
459 st
= NUM2INT(status
);
460 rsn
= NIL_P(status
) ? 0 : NUM2INT(reason
);
462 /* All ary's members should be X509Extension */
463 Check_Type(ext
, T_ARRAY
);
464 for (i
= 0; i
< RARRAY(ext
)->len
; i
++)
465 OSSL_Check_Kind(RARRAY(ext
)->ptr
[i
], cX509Ext
);
469 ths
= nxt
= rev
= NULL
;
471 tmp
= rb_protect(rb_Integer
, revtime
, &rstatus
);
472 if(rstatus
) goto err
;
473 rev
= X509_gmtime_adj(NULL
, NUM2INT(tmp
));
475 tmp
= rb_protect(rb_Integer
, thisupd
, &rstatus
);
476 if(rstatus
) goto err
;
477 ths
= X509_gmtime_adj(NULL
, NUM2INT(tmp
));
478 tmp
= rb_protect(rb_Integer
, nextupd
, &rstatus
);
479 if(rstatus
) goto err
;
480 nxt
= X509_gmtime_adj(NULL
, NUM2INT(tmp
));
482 GetOCSPBasicRes(self
, bs
);
483 SafeGetOCSPCertId(cid
, id
);
484 if(!(single
= OCSP_basic_add1_status(bs
, id
, st
, rsn
, rev
, ths
, nxt
))){
490 X509_EXTENSION
*x509ext
;
491 sk_X509_EXTENSION_pop_free(single
->singleExtensions
, X509_EXTENSION_free
);
492 single
->singleExtensions
= NULL
;
493 for(i
= 0; i
< RARRAY(ext
)->len
; i
++){
494 x509ext
= DupX509ExtPtr(RARRAY(ext
)->ptr
[i
]);
495 if(!OCSP_SINGLERESP_add_ext(single
, x509ext
, -1)){
496 X509_EXTENSION_free(x509ext
);
500 X509_EXTENSION_free(x509ext
);
508 if(error
) ossl_raise(eOCSPError
, NULL
);
509 if(rstatus
) rb_jump_tag(rstatus
);
515 ossl_ocspbres_get_status(VALUE self
)
518 OCSP_SINGLERESP
*single
;
520 ASN1_TIME
*revtime
, *thisupd
, *nextupd
;
522 X509_EXTENSION
*x509ext
;
524 int count
, ext_count
, i
, j
;
526 GetOCSPBasicRes(self
, bs
);
528 count
= OCSP_resp_count(bs
);
529 for(i
= 0; i
< count
; i
++){
530 single
= OCSP_resp_get0(bs
, i
);
531 if(!single
) continue;
533 revtime
= thisupd
= nextupd
= NULL
;
534 status
= OCSP_single_get0_status(single
, &reason
, &revtime
,
536 if(status
< 0) continue;
537 if(!(cid
= OCSP_CERTID_dup(single
->certId
)))
538 ossl_raise(eOCSPError
, NULL
);
540 rb_ary_push(ary
, ossl_ocspcertid_new(cid
));
541 rb_ary_push(ary
, INT2NUM(status
));
542 rb_ary_push(ary
, INT2NUM(reason
));
543 rb_ary_push(ary
, revtime
? asn1time_to_time(revtime
) : Qnil
);
544 rb_ary_push(ary
, thisupd
? asn1time_to_time(thisupd
) : Qnil
);
545 rb_ary_push(ary
, nextupd
? asn1time_to_time(nextupd
) : Qnil
);
547 ext_count
= OCSP_SINGLERESP_get_ext_count(single
);
548 for(j
= 0; j
< ext_count
; j
++){
549 x509ext
= OCSP_SINGLERESP_get_ext(single
, j
);
550 rb_ary_push(ext
, ossl_x509ext_new(x509ext
));
552 rb_ary_push(ary
, ext
);
553 rb_ary_push(ret
, ary
);
560 ossl_ocspbres_sign(int argc
, VALUE
*argv
, VALUE self
)
562 VALUE signer_cert
, signer_key
, certs
, flags
;
566 STACK_OF(X509
) *x509s
;
570 rb_scan_args(argc
, argv
, "22", &signer_cert
, &signer_key
, &certs
, &flags
);
571 signer
= GetX509CertPtr(signer_cert
);
572 key
= GetPrivPKeyPtr(signer_key
);
573 flg
= NIL_P(flags
) ? 0 : NUM2INT(flags
);
575 x509s
= sk_X509_new_null();
579 x509s
= ossl_x509_ary2sk(certs
);
581 GetOCSPBasicRes(self
, bs
);
582 ret
= OCSP_basic_sign(bs
, signer
, key
, EVP_sha1(), x509s
, flg
);
583 sk_X509_pop_free(x509s
, X509_free
);
584 if(!ret
) ossl_raise(eOCSPError
, NULL
);
590 ossl_ocspbres_verify(int argc
, VALUE
*argv
, VALUE self
)
592 VALUE certs
, store
, flags
;
594 STACK_OF(X509
) *x509s
;
598 rb_scan_args(argc
, argv
, "21", &certs
, &store
, &flags
);
599 x509st
= GetX509StorePtr(store
);
600 flg
= NIL_P(flags
) ? 0 : INT2NUM(flags
);
601 x509s
= ossl_x509_ary2sk(certs
);
602 GetOCSPBasicRes(self
, bs
);
603 result
= OCSP_basic_verify(bs
, x509s
, x509st
, flg
);
604 sk_X509_pop_free(x509s
, X509_free
);
605 if(!result
) rb_warn("%s", ERR_error_string(ERR_peek_error(), NULL
));
607 return result
? Qtrue
: Qfalse
;
611 * OCSP::CertificateId
614 ossl_ocspcid_alloc(VALUE klass
)
619 if(!(id
= OCSP_CERTID_new()))
620 ossl_raise(eOCSPError
, NULL
);
621 WrapOCSPCertId(klass
, obj
, id
);
627 ossl_ocspcid_initialize(VALUE self
, VALUE subject
, VALUE issuer
)
629 OCSP_CERTID
*id
, *newid
;
632 x509s
= GetX509CertPtr(subject
); /* NO NEED TO DUP */
633 x509i
= GetX509CertPtr(issuer
); /* NO NEED TO DUP */
634 if(!(newid
= OCSP_cert_to_id(NULL
, x509s
, x509i
)))
635 ossl_raise(eOCSPError
, NULL
);
636 GetOCSPCertId(self
, id
);
637 OCSP_CERTID_free(id
);
638 RDATA(self
)->data
= newid
;
644 ossl_ocspcid_cmp(VALUE self
, VALUE other
)
646 OCSP_CERTID
*id
, *id2
;
649 GetOCSPCertId(self
, id
);
650 SafeGetOCSPCertId(other
, id2
);
651 result
= OCSP_id_cmp(id
, id2
);
653 return (result
== 0) ? Qtrue
: Qfalse
;
657 ossl_ocspcid_cmp_issuer(VALUE self
, VALUE other
)
659 OCSP_CERTID
*id
, *id2
;
662 GetOCSPCertId(self
, id
);
663 SafeGetOCSPCertId(other
, id2
);
664 result
= OCSP_id_issuer_cmp(id
, id2
);
666 return (result
== 0) ? Qtrue
: Qfalse
;
670 ossl_ocspcid_get_serial(VALUE self
)
674 GetOCSPCertId(self
, id
);
676 return asn1integer_to_num(id
->serialNumber
);
682 mOCSP
= rb_define_module_under(mOSSL
, "OCSP");
684 eOCSPError
= rb_define_class_under(mOCSP
, "OCSPError", eOSSLError
);
686 cOCSPReq
= rb_define_class_under(mOCSP
, "Request", rb_cObject
);
687 rb_define_alloc_func(cOCSPReq
, ossl_ocspreq_alloc
);
688 rb_define_method(cOCSPReq
, "initialize", ossl_ocspreq_initialize
, -1);
689 rb_define_method(cOCSPReq
, "add_nonce", ossl_ocspreq_add_nonce
, -1);
690 rb_define_method(cOCSPReq
, "check_nonce", ossl_ocspreq_check_nonce
, 1);
691 rb_define_method(cOCSPReq
, "add_certid", ossl_ocspreq_add_certid
, 1);
692 rb_define_method(cOCSPReq
, "certid", ossl_ocspreq_get_certid
, 0);
693 rb_define_method(cOCSPReq
, "sign", ossl_ocspreq_sign
, -1);
694 rb_define_method(cOCSPReq
, "verify", ossl_ocspreq_verify
, -1);
695 rb_define_method(cOCSPReq
, "to_der", ossl_ocspreq_to_der
, 0);
697 cOCSPRes
= rb_define_class_under(mOCSP
, "Response", rb_cObject
);
698 rb_define_singleton_method(cOCSPRes
, "create", ossl_ocspres_s_create
, 2);
699 rb_define_alloc_func(cOCSPRes
, ossl_ocspres_alloc
);
700 rb_define_method(cOCSPRes
, "initialize", ossl_ocspres_initialize
, -1);
701 rb_define_method(cOCSPRes
, "status", ossl_ocspres_status
, 0);
702 rb_define_method(cOCSPRes
, "status_string", ossl_ocspres_status_string
, 0);
703 rb_define_method(cOCSPRes
, "basic", ossl_ocspres_get_basic
, 0);
704 rb_define_method(cOCSPRes
, "to_der", ossl_ocspres_to_der
, 0);
706 cOCSPBasicRes
= rb_define_class_under(mOCSP
, "BasicResponse", rb_cObject
);
707 rb_define_alloc_func(cOCSPBasicRes
, ossl_ocspbres_alloc
);
708 rb_define_method(cOCSPBasicRes
, "initialize", ossl_ocspbres_initialize
, -1);
709 rb_define_method(cOCSPBasicRes
, "copy_nonce", ossl_ocspbres_copy_nonce
, 1);
710 rb_define_method(cOCSPBasicRes
, "add_nonce", ossl_ocspbres_add_nonce
, -1);
711 rb_define_method(cOCSPBasicRes
, "add_status", ossl_ocspbres_add_status
, 7);
712 rb_define_method(cOCSPBasicRes
, "status", ossl_ocspbres_get_status
, 0);
713 rb_define_method(cOCSPBasicRes
, "sign", ossl_ocspbres_sign
, -1);
714 rb_define_method(cOCSPBasicRes
, "verify", ossl_ocspbres_verify
, -1);
716 cOCSPCertId
= rb_define_class_under(mOCSP
, "CertificateId", rb_cObject
);
717 rb_define_alloc_func(cOCSPCertId
, ossl_ocspcid_alloc
);
718 rb_define_method(cOCSPCertId
, "initialize", ossl_ocspcid_initialize
, 2);
719 rb_define_method(cOCSPCertId
, "cmp", ossl_ocspcid_cmp
, 1);
720 rb_define_method(cOCSPCertId
, "cmp_issuer", ossl_ocspcid_cmp_issuer
, 1);
721 rb_define_method(cOCSPCertId
, "serial", ossl_ocspcid_get_serial
, 0);
723 #define DefOCSPConst(x) rb_define_const(mOCSP, #x, INT2NUM(OCSP_##x))
725 DefOCSPConst(RESPONSE_STATUS_SUCCESSFUL
);
726 DefOCSPConst(RESPONSE_STATUS_MALFORMEDREQUEST
);
727 DefOCSPConst(RESPONSE_STATUS_INTERNALERROR
);
728 DefOCSPConst(RESPONSE_STATUS_TRYLATER
);
729 DefOCSPConst(RESPONSE_STATUS_SIGREQUIRED
);
730 DefOCSPConst(RESPONSE_STATUS_UNAUTHORIZED
);
732 DefOCSPConst(REVOKED_STATUS_NOSTATUS
);
733 DefOCSPConst(REVOKED_STATUS_UNSPECIFIED
);
734 DefOCSPConst(REVOKED_STATUS_KEYCOMPROMISE
);
735 DefOCSPConst(REVOKED_STATUS_CACOMPROMISE
);
736 DefOCSPConst(REVOKED_STATUS_AFFILIATIONCHANGED
);
737 DefOCSPConst(REVOKED_STATUS_SUPERSEDED
);
738 DefOCSPConst(REVOKED_STATUS_CESSATIONOFOPERATION
);
739 DefOCSPConst(REVOKED_STATUS_CERTIFICATEHOLD
);
740 DefOCSPConst(REVOKED_STATUS_REMOVEFROMCRL
);
742 DefOCSPConst(NOCERTS
);
743 DefOCSPConst(NOINTERN
);
744 DefOCSPConst(NOSIGS
);
745 DefOCSPConst(NOCHAIN
);
746 DefOCSPConst(NOVERIFY
);
747 DefOCSPConst(NOEXPLICIT
);
748 DefOCSPConst(NOCASIGN
);
749 DefOCSPConst(NODELEGATED
);
750 DefOCSPConst(NOCHECKS
);
751 DefOCSPConst(TRUSTOTHER
);
752 DefOCSPConst(RESPID_KEY
);
753 DefOCSPConst(NOTIME
);
755 #define DefOCSPVConst(x) rb_define_const(mOCSP, "V_" #x, INT2NUM(V_OCSP_##x))
757 DefOCSPVConst(CERTSTATUS_GOOD
);
758 DefOCSPVConst(CERTSTATUS_REVOKED
);
759 DefOCSPVConst(CERTSTATUS_UNKNOWN
);
760 DefOCSPVConst(RESPID_NAME
);
761 DefOCSPVConst(RESPID_KEY
);
764 #else /* ! OSSL_OCSP_ENABLED */