aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-03 18:09:37 +1000
committerLibravatarLibravatar daurnimator <quae@daurnimator.com> 2017-04-03 18:09:37 +1000
commita46bb3bb92178884616e2b645241ee3fe0d962f7 (patch)
tree7485e729d6f2f828d18a8fed6a907b4261935f0b /src
parent6dbb57f26a8b9120910e90c37ad4fc5f44ad13a9 (diff)
downloadluaossl-a46bb3bb92178884616e2b645241ee3fe0d962f7.tar.gz
luaossl-a46bb3bb92178884616e2b645241ee3fe0d962f7.tar.bz2
luaossl-a46bb3bb92178884616e2b645241ee3fe0d962f7.zip
Allow unsetting ocsp response
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 59d4783..0de4f82 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -8434,14 +8434,18 @@ static int ssl_getTLSextStatusType(lua_State *L) {
static int ssl_setTLSextStatusOCSPResp(lua_State *L) {
SSL *ssl = checksimple(L, 1, SSL_CLASS);
- OCSP_RESPONSE *or = checksimple(L, 2, OCSP_RESPONSE_CLASS);
+ OCSP_RESPONSE *or = testsimple(L, 2, OCSP_RESPONSE_CLASS);
unsigned char *resp = NULL;
long resp_len;
- resp_len = i2d_OCSP_RESPONSE(or, &resp);
- if (resp_len <= 0)
- return auxL_error(L, auxL_EOPENSSL, "ssl:setTLSextStatusOCSPResp");
+ if (or) {
+ resp_len = i2d_OCSP_RESPONSE(or, &resp);
+ if (resp_len <= 0)
+ return auxL_error(L, auxL_EOPENSSL, "ssl:setTLSextStatusOCSPResp");
+ } else {
+ resp_len = 0;
+ }
if (!SSL_set_tlsext_status_ocsp_resp(ssl, resp, resp_len))
return auxL_error(L, auxL_EOPENSSL, "ssl:setTLSextStatusOCSPResp");