Skip to content

Commit

Permalink
Declare X509_set1_notBefore macro for OpenSSL 1.0 and LibreSSL.
Browse files Browse the repository at this point in the history
rhenium requested in review (thanks): I'd define macro in
ext/openssl/openssl_missing.h. It's actually done for the getter
functions, but apparently I forgot to do that for the setters.
  #define X509_set1_notBefore(x, t) X509_set_notBefore(x, t).
  • Loading branch information
markwright committed Oct 28, 2017
1 parent 1e6e26c commit 3eb532f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions ext/openssl/openssl_missing.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ IMPL_PKEY_GETTER(EC_KEY, ec)
# define X509_get0_notAfter(x) X509_get_notAfter(x)
# define X509_CRL_get0_lastUpdate(x) X509_CRL_get_lastUpdate(x)
# define X509_CRL_get0_nextUpdate(x) X509_CRL_get_nextUpdate(x)
# define X509_set1_notBefore(x, t) X509_set_notBefore(x, t)
# define X509_set1_notAfter(x, t) X509_set_notAfter(x, t)
#endif

#if !defined(HAVE_SSL_SESSION_GET_PROTOCOL_VERSION)
Expand Down
8 changes: 0 additions & 8 deletions ext/openssl/ossl_x509cert.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,7 @@ ossl_x509_set_not_before(VALUE self, VALUE time)

GetX509(self, x509);
asn1time = ossl_x509_time_adjust(NULL, time);
#if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L)
if (!X509_set1_notBefore(x509, asn1time)) {
#else
if (!X509_set_notBefore(x509, asn1time)) {
#endif
ASN1_TIME_free(asn1time);
ossl_raise(eX509CertError, "X509_set_notBefore");
}
Expand Down Expand Up @@ -483,11 +479,7 @@ ossl_x509_set_not_after(VALUE self, VALUE time)

GetX509(self, x509);
asn1time = ossl_x509_time_adjust(NULL, time);
#if !defined(LIBRESSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x10100000L)
if (!X509_set1_notAfter(x509, asn1time)) {
#else
if (!X509_set_notAfter(x509, asn1time)) {
#endif
ASN1_TIME_free(asn1time);
ossl_raise(eX509CertError, "X509_set_notAfter");
}
Expand Down

0 comments on commit 3eb532f

Please sign in to comment.