Skip to content

Commit

Permalink
chore: remove OPENSSL_VERSION_NUMBER > 0x10000000L check
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozg committed Apr 6, 2024
1 parent 7e8ac12 commit db1c429
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
6 changes: 0 additions & 6 deletions src/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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},
Expand All @@ -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},
Expand Down
4 changes: 0 additions & 4 deletions src/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down
14 changes: 0 additions & 14 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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)
{
Expand Down Expand Up @@ -1961,15 +1959,13 @@ 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");
unsigned int id = SSL_SESSION_get_compress_id(session);
lua_pushinteger(L, id);
return 1;
}
#endif

static int openssl_ssl_session_export(lua_State*L)
{
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -2805,7 +2794,6 @@ static int openssl_ssl_set_debug(lua_State*L)
return 0;
}
#endif
#endif

/***
get ssl_ctx associate with current ssl
Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit db1c429

Please sign in to comment.