Commit 296affc6 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Make Krypton define KR_VERSION; use it to detect

PUBLISHED_FROM=ea039cdc30aec44db074871ff6b2d2582f98b5c9
parent 1889e12b
...@@ -11,7 +11,7 @@ else ...@@ -11,7 +11,7 @@ else
ifeq ($(SSL_LIB),openssl) ifeq ($(SSL_LIB),openssl)
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto
else ifeq ($(SSL_LIB), krypton) else ifeq ($(SSL_LIB), krypton)
CFLAGS += -DMG_ENABLE_SSL -DMG_DISABLE_PFS -DSSL_KRYPTON ../../../krypton/krypton.c -I../../../krypton CFLAGS += -DMG_ENABLE_SSL -DMG_DISABLE_PFS ../../../krypton/krypton.c -I../../../krypton
endif endif
CFLAGS += -lpthread CFLAGS += -lpthread
endif endif
......
...@@ -2685,7 +2685,7 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *address, ...@@ -2685,7 +2685,7 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *address,
static void mg_set_ssl_server_name(struct mg_connection *nc, static void mg_set_ssl_server_name(struct mg_connection *nc,
const char *server_name) { const char *server_name) {
DBG(("%p '%s'", nc, server_name)); DBG(("%p '%s'", nc, server_name));
#ifdef SSL_KRYPTON #ifdef KR_VERSION
SSL_CTX_kr_set_verify_name(nc->ssl_ctx, server_name); SSL_CTX_kr_set_verify_name(nc->ssl_ctx, server_name);
#elif MG_NET_IF == MG_NET_IF_SIMPLELINK #elif MG_NET_IF == MG_NET_IF_SIMPLELINK
nc->ssl_server_name = strdup(server_name); nc->ssl_server_name = strdup(server_name);
...@@ -12599,7 +12599,7 @@ static err_t mg_lwip_tcp_recv_cb(void *arg, struct tcp_pcb *tpcb, ...@@ -12599,7 +12599,7 @@ static err_t mg_lwip_tcp_recv_cb(void *arg, struct tcp_pcb *tpcb,
static void mg_lwip_handle_recv(struct mg_connection *nc) { static void mg_lwip_handle_recv(struct mg_connection *nc) {
struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock; struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock;
#ifdef SSL_KRYPTON #ifdef KR_VERSION
if (nc->ssl != NULL) { if (nc->ssl != NULL) {
if (nc->flags & MG_F_SSL_HANDSHAKE_DONE) { if (nc->flags & MG_F_SSL_HANDSHAKE_DONE) {
mg_lwip_ssl_recv(nc); mg_lwip_ssl_recv(nc);
...@@ -12743,7 +12743,7 @@ static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) { ...@@ -12743,7 +12743,7 @@ static err_t mg_lwip_accept_cb(void *arg, struct tcp_pcb *newtpcb, err_t err) {
#if LWIP_TCP_KEEPALIVE #if LWIP_TCP_KEEPALIVE
mg_lwip_set_keepalive_params(nc, 60, 10, 6); mg_lwip_set_keepalive_params(nc, 60, 10, 6);
#endif #endif
#ifdef SSL_KRYPTON #ifdef KR_VERSION
if (lc->ssl_ctx != NULL) { if (lc->ssl_ctx != NULL) {
nc->ssl = SSL_new(lc->ssl_ctx); nc->ssl = SSL_new(lc->ssl_ctx);
if (nc->ssl == NULL || SSL_set_fd(nc->ssl, (intptr_t) nc) != 1) { if (nc->ssl == NULL || SSL_set_fd(nc->ssl, (intptr_t) nc) != 1) {
...@@ -13025,7 +13025,7 @@ void mg_ev_mgr_lwip_process_signals(struct mg_mgr *mgr) { ...@@ -13025,7 +13025,7 @@ void mg_ev_mgr_lwip_process_signals(struct mg_mgr *mgr) {
struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock; struct mg_lwip_conn_state *cs = (struct mg_lwip_conn_state *) nc->sock;
switch (md->sig_queue[md->start_index].sig) { switch (md->sig_queue[md->start_index].sig) {
case MG_SIG_CONNECT_RESULT: { case MG_SIG_CONNECT_RESULT: {
#ifdef SSL_KRYPTON #ifdef KR_VERSION
if (cs->err == 0 && nc->flags & MG_F_SSL && if (cs->err == 0 && nc->flags & MG_F_SSL &&
!(nc->flags & MG_F_SSL_HANDSHAKE_DONE)) { !(nc->flags & MG_F_SSL_HANDSHAKE_DONE)) {
SSL_set_fd(nc->ssl, (intptr_t) nc); SSL_set_fd(nc->ssl, (intptr_t) nc);
...@@ -13112,7 +13112,7 @@ time_t mg_lwip_if_poll(struct mg_iface *iface, int timeout_ms) { ...@@ -13112,7 +13112,7 @@ time_t mg_lwip_if_poll(struct mg_iface *iface, int timeout_ms) {
mg_close_conn(nc); mg_close_conn(nc);
continue; continue;
} }
#ifdef SSL_KRYPTON #ifdef KR_VERSION
if (nc->ssl != NULL && cs != NULL && cs->pcb.tcp != NULL && if (nc->ssl != NULL && cs != NULL && cs->pcb.tcp != NULL &&
cs->pcb.tcp->state == ESTABLISHED) { cs->pcb.tcp->state == ESTABLISHED) {
if (((nc->flags & MG_F_WANT_WRITE) || nc->send_mbuf.len > 0) && if (((nc->flags & MG_F_WANT_WRITE) || nc->send_mbuf.len > 0) &&
...@@ -13132,7 +13132,7 @@ time_t mg_lwip_if_poll(struct mg_iface *iface, int timeout_ms) { ...@@ -13132,7 +13132,7 @@ time_t mg_lwip_if_poll(struct mg_iface *iface, int timeout_ms) {
} }
} }
} else } else
#endif /* SSL_KRYPTON */ #endif /* KR_VERSION */
{ {
if (!(nc->flags & (MG_F_CONNECTING | MG_F_UDP))) { if (!(nc->flags & (MG_F_CONNECTING | MG_F_UDP))) {
if (nc->send_mbuf.len > 0) mg_lwip_send_more(nc); if (nc->send_mbuf.len > 0) mg_lwip_send_more(nc);
...@@ -13187,7 +13187,7 @@ uint32_t mg_lwip_get_poll_delay_ms(struct mg_mgr *mgr) { ...@@ -13187,7 +13187,7 @@ uint32_t mg_lwip_get_poll_delay_ms(struct mg_mgr *mgr) {
* All rights reserved * All rights reserved
*/ */
#if MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL && defined(SSL_KRYPTON) #if MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL && MG_ENABLE_SSL && defined(KR_VERSION)
/* Amalgamated: #include "common/cs_dbg.h" */ /* Amalgamated: #include "common/cs_dbg.h" */
...@@ -13346,7 +13346,7 @@ ssize_t kr_recv(int fd, void *buf, size_t len) { ...@@ -13346,7 +13346,7 @@ ssize_t kr_recv(int fd, void *buf, size_t len) {
return len; return len;
} }
#endif /* MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL && defined(SSL_KRYPTON) */ #endif /* MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL && MG_ENABLE_SSL && defined(KR_VERSION) */
#ifdef MG_MODULE_LINES #ifdef MG_MODULE_LINES
#line 1 "common/platforms/wince/wince_libc.c" #line 1 "common/platforms/wince/wince_libc.c"
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment