Skip to content

Commit

Permalink
chore: refactor for libressl 3.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozg committed Jan 1, 2025
1 parent deeef7b commit 1f345e9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/digest.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ static LUA_FUNCTION(openssl_digest_ctx_data)

#if defined(LIBRESSL_VERSION_NUMBER)
/* without EVP_MD_meth_get_app_datasize */
(void)ctx;
return 0;
#else

Expand Down
2 changes: 1 addition & 1 deletion src/lhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static void table2data(lua_State*L, int idx, BIO* bio)
}
#endif

#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40000000L
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x30900000L
static LUA_FUNCTION(openssl_lhash_read)
{
long eline = -1;
Expand Down
6 changes: 3 additions & 3 deletions src/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ static LUA_FUNCTION(openssl_list)
{
OBJ_NAME_TYPE_MD_METH,
OBJ_NAME_TYPE_CIPHER_METH,
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40000000L
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x30900000L
/* NOTE: libressl 4.0.0 */
OBJ_NAME_TYPE_PKEY_METH,
OBJ_NAME_TYPE_COMP_METH
Expand All @@ -159,7 +159,7 @@ static LUA_FUNCTION(openssl_list)
static const char *names[] = {
"digests",
"ciphers",
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40000000L
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x30900000L
"pkeys",
"comps",
#endif
Expand Down Expand Up @@ -583,7 +583,7 @@ LUALIB_API int luaopen_openssl(lua_State*L)

luaL_setfuncs(L, eay_functions, 0);

#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40000000L
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x30900000L
/* NOTE: refact lhash/conf module */
openssl_register_lhash(L);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/ots.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static int openssl_ts_msg_imprint_new(lua_State *L)
if (ret == 1)
{
X509_ALGOR* alg = X509_ALGOR_new();
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x40000000L
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30900000L
X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), V_ASN1_NULL, NULL);
#else
X509_ALGOR_set_md(alg, md);
Expand Down
2 changes: 1 addition & 1 deletion src/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs);
lua_pop(L,1); \
}

#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x40000000L
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30900000L
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG)
#define OPENSSL_NO_CRYPTO_MDEBUG
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int openssl_push_purpose(lua_State*L, const X509_PURPOSE* purpose)

AUXILIAR_SET(L, -1, "purpose", X509_PURPOSE_get_id(purpose), integer);

#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x40000000L
#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER < 0x30900000L
AUXILIAR_SET(L, -1, "trust", X509_PURPOSE_get_trust(purpose), integer);
AUXILIAR_SET(L, -1, "flags", purpose->flags, integer);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/xalgor.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int openssl_xalgor_md(lua_State* L)
{
X509_ALGOR* alg = CHECK_OBJECT(1, X509_ALGOR, "openssl.x509_algor");
const EVP_MD* md = get_digest(L, 2, NULL);
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x40000000L
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30900000L
X509_ALGOR_set0(alg, OBJ_nid2obj(EVP_MD_type(md)), V_ASN1_NULL, NULL);
#else
X509_ALGOR_set_md(alg, md);
Expand Down

0 comments on commit 1f345e9

Please sign in to comment.