/*=========================================================================*\ * sk.h * stack routines(MACRO) for lua-openssl binding * * Author: george zhao \*=========================================================================*/ #include "openssl.h" #ifdef CRYPTO_LOCK_REF #if OPENSSL_VERSION_NUMBER < 0x10100000L #define REF_OR_DUP(TYPE, x) CRYPTO_add(&x->references,1,CRYPTO_LOCK_##TYPE) #else #define REF_OR_DUP(TYPE, x) TYPE##_up_ref(x) #endif #else #define REF_OR_DUP(TYPE, x) x = TYPE##_dup(x) #endif #if OPENSSL_VERSION_NUMBER < 0x10100000L #define TAB2SK(TYPE, type) \ STACK_OF(TYPE)* openssl_sk_##type##_fromtable(lua_State*L, int idx) { \ STACK_OF(TYPE) * sk; \ luaL_argcheck(L, lua_istable(L, idx), idx, \ "must be a table as array or nil"); \ sk = SKM_sk_new_null(TYPE); \ if (lua_istable(L,idx)) { \ int n = lua_rawlen(L, idx); \ int i; \ for ( i=0; i