aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-05-29 17:48:59 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2018-05-29 17:48:59 +1000
commitfc607d8a8ac0170b8880a547d27d637d28285715 (patch)
tree0390b1b42617cc4f30a4b0edd68063d546385ea3 /src
parent9341d94dfd42a9b81ac316c9569643a3e97c4798 (diff)
downloadluaossl-fc607d8a8ac0170b8880a547d27d637d28285715.tar.gz
luaossl-fc607d8a8ac0170b8880a547d27d637d28285715.tar.bz2
luaossl-fc607d8a8ac0170b8880a547d27d637d28285715.zip
src/openssl.c: the SSL_CTX_get0_certificate shim used does not work in < 1.0.2
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 71f9f40..20a2fe5 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -1827,17 +1827,6 @@ static X509_VERIFY_PARAM *compat_SSL_CTX_get0_param(SSL_CTX *ctx) {
} /* compat_SSL_CTX_get0_param() */
#endif
-#if !HAVE_SSL_CTX_GET0_CERTIFICATE
-#define SSL_CTX_get0_certificate(ctx) compat_SSL_CTX_get0_certificate((ctx))
-
-static X509 *compat_SSL_CTX_get0_certificate(const SSL_CTX *ctx) {
- if (ctx->cert != NULL)
- return ctx->cert->key->x509;
- else
- return NULL;
-} /* compat_SSL_CTX_get0_certificate() */
-#endif
-
#if !HAVE_SSL_CTX_SET1_PARAM
#define SSL_CTX_set1_param(ctx, vpm) compat_SSL_CTX_set1_param((ctx), (vpm))
@@ -8525,6 +8514,7 @@ static int sx_setCertificate(lua_State *L) {
} /* sx_setCertificate() */
+#if HAVE_SSL_CTX_GET0_CERTIFICATE
static int sx_getCertificate(lua_State *L) {
SSL_CTX *ctx = checksimple(L, 1, SSL_CTX_CLASS);
X509 *x509;
@@ -8536,6 +8526,7 @@ static int sx_getCertificate(lua_State *L) {
return 1;
} /* sx_getCertificate() */
+#endif
static int sx_setPrivateKey(lua_State *L) {
@@ -8890,7 +8881,9 @@ static const auxL_Reg sx_methods[] = {
{ "setVerify", &sx_setVerify },
{ "getVerify", &sx_getVerify },
{ "setCertificate", &sx_setCertificate },
+#if HAVE_SSL_CTX_GET0_CERTIFICATE
{ "getCertificate", &sx_getCertificate },
+#endif
{ "setPrivateKey", &sx_setPrivateKey },
{ "setCipherList", &sx_setCipherList },
#if HAVE_SSL_CTX_SET_CURVES_LIST