diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/openssl/extconf.rb | 1 | ||||
-rw-r--r-- | ext/openssl/openssl_missing.c | 13 | ||||
-rw-r--r-- | ext/openssl/openssl_missing.h | 6 | ||||
-rw-r--r-- | ext/openssl/ossl_ocsp.c | 4 |
4 files changed, 23 insertions, 1 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index cf69b2736e..25a0bb744b 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -66,6 +66,7 @@ end Logging::message "=== Checking for OpenSSL features... ===\n" have_func("ERR_peek_last_error") have_func("ASN1_put_eoc") +have_func("OCSP_id_get0_info") have_func("BN_mod_add") have_func("BN_mod_sqr") have_func("BN_mod_sub") diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c index 907276dada..efb9d1c6c0 100644 --- a/ext/openssl/openssl_missing.c +++ b/ext/openssl/openssl_missing.c @@ -417,3 +417,16 @@ ASN1_put_eoc(unsigned char **pp) return 2; } #endif + +#if !defined(HAVE_OCSP_ID_GET0_INFO) +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid) +{ + if (piNameHash || pmd || pikeyHash) + rb_bug("not supported"); + if (pserial) + *pserial = cid->serialNumber; + return 1; +} +#endif diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h index c9717ee27b..629b7423b4 100644 --- a/ext/openssl/openssl_missing.h +++ b/ext/openssl/openssl_missing.h @@ -188,6 +188,12 @@ int PEM_def_callback(char *buf, int num, int w, void *key); int ASN1_put_eoc(unsigned char **pp); #endif +#if !defined(HAVE_OCSP_ID_GET0_INFO) +int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd, + ASN1_OCTET_STRING **pikeyHash, + ASN1_INTEGER **pserial, OCSP_CERTID *cid); +#endif + #if defined(__cplusplus) } #endif diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c index 02b67429e6..d92d708724 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -963,10 +963,12 @@ static VALUE ossl_ocspcid_get_serial(VALUE self) { OCSP_CERTID *id; + ASN1_INTEGER *serial; GetOCSPCertId(self, id); + OCSP_id_get0_info(NULL, NULL, NULL, &serial, id); - return asn1integer_to_num(id->serialNumber); + return asn1integer_to_num(serial); } void |