mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-21 11:30:01 +00:00
Fix openssl build, and add openssl test
This commit is contained in:
1 parent
29534218d7
commit
1052ee0766
5 files changed
+18
-7
No files matched your search
@@ -9,14 +9,18 @@ jobs:
|
||||
run: sudo apt-get install libmbedtls-dev
|
||||
- name: make
|
||||
run: make test test++
|
||||
- name: openssl
|
||||
run: make test SSL=OPENSSL
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install packages
|
||||
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls
|
||||
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq mbedtls openssl
|
||||
- name: make
|
||||
run: make test++ upload-coverage
|
||||
- name: openssl
|
||||
run: make test SSL=OPENSSL
|
||||
windows:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -22,9 +22,9 @@ CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
|
||||
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
||||
endif
|
||||
ifeq "$(SSL)" "OPENSSL"
|
||||
OPENSSLDIR ?= $(shell "$(brew --cellar openssl)/$(brew info openssl --json | jq -j .[0].installed[0].version)")
|
||||
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSLDIR)/include
|
||||
LDFLAGS ?= -L$(OPENSSLDIR)/lib -lssl -lcrypto
|
||||
OPENSSL_DIR ?= $(shell "$(brew --cellar openssl)/$(brew info openssl --json | jq -j .[0].installed[0].version)")
|
||||
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL_DIR)/include
|
||||
LDFLAGS ?= -L$(OPENSSL_DIR)/lib -lssl -lcrypto
|
||||
endif
|
||||
|
||||
all: mg_prefix test test++ ex vc98 vc2017 linux linux++ infer fuzz
|
||||
|
||||
+4
-1
@@ -3274,6 +3274,8 @@ int mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
if (c->is_client && c->is_resolving == 0 && c->is_connecting == 0) {
|
||||
mg_tls_handshake(c);
|
||||
}
|
||||
c->is_hexdumping = 1;
|
||||
LOG(LL_INFO, ("SSL SETUP OK, %s", c->is_accepted ? "accepted" : "client"));
|
||||
return 1;
|
||||
fail:
|
||||
c->is_closing = 1;
|
||||
@@ -3284,10 +3286,11 @@ fail:
|
||||
int mg_tls_handshake(struct mg_connection *c) {
|
||||
struct mg_tls *tls = (struct mg_tls *) c->tls;
|
||||
int rc;
|
||||
// if (SSL_get_fd(tls->ssl) == -1)
|
||||
SSL_set_fd(tls->ssl, (int) c->fd);
|
||||
rc = c->is_client ? SSL_connect(tls->ssl) : SSL_accept(tls->ssl);
|
||||
if (rc == 1) {
|
||||
LOG(LL_DEBUG, ("%p success", c->fd));
|
||||
c->is_tls_hs = 0;
|
||||
return 1;
|
||||
} else {
|
||||
ERR_print_errors_fp(stderr);
|
||||
|
||||
@@ -260,6 +260,8 @@ int mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
if (c->is_client && c->is_resolving == 0 && c->is_connecting == 0) {
|
||||
mg_tls_handshake(c);
|
||||
}
|
||||
c->is_hexdumping = 1;
|
||||
LOG(LL_INFO, ("SSL SETUP OK, %s", c->is_accepted ? "accepted" : "client"));
|
||||
return 1;
|
||||
fail:
|
||||
c->is_closing = 1;
|
||||
@@ -270,10 +272,11 @@ fail:
|
||||
int mg_tls_handshake(struct mg_connection *c) {
|
||||
struct mg_tls *tls = (struct mg_tls *) c->tls;
|
||||
int rc;
|
||||
// if (SSL_get_fd(tls->ssl) == -1)
|
||||
SSL_set_fd(tls->ssl, (int) c->fd);
|
||||
rc = c->is_client ? SSL_connect(tls->ssl) : SSL_accept(tls->ssl);
|
||||
if (rc == 1) {
|
||||
LOG(LL_DEBUG, ("%p success", c->fd));
|
||||
c->is_tls_hs = 0;
|
||||
return 1;
|
||||
} else {
|
||||
ERR_print_errors_fp(stderr);
|
||||
|
||||
+2
-1
@@ -566,7 +566,8 @@ static void test_http_server(void) {
|
||||
static void test_tls(void) {
|
||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
||||
struct mg_tls_opts opts = {.ca = "./test/data/ss_ca.pem",
|
||||
.cert = "./test/data/ss_server.pem"};
|
||||
.cert = "./test/data/ss_server.pem",
|
||||
.certkey = "./test/data/ss_server.pem"};
|
||||
struct mg_mgr mgr;
|
||||
struct mg_connection *c;
|
||||
const char *url = "https://127.0.0.1:12347";
|
||||
|
||||
Reference in new issue
Block a user