aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-09 21:11:23 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-04-21 00:46:34 +0900
commit009472b9cb6d5339e98cf26730df48cef9734ec7 (patch)
tree7affed462a65ae51c1c856e22e16fce0c1f4307d
parenteeede322991bf2e1e8caad4b2933e7e37bd63a77 (diff)
downloadruby-009472b9cb6d5339e98cf26730df48cef9734ec7.tar.gz
openssl: OCSP_CERTID was made opaque, use OCSP_id_get0_info() instead
-rw-r--r--ext/openssl/extconf.rb1
-rw-r--r--ext/openssl/openssl_missing.c13
-rw-r--r--ext/openssl/openssl_missing.h6
-rw-r--r--ext/openssl/ossl_ocsp.c4
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