From db1c429736be10d9316da044ccac743bb0be69da Mon Sep 17 00:00:00 2001 From: zhaozg Date: Sat, 6 Apr 2024 11:04:15 +0800 Subject: [PATCH] chore: remove OPENSSL_VERSION_NUMBER > 0x10000000L check --- src/pkcs7.c | 6 ------ src/rsa.c | 4 ---- src/ssl.c | 14 -------------- 3 files changed, 24 deletions(-) diff --git a/src/pkcs7.c b/src/pkcs7.c index b55fcca7..0d763f14 100644 --- a/src/pkcs7.c +++ b/src/pkcs7.c @@ -66,7 +66,6 @@ static LUA_FUNCTION(openssl_pkcs7_read) return ret; } -#if OPENSSL_VERSION_NUMBER > 0x10000000L /*** create new empty pkcs7 object, which support flexible sign methods. @@ -172,7 +171,6 @@ static LUA_FUNCTION(openssl_pkcs7_add) return openssl_pushresult(L, ret); } -#endif /*** sign message with signcert and signpkey to create pkcs7 object @@ -580,9 +578,7 @@ static luaL_Reg pkcs7_funcs[] = {"export", openssl_pkcs7_export}, {"decrypt", openssl_pkcs7_decrypt}, {"verify", openssl_pkcs7_verify}, -#if OPENSSL_VERSION_NUMBER > 0x10000000L {"add", openssl_pkcs7_add}, -#endif {"set_content", openssl_pkcs7_set_content}, {"__gc", openssl_pkcs7_gc}, @@ -593,9 +589,7 @@ static luaL_Reg pkcs7_funcs[] = static const luaL_Reg R[] = { -#if OPENSSL_VERSION_NUMBER > 0x10000000L {"new", openssl_pkcs7_new}, -#endif {"create", openssl_pkcs7_create}, {"read", openssl_pkcs7_read}, {"sign", openssl_pkcs7_sign}, diff --git a/src/rsa.c b/src/rsa.c index bb5ff2d4..837f0ca8 100644 --- a/src/rsa.c +++ b/src/rsa.c @@ -318,7 +318,6 @@ static int openssl_padding_add(lua_State *L) ret = RSA_padding_add_X931(to, sz, from, l); break; #endif -#if OPENSSL_VERSION_NUMBER > 0x10000000L case RSA_PKCS1_PSS_PADDING: { RSA* rsa = CHECK_OBJECT(3, RSA, "openssl.rsa"); @@ -329,7 +328,6 @@ static int openssl_padding_add(lua_State *L) ret = RSA_padding_add_PKCS1_PSS_mgf1(rsa, to, from, md, mgf1md, saltlen); } -#endif default: break; } @@ -416,7 +414,6 @@ static int openssl_padding_check(lua_State *L) ret = RSA_padding_check_X931(to, sz, from, l, sz); break; #endif -#if OPENSSL_VERSION_NUMBER > 0x10000000L case RSA_PKCS1_PSS_PADDING: { RSA* rsa = CHECK_OBJECT(3, RSA, "openssl.rsa"); @@ -434,7 +431,6 @@ static int openssl_padding_check(lua_State *L) ret = RSA_verify_PKCS1_PSS_mgf1(rsa, to, md, mgf1md, from, saltlen); to = NULL; } -#endif default: break; } diff --git a/src/ssl.c b/src/ssl.c index bcfc80e6..c6ac6e01 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1924,7 +1924,6 @@ static int openssl_ssl_session_gc(lua_State*L) return 0; } -#if OPENSSL_VERSION_NUMBER > 0x10000000L static int openssl_ssl_session_peer(lua_State*L) { SSL_SESSION* session = CHECK_OBJECT(1, SSL_SESSION, "openssl.ssl_session"); @@ -1933,7 +1932,6 @@ static int openssl_ssl_session_peer(lua_State*L) PUSH_OBJECT(x, "openssl.x509"); return 1; } -#endif static int openssl_ssl_session_id(lua_State*L) { @@ -1961,7 +1959,6 @@ static int openssl_ssl_session_id(lua_State*L) } } -#if OPENSSL_VERSION_NUMBER > 0x10000000L static int openssl_ssl_session_compress_id(lua_State*L) { SSL_SESSION* session = CHECK_OBJECT(1, SSL_SESSION, "openssl.ssl_session"); @@ -1969,7 +1966,6 @@ static int openssl_ssl_session_compress_id(lua_State*L) lua_pushinteger(L, id); return 1; } -#endif static int openssl_ssl_session_export(lua_State*L) { @@ -2017,10 +2013,8 @@ static luaL_Reg ssl_session_funcs[] = {"id", openssl_ssl_session_id}, {"time", openssl_ssl_session_time}, {"timeout", openssl_ssl_session_timeout}, -#if OPENSSL_VERSION_NUMBER > 0x10000000L {"compress_id", openssl_ssl_session_compress_id}, {"peer", openssl_ssl_session_peer}, -#endif {"export", openssl_ssl_session_export}, #if OPENSSL_VERSION_NUMBER > 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER) {"is_resumable", openssl_ssl_session_is_resumable}, @@ -2177,9 +2171,7 @@ static int openssl_ssl_current_cipher(lua_State *L) AUXILIAR_SET(L, -1, "name", SSL_CIPHER_get_name(c), string); AUXILIAR_SET(L, -1, "version", SSL_CIPHER_get_version(c), string); -#if OPENSSL_VERSION_NUMBER > 0x10000000L AUXILIAR_SET(L, -1, "id", SSL_CIPHER_get_id(c), integer); -#endif bits = SSL_CIPHER_get_bits(c, &algbits); AUXILIAR_SET(L, -1, "bits", bits, integer); AUXILIAR_SET(L, -1, "algbits", algbits, integer); @@ -2636,14 +2628,12 @@ static int openssl_ssl_renegotiate(lua_State*L) return openssl_ssl_pushresult(L, s, ret); } -#if OPENSSL_VERSION_NUMBER > 0x10000000L static int openssl_ssl_renegotiate_abbreviated(lua_State*L) { SSL* s = CHECK_OBJECT(1, SSL, "openssl.ssl"); int ret = SSL_renegotiate_abbreviated(s); return openssl_ssl_pushresult(L, s, ret); } -#endif /*** get ssl renegotiate_pending @@ -2788,7 +2778,6 @@ static int openssl_ssl_session_reused(lua_State*L) return 1; } -#if OPENSSL_VERSION_NUMBER > 0x10000000L static int openssl_ssl_cache_hit(lua_State*L) { SSL* s = CHECK_OBJECT(1, SSL, "openssl.ssl"); @@ -2805,7 +2794,6 @@ static int openssl_ssl_set_debug(lua_State*L) return 0; } #endif -#endif /*** get ssl_ctx associate with current ssl @@ -2947,13 +2935,11 @@ static luaL_Reg ssl_funcs[] = {"shutdown", openssl_ssl_shutdown}, {"session_reused", openssl_ssl_session_reused}, -#if OPENSSL_VERSION_NUMBER > 0x10000000L #if OPENSSL_VERSION_NUMBER < 0x10100000L {"set_debug", openssl_ssl_set_debug}, #endif {"cache_hit", openssl_ssl_cache_hit}, {"renegotiate_abbreviated", openssl_ssl_renegotiate_abbreviated}, -#endif {"renegotiate_pending", openssl_ssl_renegotiate_pending}, {"set_connect_state", openssl_ssl_set_connect_state}, {"set_accept_state", openssl_ssl_set_accept_state},