diff options
| author | daurnimator <quae@daurnimator.com> | 2016-12-19 03:05:42 +1100 |
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2016-12-20 22:41:49 +1100 |
| commit | a92a050cb5d2c2e87ec855632bceef30791d8984 (patch) | |
| tree | 8fd682aad5f6198ba50ffa9c14a6356bcde5e25c /src | |
| parent | 55c385971e421c9eed9d5f3e43c8ad768c3cecab (diff) | |
| download | luaossl-a92a050cb5d2c2e87ec855632bceef30791d8984.tar.gz luaossl-a92a050cb5d2c2e87ec855632bceef30791d8984.tar.bz2 luaossl-a92a050cb5d2c2e87ec855632bceef30791d8984.zip | |
Add ssl:setTLSextStatusOCSPResp()
Currently useless without a way to set a callback for tlsext
Diffstat (limited to 'src')
| -rw-r--r-- | src/openssl.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c index 59bcf1e..98043d9 100644 --- a/src/openssl.c +++ b/src/openssl.c | |||
| @@ -8397,6 +8397,26 @@ static int ssl_getTLSextStatusType(lua_State *L) { | |||
| 8397 | #endif | 8397 | #endif |
| 8398 | 8398 | ||
| 8399 | 8399 | ||
| 8400 | static int ssl_setTLSextStatusOCSPResp(lua_State *L) { | ||
| 8401 | SSL *ssl = checksimple(L, 1, SSL_CLASS); | ||
| 8402 | OCSP_RESPONSE *or = checksimple(L, 2, OCSP_RESPONSE_CLASS); | ||
| 8403 | |||
| 8404 | unsigned char *resp = NULL; | ||
| 8405 | long resp_len; | ||
| 8406 | |||
| 8407 | resp_len = i2d_OCSP_RESPONSE(or, &resp); | ||
| 8408 | if (resp_len <= 0) | ||
| 8409 | return auxL_error(L, auxL_EOPENSSL, "ssl:setTLSextStatusOCSPResp"); | ||
| 8410 | |||
| 8411 | if (!SSL_set_tlsext_status_ocsp_resp(ssl, resp, resp_len)) | ||
| 8412 | return auxL_error(L, auxL_EOPENSSL, "ssl:setTLSextStatusOCSPResp"); | ||
| 8413 | |||
| 8414 | lua_pushboolean(L, 1); | ||
| 8415 | |||
| 8416 | return 1; | ||
| 8417 | } /* ssl_setTLSextStatusOCSPResp() */ | ||
| 8418 | |||
| 8419 | |||
| 8400 | static int ssl_getTLSextStatusOCSPResp(lua_State *L) { | 8420 | static int ssl_getTLSextStatusOCSPResp(lua_State *L) { |
| 8401 | SSL *ssl = checksimple(L, 1, SSL_CLASS); | 8421 | SSL *ssl = checksimple(L, 1, SSL_CLASS); |
| 8402 | 8422 | ||
| @@ -8456,6 +8476,7 @@ static const auxL_Reg ssl_methods[] = { | |||
| 8456 | #if HAVE_SSL_GET_TLSEXT_STATUS_TYPE | 8476 | #if HAVE_SSL_GET_TLSEXT_STATUS_TYPE |
| 8457 | { "getTLSextStatusType", &ssl_getTLSextStatusType }, | 8477 | { "getTLSextStatusType", &ssl_getTLSextStatusType }, |
| 8458 | #endif | 8478 | #endif |
| 8479 | { "setTLSextStatusOCSPResp", &ssl_setTLSextStatusOCSPResp }, | ||
| 8459 | { "getTLSextStatusOCSPResp", &ssl_getTLSextStatusOCSPResp }, | 8480 | { "getTLSextStatusOCSPResp", &ssl_getTLSextStatusOCSPResp }, |
| 8460 | { NULL, NULL }, | 8481 | { NULL, NULL }, |
| 8461 | }; | 8482 | }; |
