aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_x509crl.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-08-26 01:53:27 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-08-26 02:12:37 +0900
commitbb170849428dab1463a8e6ec6109beb0d9da0058 (patch)
tree310d1b4d1e6082ddfc0bdf11ae44a673e2c56c26 /ext/openssl/ossl_x509crl.c
parenta3311831a1b16beea04cd716769def7bd9887bd3 (diff)
downloadruby-openssl-bb170849428dab1463a8e6ec6109beb0d9da0058.tar.gz
Adapt to OpenSSL changes after the 1.1.0-pre6
Fix compiler errors and warnings. The order of parameters of X509_{CRL,REQ}_get0_signature() has been changed, and certificate and CRL time accessors have been reorganized: *_get_* functions are deprecated and replaced by *_get0_* that return a const pointer.
Diffstat (limited to 'ext/openssl/ossl_x509crl.c')
-rw-r--r--ext/openssl/ossl_x509crl.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index 454c0440..0ff5d2f8 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -180,7 +180,7 @@ static VALUE
ossl_x509crl_get_signature_algorithm(VALUE self)
{
X509_CRL *crl;
- X509_ALGOR *alg;
+ const X509_ALGOR *alg;
BIO *out;
BUF_MEM *buf;
VALUE str;
@@ -189,7 +189,7 @@ ossl_x509crl_get_signature_algorithm(VALUE self)
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(eX509CRLError, NULL);
}
- X509_CRL_get0_signature(NULL, &alg, crl);
+ X509_CRL_get0_signature(crl, NULL, &alg);
if (!i2a_ASN1_OBJECT(out, alg->algorithm)) {
BIO_free(out);
ossl_raise(eX509CRLError, NULL);
@@ -230,17 +230,22 @@ ossl_x509crl_get_last_update(VALUE self)
GetX509CRL(self, crl);
- return asn1time_to_time(X509_CRL_get_lastUpdate(crl));
+ return asn1time_to_time(X509_CRL_get0_lastUpdate(crl));
}
static VALUE
ossl_x509crl_set_last_update(VALUE self, VALUE time)
{
X509_CRL *crl;
+ ASN1_TIME *asn1time;
GetX509CRL(self, crl);
- if (!ossl_x509_time_adjust(X509_CRL_get_lastUpdate(crl), time))
- ossl_raise(eX509CRLError, NULL);
+ asn1time = ossl_x509_time_adjust(NULL, time);
+ if (!X509_CRL_set_lastUpdate(crl, asn1time)) {
+ ASN1_TIME_free(asn1time);
+ ossl_raise(eX509CRLError, "X509_CRL_set_lastUpdate");
+ }
+ ASN1_TIME_free(asn1time);
return time;
}
@@ -252,28 +257,22 @@ ossl_x509crl_get_next_update(VALUE self)
GetX509CRL(self, crl);
- return asn1time_to_time(X509_CRL_get_nextUpdate(crl));
+ return asn1time_to_time(X509_CRL_get0_nextUpdate(crl));
}
static VALUE
ossl_x509crl_set_next_update(VALUE self, VALUE time)
{
X509_CRL *crl;
- ASN1_TIME *orig, *new;
+ ASN1_TIME *asn1time;
GetX509CRL(self, crl);
- /* orig may be NULL at this time; in this case a new ASN1_TIME is created */
- orig = X509_CRL_get_nextUpdate(crl);
- new = ossl_x509_time_adjust(orig, time);
-
- if (!X509_CRL_set_nextUpdate(crl, new)) {
- if (!orig)
- ASN1_TIME_free(new);
- ossl_raise(eX509CRLError, NULL);
+ asn1time = ossl_x509_time_adjust(NULL, time);
+ if (!X509_CRL_set_nextUpdate(crl, asn1time)) {
+ ASN1_TIME_free(asn1time);
+ ossl_raise(eX509CRLError, "X509_CRL_set_nextUpdate");
}
- /* X509_CRL_set_nextUpdate() dups when orig != new */
- if (!orig)
- ASN1_TIME_free(new);
+ ASN1_TIME_free(asn1time);
return time;
}