summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2016-11-15 20:38:24 +1100
committerdaurnimator <quae@daurnimator.com>2016-12-09 02:57:06 +1100
commitaea81904d89a13311f4bb1ab0c19dffb7eecad16 (patch)
treeb8489baa9e7b3828bb533085150d1b98eaf3e518
parent043257dd0c0b7ebd7a577a9fceaecb1c2910f144 (diff)
downloadluaossl-aea81904d89a13311f4bb1ab0c19dffb7eecad16.tar.gz
luaossl-aea81904d89a13311f4bb1ab0c19dffb7eecad16.tar.bz2
luaossl-aea81904d89a13311f4bb1ab0c19dffb7eecad16.zip
openssl.x509.verify_param: Bind X509_VERIFY_PARAM_set_auth_level and X509_VERIFY_PARAM_get_auth_level
-rw-r--r--src/openssl.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index f0b75ae..5e16e56 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -286,6 +286,10 @@
286#define HAVE_SSLV2_SERVER_METHOD (!OPENSSL_PREREQ(1,1,0) && !defined OPENSSL_NO_SSL2) 286#define HAVE_SSLV2_SERVER_METHOD (!OPENSSL_PREREQ(1,1,0) && !defined OPENSSL_NO_SSL2)
287#endif 287#endif
288 288
289#ifndef HAVE_X509_AUTH_LEVEL
290#define HAVE_X509_AUTH_LEVEL OPENSSL_PREREQ(1,1,0)
291#endif
292
289#ifndef HAVE_X509_STORE_REFERENCES 293#ifndef HAVE_X509_STORE_REFERENCES
290#define HAVE_X509_STORE_REFERENCES (!OPENSSL_PREREQ(1,1,0)) 294#define HAVE_X509_STORE_REFERENCES (!OPENSSL_PREREQ(1,1,0))
291#endif 295#endif
@@ -8340,6 +8344,29 @@ static int xp_getDepth(lua_State *L) {
8340} /* xp_getDepth() */ 8344} /* xp_getDepth() */
8341 8345
8342 8346
8347#if HAVE_X509_AUTH_LEVEL
8348static int xp_setAuthLevel(lua_State *L) {
8349 X509_VERIFY_PARAM *xp = checksimple(L, 1, X509_VERIFY_PARAM_CLASS);
8350 int auth_level = luaL_checkinteger(L, 2);
8351
8352 X509_VERIFY_PARAM_set_auth_level(xp, auth_level);
8353
8354 lua_pushboolean(L, 1);
8355 return 1;
8356} /* xp_setAuthLevel() */
8357
8358
8359static int xp_getAuthLevel(lua_State *L) {
8360 X509_VERIFY_PARAM *xp = checksimple(L, 1, X509_VERIFY_PARAM_CLASS);
8361
8362 int auth_level = X509_VERIFY_PARAM_get_auth_level(xp);
8363
8364 lua_pushinteger(L, auth_level);
8365 return 1;
8366} /* xp_getAuthLevel() */
8367#endif
8368
8369
8343static int xp_setHost(lua_State *L) { 8370static int xp_setHost(lua_State *L) {
8344 X509_VERIFY_PARAM *xp = checksimple(L, 1, X509_VERIFY_PARAM_CLASS); 8371 X509_VERIFY_PARAM *xp = checksimple(L, 1, X509_VERIFY_PARAM_CLASS);
8345 size_t len; 8372 size_t len;
@@ -8410,6 +8437,10 @@ static const auxL_Reg xp_methods[] = {
8410 { "setTime", &xp_setTime }, 8437 { "setTime", &xp_setTime },
8411 { "setDepth", &xp_setDepth }, 8438 { "setDepth", &xp_setDepth },
8412 { "getDepth", &xp_getDepth }, 8439 { "getDepth", &xp_getDepth },
8440#if HAVE_X509_AUTH_LEVEL
8441 { "setAuthLevel", &xp_setAuthLevel },
8442 { "getAuthLevel", &xp_getAuthLevel },
8443#endif
8413 { "setHost", &xp_setHost }, 8444 { "setHost", &xp_setHost },
8414 { "addHost", &xp_addHost }, 8445 { "addHost", &xp_addHost },
8415 { "setEmail", &xp_setEmail }, 8446 { "setEmail", &xp_setEmail },