Skip to content

Commit

Permalink
openssl-1.0.2 compat, fix compiler warnings
Browse files Browse the repository at this point in the history
Enable werror in CI build
  • Loading branch information
icing committed Feb 5, 2025
1 parent ed6cac2 commit 06e8a25
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/openssl-1.0.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
# configure without --enable-werror since openssl 1.0.2 will give warnings
run: |
autoreconf -fi
./configure --with-openssl=$HOME/openssl
./configure --enable-werror --with-openssl=$HOME/openssl
- name: 'build'
run: make V=1
Expand Down
12 changes: 12 additions & 0 deletions src/md_crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@
#define MD_HAVE_CT 0
#endif

#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define MD_OPENSSL_10x
#endif

static int initialized;

struct md_pkey_t {
Expand Down Expand Up @@ -803,7 +807,11 @@ static apr_status_t check_EC_curve(int nid, apr_pool_t *p) {
int rv = APR_ENOENT;

nc = EC_get_builtin_curves(NULL, 0);
#ifdef MD_OPENSSL_10x
if (NULL == (curves = OPENSSL_malloc((int)(sizeof(*curves) * nc))) ||
#else
if (NULL == (curves = OPENSSL_malloc(sizeof(*curves) * nc)) ||
#endif
nc != EC_get_builtin_curves(curves, nc)) {
rv = APR_EGENERAL;
md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, p,
Expand Down Expand Up @@ -1515,7 +1523,11 @@ apr_status_t md_cert_read_chain(apr_array_header_t *chain, apr_pool_t *p,
md_cert_t *cert;
int added = 0;

#ifdef MD_OPENSSL_10x
if (NULL == (bf = BIO_new_mem_buf((char *)pem, (int)pem_len))) {
#else
if (NULL == (bf = BIO_new_mem_buf(pem, (int)pem_len))) {
#endif
rv = APR_ENOMEM;
goto cleanup;
}
Expand Down

0 comments on commit 06e8a25

Please sign in to comment.