mirror of
https://github.com/cesanta/mongoose.git
synced 2026-12-04 21:58:22 +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
|
run: sudo apt-get install libmbedtls-dev
|
||||||
- name: make
|
- name: make
|
||||||
run: make test test++
|
run: make test test++
|
||||||
|
- name: openssl
|
||||||
|
run: make test SSL=OPENSSL
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install packages
|
- 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
|
- name: make
|
||||||
run: make test++ upload-coverage
|
run: make test++ upload-coverage
|
||||||
|
- name: openssl
|
||||||
|
run: make test SSL=OPENSSL
|
||||||
windows:
|
windows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
|
|||||||
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
||||||
endif
|
endif
|
||||||
ifeq "$(SSL)" "OPENSSL"
|
ifeq "$(SSL)" "OPENSSL"
|
||||||
OPENSSLDIR ?= $(shell "$(brew --cellar openssl)/$(brew info openssl --json | jq -j .[0].installed[0].version)")
|
OPENSSL_DIR ?= $(shell "$(brew --cellar openssl)/$(brew info openssl --json | jq -j .[0].installed[0].version)")
|
||||||
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSLDIR)/include
|
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL_DIR)/include
|
||||||
LDFLAGS ?= -L$(OPENSSLDIR)/lib -lssl -lcrypto
|
LDFLAGS ?= -L$(OPENSSL_DIR)/lib -lssl -lcrypto
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: mg_prefix test test++ ex vc98 vc2017 linux linux++ infer fuzz
|
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) {
|
if (c->is_client && c->is_resolving == 0 && c->is_connecting == 0) {
|
||||||
mg_tls_handshake(c);
|
mg_tls_handshake(c);
|
||||||
}
|
}
|
||||||
|
c->is_hexdumping = 1;
|
||||||
|
LOG(LL_INFO, ("SSL SETUP OK, %s", c->is_accepted ? "accepted" : "client"));
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
c->is_closing = 1;
|
c->is_closing = 1;
|
||||||
@@ -3284,10 +3286,11 @@ fail:
|
|||||||
int mg_tls_handshake(struct mg_connection *c) {
|
int mg_tls_handshake(struct mg_connection *c) {
|
||||||
struct mg_tls *tls = (struct mg_tls *) c->tls;
|
struct mg_tls *tls = (struct mg_tls *) c->tls;
|
||||||
int rc;
|
int rc;
|
||||||
// if (SSL_get_fd(tls->ssl) == -1)
|
|
||||||
SSL_set_fd(tls->ssl, (int) c->fd);
|
SSL_set_fd(tls->ssl, (int) c->fd);
|
||||||
rc = c->is_client ? SSL_connect(tls->ssl) : SSL_accept(tls->ssl);
|
rc = c->is_client ? SSL_connect(tls->ssl) : SSL_accept(tls->ssl);
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
|
LOG(LL_DEBUG, ("%p success", c->fd));
|
||||||
|
c->is_tls_hs = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
ERR_print_errors_fp(stderr);
|
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) {
|
if (c->is_client && c->is_resolving == 0 && c->is_connecting == 0) {
|
||||||
mg_tls_handshake(c);
|
mg_tls_handshake(c);
|
||||||
}
|
}
|
||||||
|
c->is_hexdumping = 1;
|
||||||
|
LOG(LL_INFO, ("SSL SETUP OK, %s", c->is_accepted ? "accepted" : "client"));
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
c->is_closing = 1;
|
c->is_closing = 1;
|
||||||
@@ -270,10 +272,11 @@ fail:
|
|||||||
int mg_tls_handshake(struct mg_connection *c) {
|
int mg_tls_handshake(struct mg_connection *c) {
|
||||||
struct mg_tls *tls = (struct mg_tls *) c->tls;
|
struct mg_tls *tls = (struct mg_tls *) c->tls;
|
||||||
int rc;
|
int rc;
|
||||||
// if (SSL_get_fd(tls->ssl) == -1)
|
|
||||||
SSL_set_fd(tls->ssl, (int) c->fd);
|
SSL_set_fd(tls->ssl, (int) c->fd);
|
||||||
rc = c->is_client ? SSL_connect(tls->ssl) : SSL_accept(tls->ssl);
|
rc = c->is_client ? SSL_connect(tls->ssl) : SSL_accept(tls->ssl);
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
|
LOG(LL_DEBUG, ("%p success", c->fd));
|
||||||
|
c->is_tls_hs = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
ERR_print_errors_fp(stderr);
|
ERR_print_errors_fp(stderr);
|
||||||
|
|||||||
+2
-1
@@ -566,7 +566,8 @@ static void test_http_server(void) {
|
|||||||
static void test_tls(void) {
|
static void test_tls(void) {
|
||||||
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
#if MG_ENABLE_MBEDTLS || MG_ENABLE_OPENSSL
|
||||||
struct mg_tls_opts opts = {.ca = "./test/data/ss_ca.pem",
|
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_mgr mgr;
|
||||||
struct mg_connection *c;
|
struct mg_connection *c;
|
||||||
const char *url = "https://127.0.0.1:12347";
|
const char *url = "https://127.0.0.1:12347";
|
||||||
|
|||||||
Reference in new issue
Block a user