fixed version incompatibility in merge PR 1869

This commit is contained in:
csoler 2020-04-24 23:06:29 +02:00
parent 7e1b9570cf
commit b2e36fbd9c
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -805,6 +805,11 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
} }
X509_NAME_free(issuer_name); X509_NAME_free(issuer_name);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
// (does not leak the key creation date to the outside anymore. for more privacy)
ASN1_TIME_set(X509_get_notBefore(x509), 0);
ASN1_TIME_set(X509_get_notAfter(x509), 0);
#else
// NEW code, set validity time between 2010 and 2110 (remember to change it when, if OpenSSL check it by default. ;) ) // NEW code, set validity time between 2010 and 2110 (remember to change it when, if OpenSSL check it by default. ;) )
// (does not leak the key creation date to the outside anymore. for more privacy) // (does not leak the key creation date to the outside anymore. for more privacy)
if (!ASN1_TIME_set_string(X509_getm_notBefore(x509), "20100101000000Z")) if (!ASN1_TIME_set_string(X509_getm_notBefore(x509), "20100101000000Z"))
@ -817,6 +822,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
RsErr() << __PRETTY_FUNCTION__ << " Set notAfter FAIL" << std::endl; RsErr() << __PRETTY_FUNCTION__ << " Set notAfter FAIL" << std::endl;
return NULL; return NULL;
} }
#endif
if (!X509_set_subject_name(x509, X509_REQ_get_subject_name(req))) if (!X509_set_subject_name(x509, X509_REQ_get_subject_name(req)))
{ {