diff options
author | daurnimator <quae@daurnimator.com> | 2018-05-29 17:17:59 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-05-29 17:17:59 +1000 |
commit | 9341d94dfd42a9b81ac316c9569643a3e97c4798 (patch) | |
tree | 8679092ac8dae737583b52e0ddb778740856489b /src | |
parent | 5e42a7bb99188bc6a54b7f0de8c2eb55845c5b13 (diff) | |
download | luaossl-9341d94dfd42a9b81ac316c9569643a3e97c4798.tar.gz luaossl-9341d94dfd42a9b81ac316c9569643a3e97c4798.tar.bz2 luaossl-9341d94dfd42a9b81ac316c9569643a3e97c4798.zip |
src/openssl.c: Add ssl:getServerTemporaryKey()
Diffstat (limited to 'src')
-rw-r--r-- | src/openssl.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c index 973a659..71f9f40 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -353,6 +353,10 @@ #define HAVE_SSL_GET_CLIENT_RANDOM (OPENSSL_PREREQ(1,1,0) || LIBRESSL_PREREQ(2,7,0)) #endif +#ifndef HAVE_SSL_GET_SERVER_TMP_KEY +#define HAVE_SSL_GET_SERVER_TMP_KEY OPENSSL_PREREQ(1,0,2) +#endif + #ifndef HAVE_SSL_GET_TLSEXT_STATUS_TYPE #define HAVE_SSL_GET_TLSEXT_STATUS_TYPE OPENSSL_PREREQ(1,1,0) #endif @@ -9394,6 +9398,18 @@ static int ssl_getMasterKey(lua_State *L) { } /* ssl_getMasterKey() */ +#if HAVE_SSL_GET_SERVER_TMP_KEY +static int ssl_getServerTemporaryKey(lua_State *L) { + SSL *ssl = checksimple(L, 1, SSL_CLASS); + EVP_PKEY **key = prepsimple(L, PKEY_CLASS); + + if (!SSL_get_server_tmp_key(ssl, key)) + return 0; + + return 1; +} /* ssl_getServerTemporaryKey() */ +#endif + static int ssl_getClientVersion(lua_State *L) { SSL *ssl = checksimple(L, 1, SSL_CLASS); int format = luaL_checkoption(L, 2, "d", (const char *[]){ "d", ".", "f", NULL }); @@ -9587,6 +9603,9 @@ static const auxL_Reg ssl_methods[] = { { "getVersion", &ssl_getVersion }, { "getClientRandom", &ssl_getClientRandom }, { "getMasterKey", &ssl_getMasterKey }, +#if HAVE_SSL_GET_SERVER_TMP_KEY + { "getServerTemporaryKey", &ssl_getServerTemporaryKey }, +#endif { "getClientVersion", &ssl_getClientVersion }, #if HAVE_SSL_GET0_ALPN_SELECTED { "getAlpnSelected", &ssl_getAlpnSelected }, |