From 07af9913c3c615201a2fe411186626525cf081cc Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Fri, 31 Jan 2014 08:49:39 +0900 Subject: [PATCH] LwIP native TCP --- IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c | 283 ++ IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h | 68 + IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c | 96 + IDE/IAR-EWARM/CyaSSL/SSL-NB.c | 210 ++ IDE/IAR-EWARM/CyaSSL/SSL-NB.h | 68 + .../Projects/CyaSSL-Lib/CyaSSL-Lib.dep | 1175 ++++++++ .../Projects/CyaSSL-Lib/CyaSSL-Lib.ewd | 2601 +++++++++++++++++ .../Projects/CyaSSL-Lib/CyaSSL-Lib.ewp | 2015 +++++++++++++ .../Projects/CyaSSL-Lib/CyaSSL-Lib.eww | 10 + ctaocrypt/src/random.c | 6 +- cyassl/ctaocrypt/settings.h | 10 + cyassl/internal.h | 10 +- cyassl/ssl.h | 5 +- src/internal.c | 5 + src/io.c | 108 + 15 files changed, 6664 insertions(+), 6 deletions(-) create mode 100644 IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c create mode 100644 IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h create mode 100644 IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c create mode 100644 IDE/IAR-EWARM/CyaSSL/SSL-NB.c create mode 100644 IDE/IAR-EWARM/CyaSSL/SSL-NB.h create mode 100644 IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.dep create mode 100644 IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewd create mode 100644 IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp create mode 100644 IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.eww diff --git a/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c new file mode 100644 index 000000000..b39a22a2e --- /dev/null +++ b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c @@ -0,0 +1,283 @@ +/* HTTPS-NB.c + * + * Copyright (C) 2006-2014 wolfSSL Inc. + * + * This file is part of CyaSSL. + * + * CyaSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * CyaSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#if defined(CYASSL_MDK_ARM) + #include + #include + #include + #include "cyassl_MDK_ARM.h" +#endif + +#if defined(CYASSL_IAR_ARM) + #include + #include +#endif + +#if defined(CYASSL_LWIP) +#include "lwip/tcp.h" +#include "lwip/sockets.h" +#endif + +#include +#include +#include +#include "SSL-NB.h" +#include "HTTPS-NB.h" + +#if 0 +/*Enable debug*/ +#include +#define DBG_PRINTF(x, ...) printf("[HTTPSClient : DBG]"x"\r\n", ##__VA_ARGS__); +#else +/*Disable debug*/ +#define DBG_PRINTF(x, ...) +#endif + +#define ERR_PRINTF(x, ...) printf("[HTTPSClient:ERROR]"x"\r\n", ##__VA_ARGS__); + +static unsigned long localPort = 0 ; +static unsigned long getPort(void) { + return (localPort++ + 0x200) & 0x7fff ; +} + + +static err_t DataConnectedCallback (void *arg, struct tcp_pcb *pcb, s8_t err) +{ + *(enum HTTPS_Stat *)arg = TCP_CONNECTED ; + return ERR_OK; +} + +static err_t DataSentCallback (void *arg, struct tcp_pcb *pcb, u16_t err) +{ + DBG_PRINTF("LwIPtest: Data Sent(SentCallBack1)\n") ; + return ERR_OK; +} + +static err_t DataReceiveCallback(void *cb, struct tcp_pcb *pcb, struct pbuf *p, err_t err) +{ + struct pbuf *next ; + CYASSL_NB *ssl_nb ; + ssl_nb = (CYASSL_NB *)cb ; + + DBG_PRINTF("LwIPtest: Data Received(DataReceiveCallback), pbuf->len=%d, err=%d\n", p->tot_len , err) ; + + if(p==0) { /* throw away */ + return ERR_OK ; + } + if(*(enum HTTPS_Stat *)(ssl_nb->arg) == WAITING) { + *(enum HTTPS_Stat *)(ssl_nb->arg) = HTTP_RECEIVE ; + } else { + CyaSSL_PbufFree(p) ; + tcp_recved(pcb,p->tot_len) ; + return ERR_OK ; + } + /* put it into the queue */ + if(ssl_nb->pbuf) { + next = ssl_nb->pbuf ; + while(1) { + DBG_PRINTF("pbuf=%x, pbuf->next=%x, ",ssl_nb->pbuf, next) ; + if(next->next) + next = next->next ; + else break ; + } + next->next = p ; + ssl_nb->pbuf->tot_len += p->tot_len ; + } else { + ssl_nb->pbuf = p ; + } + ssl_nb->pulled = 0 ; + + if(ssl_nb->wait < 0) + ssl_nb->wait = 1000 ; + ssl_nb->pulled = 0 ; + return ERR_OK; +} + +static int count = 0 ; + +void CyaSSL_HTTPS_Client_NB_init(void *nb, + struct ip_addr svIP, unsigned long svPort, char *host, char *path) +{ + CYASSL_HTTPS_NB *https_nb ; + https_nb = (CYASSL_HTTPS_NB *)nb ; + + https_nb->serverIP_em = svIP ; + https_nb->serverPort = svPort ; + https_nb->hostname = host ; + https_nb->path = path ; + + https_nb->stat = BEGIN ; + +} + +int CyaSSL_HTTPS_Client_NB(void *nb) +{ + char *p ; + int ret ; + CYASSL_HTTPS_NB *https_nb ; + CYASSL_NB *ssl_nb ; + + https_nb = (CYASSL_HTTPS_NB *)nb ; + ssl_nb = (CYASSL_NB *)&(https_nb->ssl_nb) ; + + /*CyaSSL_Debugging_ON() ; */ + + switch(https_nb->stat) { + case BEGIN: + printf("======= LwIP: HTTPS Client Test(%x): %d =========\n", nb, count ++) ; + + p = (char *)malloc(1) ; + printf("Warter mark: %x\n", p) ; + free(p) ; + /*** Assuming LwIP has been initialized ***/ + https_nb->stat = INITIALIZED ; + case INITIALIZED: + https_nb->pcb = tcp_new(); + if(https_nb->pcb) { + tcp_arg(https_nb->pcb, (void *)&(https_nb->stat)) ; + DBG_PRINTF("LwIPtest: New PCB(tcp_new=%x), &https->stat=%x\n", https_nb->pcb, &https_nb->stat) ; + } else { + ERR_PRINTF("tcp_new, ret=%d\n", https_nb->pcb) ; + https_nb->stat = IDLE ; + return !ERR_OK ; + } + + tcp_arg(https_nb->pcb, (void *)&https_nb->stat) ; + + https_nb->localPort = getPort() ; + printf("local Port=%d\n", https_nb->localPort) ; + ret = tcp_bind (https_nb->pcb, &(https_nb->localIP_em), + https_nb->localPort) ; + if(ret == ERR_OK) { + https_nb->stat = TCP_CONNECT ; + return ERR_OK; + } else { + ERR_PRINTF("tcp_bind, ret=%d\n", ret) ; + https_nb->stat = INITIALIZED ; + return !ERR_OK ; + } + + case TCP_CONNECT: + DBG_PRINTF("LwIPtest: TCP_CONNECT\n") ; + DBG_PRINTF("LwIPtest: Server IP Addrress(%d.%d.%d.%d)\n", + (*(unsigned long *)&https_nb->serverIP_em&0xff), + (*(unsigned long *)&https_nb->serverIP_em>>8)&0xff, + (*(unsigned long *)&https_nb->serverIP_em>>16)&0xff, + (*(unsigned long *)&https_nb->serverIP_em>>24)&0xff) ; + + if(CyaSSL_cb_mutex)return ERR_OK ; + else CyaSSL_cb_mutex = 1 ; + ret = tcp_connect(https_nb->pcb, &(https_nb->serverIP_em), + https_nb->serverPort, DataConnectedCallback); + + if(ret == ERR_OK) { + https_nb->stat = WAITING ; + return ERR_OK; + } else { + ERR_PRINTF("tcp_connect, ret=%d\n", ret) ; + https_nb->stat = TCP_CLOSE ; + return !ERR_OK; + } + + case TCP_CONNECTED: + printf("LwIPtest: TCP CONNECTED\n") ; + CyaSSL_cb_mutex = 0 ; + ret = CyaSSL_init_NB(&(https_nb->ssl_nb), https_nb->pcb) ; + if(ret != ERR_OK) { + https_nb->stat = TCP_CLOSE ; + return !ERR_OK ; + } + https_nb->stat = SSL_CONN ; + + case SSL_CONN: /* handshaking */ + ret = CyaSSL_connecting_NB(&(https_nb->ssl_nb)) ; + if(ret == SSL_NB_ERROR) { + ERR_PRINTF("CyaSSL_connecting, ret=%d\n", ret) ; + https_nb->stat = SSL_CLOSE ; + return !ERR_OK ; + } else if(ret == SSL_NB_CONNECTED) + https_nb->stat = HTTP_SEND ; + else return ERR_OK; + + case HTTP_SEND: + { + #define SEND_BUFF_SIZE 100 + char sendBuff[SEND_BUFF_SIZE] ; + int size ; + printf("LwIPtest: SSL CONNECTED\n") ; + CyaSSL_NB_setCallbackArg(ssl_nb, &(https_nb->stat)) ; + tcp_sent(https_nb->pcb, DataSentCallback); + tcp_recv(https_nb->pcb, DataReceiveCallback); + + DBG_PRINTF("LwIPtest: HTTPS GET\n") ; + sprintf(sendBuff, + "GET %s HTTP/1.0\r\nHost: %s\r\nConnection: close\r\n\r\n", + https_nb->path, https_nb->hostname) ; + size = strlen((char const *)sendBuff) ; + + if(CyaSSL_cb_mutex)return ERR_OK ; + else CyaSSL_cb_mutex = 1 ; /* lock */ + CyaSSL_write(ssl_nb->ssl, sendBuff, size) ; + + https_nb->stat = WAITING ; + return ERR_OK; + } + + case HTTP_RECEIVE: + { + #define HTTP_BUFF_SIZE 2048 + char httpbuff[HTTP_BUFF_SIZE] ; + + memset(httpbuff, '\0', HTTP_BUFF_SIZE) ; + ret = CyaSSL_read(ssl_nb->ssl, httpbuff, HTTP_BUFF_SIZE) ; + printf("LwIPtest: HTTPS GET, Received(%d)\n",strlen(httpbuff)) ; + CyaSSL_cb_mutex = 0 ; + /* puts(httpbuff) ;*/ + puts("===================\n") ; + } + case SSL_CLOSE: + CyaSSL_close_NB(ssl_nb) ; + + https_nb->stat = TCP_CLOSE ; + + return ERR_OK ; + + case TCP_CLOSE: + tcp_close(https_nb->pcb) ; + https_nb->idle = 0 ; + https_nb->stat = IDLE ; + + + case IDLE: + https_nb->idle ++ ; + if(https_nb->idle > 50000) + https_nb->stat = BEGIN ; + case WAITING: + default: + return ERR_OK; + } +} diff --git a/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h new file mode 100644 index 000000000..1f88b2abe --- /dev/null +++ b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h @@ -0,0 +1,68 @@ +/* HTTPS-NB.h + * + * Copyright (C) 2006-2014 wolfSSL Inc. + * + * This file is part of CyaSSL. + * + * CyaSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * CyaSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +extern int CyaSSL_GetDataFromPbuf(char *buff, struct pbuf *p, int size) ; + +#define IP4_LONG_2_ADDR(ipaddr, iplong) \ + (ipaddr)->addr = htonl(((u32_t)(iplong) & 0xFF000000) | \ + ((u32_t)(iplong) & 0xFF0000) | \ + ((u32_t)(iplong) & 0xFF00) | \ + (u32_t)(iplong) & 0xFF) + +#define IP_ADDR(a,b,c,d) (((a)|((b)<<8)|((c)<<16)|(d)<<24)) + +enum HTTPS_Stat { + BEGIN, + GET_MYIP, + INITIALIZED, + TCP_CONNECT, + TCP_CONNECTED, + SSL_INIT, + SSL_CONN, + HTTP_SEND, + HTTP_RECEIVE, + HTTP_DONE, + SSL_CLOSE, + TCP_CLOSE, + WAITING, + IDLE +} ; + + +#define HTTPS_PORT 443 + +typedef struct { + CYASSL_NB ssl_nb ; + enum HTTPS_Stat stat ; + struct tcp_pcb * pcb ; + unsigned long ipaddress ; + struct ip_addr localIP_em; + unsigned long localPort ; + struct ip_addr serverIP_em ; + unsigned long serverPort ; + char *hostname ; + char *path ; + int idle ; +} CYASSL_HTTPS_NB ; + +extern void CyaSSL_HTTPS_Client_NB_init(void *nb, + struct ip_addr svIP, unsigned long svPort, char *host, char *path) ; +extern int CyaSSL_HTTPS_Client_NB(void *nb) ; \ No newline at end of file diff --git a/IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c b/IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c new file mode 100644 index 000000000..45bcd31f6 --- /dev/null +++ b/IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c @@ -0,0 +1,96 @@ +/* HTTPS-MAIN.c + * + * Copyright (C) 2006-2014 wolfSSL Inc. + * + * This file is part of CyaSSL. + * + * CyaSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * CyaSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +*/ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include "lwip/tcp.h" +#include "lwip/sockets.h" + +#include +#include +#include +#include "SSL-NB.h" +#include "HTTPS-NB.h" +#include "HTTPS-main.h" + +CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_1 ; +void *CyaSSL_HTTPS_ClientP_1 = (void *)&CyaSSL_HTTPS_Client_1 ; +CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_2 ; +void *CyaSSL_HTTPS_ClientP_2 = (void *)&CyaSSL_HTTPS_Client_2 ; +CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_3 ; +void *CyaSSL_HTTPS_ClientP_3 = (void *)&CyaSSL_HTTPS_Client_3 ; +CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_4 ; +void *CyaSSL_HTTPS_ClientP_4 = (void *)&CyaSSL_HTTPS_Client_4 ; +CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_5 ; +void *CyaSSL_HTTPS_ClientP_5 = (void *)&CyaSSL_HTTPS_Client_5 ; + + +extern void CyaSSL_HTTPS_Client_NB_init(void *nb, + struct ip_addr svIP, unsigned long svPort, char *host, char *path) ; + +#define HTTPS_PORT 443 +#define IP_ADDR(a,b,c,d) (((a)|((b)<<8)|((c)<<16)|(d)<<24)) +static struct ip_addr server_em = { IP_ADDR(192,168,11,9) } ; + +static int i = 0 ; + +void HTTPSClient_main_init() { + + CyaSSL_HTTPS_Client_NB_init(CyaSSL_HTTPS_ClientP_1, + server_em, HTTPS_PORT, "xxx.com", "/") ; + CyaSSL_HTTPS_Client_NB_init(CyaSSL_HTTPS_ClientP_2, + server_em, HTTPS_PORT, "xxx.com", "/") ; + CyaSSL_HTTPS_Client_NB_init(CyaSSL_HTTPS_ClientP_3, + server_em, HTTPS_PORT, "xxx.com", "/") ; + CyaSSL_HTTPS_Client_NB_init(CyaSSL_HTTPS_ClientP_4, + server_em, HTTPS_PORT, "xxx.com", "/") ; + CyaSSL_HTTPS_Client_NB_init(CyaSSL_HTTPS_ClientP_5, + server_em, HTTPS_PORT, "xxx.com", "/") ; +} + +void HTTPSClient_main(void) +{ + + if(i++ < 10000)return ; + + if((i % 1) == 0) { /* wait for initializing TCP/IP, DHCP */ + CyaSSL_HTTPS_Client_NB(CyaSSL_HTTPS_ClientP_1) ; + } + + if((i % 2) == 0) { /* wait for initializing TCP/IP, DHCP */ + CyaSSL_HTTPS_Client_NB(CyaSSL_HTTPS_ClientP_2) ; + } + + if((i % 3) == 0) { /* wait for initializing TCP/IP, DHCP */ + CyaSSL_HTTPS_Client_NB(CyaSSL_HTTPS_ClientP_3) ; + } + + if((i % 4) == 0) { /* wait for initializing TCP/IP, DHCP */ + CyaSSL_HTTPS_Client_NB(CyaSSL_HTTPS_ClientP_4) ; + } +#if 0 + if((i % 5) == 0) { /* wait for initializing TCP/IP, DHCP */ + CyaSSL_HTTPS_Client_NB(CyaSSL_HTTPS_ClientP_5) ; + } +#endif +} \ No newline at end of file diff --git a/IDE/IAR-EWARM/CyaSSL/SSL-NB.c b/IDE/IAR-EWARM/CyaSSL/SSL-NB.c new file mode 100644 index 000000000..36de4d908 --- /dev/null +++ b/IDE/IAR-EWARM/CyaSSL/SSL-NB.c @@ -0,0 +1,210 @@ +/* SSL-NB.c + * + * Copyright (C) 2006-2014 wolfSSL Inc. + * + * This file is part of CyaSSL. + * + * CyaSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * CyaSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#if defined(CYASSL_MDK_ARM) + #include + #include + #include + #include "cyassl_MDK_ARM.h" +#endif + +#if defined(CYASSL_IAR_ARM) + #include + #include +#endif + +#if defined(CYASSL_LWIP) +#include "lwip/tcp.h" +#include "lwip/pbuf.h" +#include "lwip/sockets.h" +#endif + +#include +#include +#include +#include + +#if 0 +/*Enable debug*/ +#include +#define DBG_PRINTF(x, ...) printf("[HTTPSClient : DBG]"x"\r\n", ##__VA_ARGS__); +#else +/*Disable debug*/ +#define DBG_PRINTF(x, ...) +#endif +#define ERR_PRINTF(x, ...) printf("[SSLClient:ERROR]"x"\r\n", ##__VA_ARGS__); + +#if 0 +/*Enable debug*/ +#define DBG_PRINTF_CB(x, ...) printf("[HTTPSClient : DBG]"x"\r\n", ##__VA_ARGS__); +#else +/*Disable debug*/ +#define DBG_PRINTF_CB(x, ...) +#endif + +CyaSSL_CALLBACK_MUTEX CyaSSL_cb_mutex = 0 ; + +static err_t CyaSSL_connectCallback(void *cb, struct tcp_pcb *pcb, struct pbuf *p, s8_t err) +{ + struct pbuf *next ; + CYASSL_NB *ssl_nb ; + ssl_nb = (CYASSL_NB *)cb ; + + if((cb == NULL)||(pcb == NULL)) + ERR_PRINTF("CyaSSL_connectCallBack, cb=%x, pcb=%d\n", cb, pcb) ; + if(p && (err == 0)) { + printf("pbuf=%x\n", p) ; + DBG_PRINTF_CB("LwIPtest: CyaSSL connect, started(CyaSSL_connectCallBack1), pbuf=%x, err=%d, tot_len=%d\n", p, err, p->tot_len) ; + }else { + ERR_PRINTF("CyaSSL_connectCallBack, pbuf=%x, err=%d\n", p, err) ; + return ERR_OK; /* don't go to SSL_CONN */ + } + + if(ssl_nb->pbuf) { + next = ssl_nb->pbuf ; + while(1) { + if(next->next) + next = next->next ; + else break ; + } + next->next = p ; + ssl_nb->pbuf->tot_len += p->tot_len ; + } else { + ssl_nb->pbuf = p ; + } + ssl_nb->pulled = 0 ; + if(ssl_nb->wait < 0) + ssl_nb->wait = 10000 ; + return ERR_OK; +} + +static err_t DataSentCallback (void *arg, struct tcp_pcb *pcb, u16_t err) +{ + DBG_PRINTF_CB("LwIPtest: Data Sent(SentCallBack1), err=%d\n", err) ; + return ERR_OK; +} + +int CyaSSL_init_NB(CYASSL_NB *nb, struct tcp_pcb * pcb) +{ + CYASSL_NB *ssl_nb ; + ssl_nb = nb ; + + /*CyaSSLv3_client_method() + CyaTLSv1_client_method() + CyaTLSv1_1_client_method() + CyaTLSv1_2_client_method() */ + ssl_nb->ctx = CyaSSL_CTX_new(CyaTLSv1_2_client_method()); + if (ssl_nb->ctx == NULL) { + ERR_PRINTF("CyaSSL_CTX_new: unable to get ctx"); + return !ERR_OK ; + } + + CyaSSL_CTX_set_verify(ssl_nb->ctx, SSL_VERIFY_NONE, 0); + + ssl_nb->ssl = CyaSSL_new(ssl_nb->ctx); + if (ssl_nb->ssl == NULL) { + ERR_PRINTF("CyaSSL_new: unable to get SSL object"); + return !ERR_OK ; + } + + ssl_nb->pcb = pcb ; + ssl_nb->pbuf = NULL ; + ssl_nb->pulled = 0 ; + ssl_nb->stat = SSL_NB_CONN ; + + /* set up callbacks */ + CyaSSL_SetIOReadCtx (ssl_nb->ssl, (void *)ssl_nb) ; + CyaSSL_SetIOWriteCtx(ssl_nb->ssl, (void *)ssl_nb) ; + tcp_recv(ssl_nb->pcb, CyaSSL_connectCallback); + tcp_sent(ssl_nb->pcb, DataSentCallback); + tcp_arg(ssl_nb->pcb, (void *)ssl_nb) ; + + CyaSSL_SetVersion(ssl_nb->ssl, CYASSL_TLSV1_2) ; + CyaSSL_set_using_nonblock(ssl_nb->ssl, (0==0)) ; + /* Non-blocking CyaSSL_connect */ + DBG_PRINTF("Return CyaSSL_init_NB = %x\n", ssl_nb) ; + return ERR_OK ; +} + +/*** Non-Bloking Cyassl_connect, ... */ +/* to be called in infinit loop ***/ +int CyaSSL_connecting_NB(CYASSL_NB *ssl_nb) +{ + int ret ; + + switch(ssl_nb->stat) { + case SSL_NB_CONN: + if(CyaSSL_cb_mutex)return SSL_NB_WAITING ; + ret = CyaSSL_connect(ssl_nb->ssl); + DBG_PRINTF("LwIPtest: SSL Connecting(CyaSSL_connect), ret = %d\n", ret) ; + + if(ret == SSL_CONNECT_WAITING) { + if(CyaSSL_cb_mutex) + return SSL_NB_WAITING ; + else CyaSSL_cb_mutex = 1 ; /* lock */ + ssl_nb->wait = -1 ; /* wait until first callback */ + ssl_nb->stat = SSL_NB_WAITING ; + return SSL_NB_CONNECTING ; + } else if(ret == SSL_CONNECTING) { + return SSL_NB_CONNECTING ; + } else if(ret == SSL_SUCCESS) { + ssl_nb->stat = SSL_NB_WAITING ; + DBG_PRINTF("LwIPtest: SSL Connected\n") ; + return SSL_NB_CONNECTED ; + } else { + ret = CyaSSL_get_error(ssl_nb->ssl, NULL) ; + ssl_nb->stat = SSL_NB_WAITING ; + return SSL_NB_CONNECTING ; + } + + case SSL_NB_WAITING: + if(ssl_nb->wait-- == 0) { /* counting down after the callback + for multiple callbacks */ + ssl_nb->stat = SSL_NB_CONN ; + CyaSSL_cb_mutex = 0 ; + } + return SSL_NB_CONNECTING ; + default: + return SSL_NB_ERROR ; + } +} + +/** disconnect */ +int CyaSSL_close_NB(CYASSL_NB *ssl_nb) +{ + CyaSSL_shutdown(ssl_nb->ssl); + CyaSSL_free(ssl_nb->ssl); + CyaSSL_CTX_free(ssl_nb->ctx); + ssl_nb->stat = SSL_NB_BEGIN ; + + return ERR_OK ; +} + +void CyaSSL_NB_setCallbackArg(CYASSL_NB *ssl_nb, void *arg) +{ + ssl_nb->arg = arg ; +} \ No newline at end of file diff --git a/IDE/IAR-EWARM/CyaSSL/SSL-NB.h b/IDE/IAR-EWARM/CyaSSL/SSL-NB.h new file mode 100644 index 000000000..e0b468fa7 --- /dev/null +++ b/IDE/IAR-EWARM/CyaSSL/SSL-NB.h @@ -0,0 +1,68 @@ +/* SSLcon-NB.h + * + * Copyright (C) 2006-2013 wolfSSL Inc. + * + * This file is part of CyaSSL. + * + * CyaSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * CyaSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef __SSLCONN_NB_H__ +#define __SSLCONN_NB_H__ + +#define mem_malloc malloc +#define mem_free free + +enum SSL_Stat { + SSL_NB_BEGIN, + SSL_NB_WAITING, + SSL_NB_CONN, +} ; + +enum SSL_NB_Ret { + SSL_NB_ERROR, + SSL_NB_CONNECTING, + SSL_NB_CONNECTED, +} ; + +typedef struct CyaSSL_nb { + CYASSL *ssl ; + CYASSL_CTX *ctx ; + struct tcp_pcb * pcb ; + int pulled ; + struct pbuf *pbuf ; + enum SSL_Stat stat ; + int wait ; + void * arg ; /* arg for application */ + int idle_count ; +} CYASSL_NB ; + +extern int CyaSSL_init_NB(CYASSL_NB *nb, struct tcp_pcb * pcb) ; +extern int CyaSSL_connecting_NB(CYASSL_NB *ssl_nb) ; +extern int CyaSSL_close_NB(CYASSL_NB *ssl_nb) ; +extern void CyaSSL_NB_setCallbackArg(CYASSL_NB *ssl_nb, void *arg) ; + /* Set it to CYASSL_NB.arg for callback arg */ + +extern int CyaSSL_write(struct CYASSL *pcbSSL, const void *buffer, int len) ; +extern int CyaSSL_recv(struct CYASSL *pcbSSL, void *buffer, int len, int flg) ; +extern int CyaSSL_read(struct CYASSL *pcbSSL, void *buffer, int len) ; + +extern void CyaSSL_PbufFree(struct pbuf * p) ; + +typedef int CyaSSL_CALLBACK_MUTEX ; + +extern CyaSSL_CALLBACK_MUTEX CyaSSL_cb_mutex ; + +#endif diff --git a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.dep b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.dep new file mode 100644 index 000000000..e6feba691 --- /dev/null +++ b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.dep @@ -0,0 +1,1175 @@ + + + + 2 + 1657308038 + + Debug + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rsa.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha256.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha512.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\tfm.c + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\tcp.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\opt.h + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ripemd.c + $TOOLKIT_DIR$\inc\c\stdio.h + $PROJ_DIR$\Debug\Obj\tls.o + $PROJ_DIR$\Debug\Obj\ecc.o + $PROJ_DIR$\Debug\Obj\dsa.o + $PROJ_DIR$\Debug\Obj\asm.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\port\arch\cc.h + $PROJ_DIR$\Debug\Obj\io.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\debug.h + $PROJ_DIR$\Debug\Obj\md2.o + $PROJ_DIR$\Debug\Obj\arc4.o + $PROJ_DIR$\Debug\Obj\SSL-NB.o + $PROJ_DIR$\Debug\Obj\compress.o + $PROJ_DIR$\Debug\Obj\camellia.o + $PROJ_DIR$\Debug\Obj\dh.o + $PROJ_DIR$\Debug\Obj\ecc_fp.o + $PROJ_DIR$\Debug\Obj\internal.o + $PROJ_DIR$\Debug\Obj\hmac.o + $PROJ_DIR$\Debug\Obj\blake2b.o + $PROJ_DIR$\Debug\Obj\des3.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\arch.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\fm3_adaption\lwipopts.h + $PROJ_DIR$\Debug\Obj\integer.o + $PROJ_DIR$\Debug\Obj\logging.o + $PROJ_DIR$\Debug\Obj\HTTPS-NB.o + $PROJ_DIR$\Debug\Obj\hc128.o + $PROJ_DIR$\Debug\Obj\aes.o + $PROJ_DIR$\Debug\Obj\coding.o + $PROJ_DIR$\Debug\Obj\ssl.o + $PROJ_DIR$\Debug\Obj\error.o + $PROJ_DIR$\Debug\Obj\asn.o + $PROJ_DIR$\Debug\Obj\md4.o + $PROJ_DIR$\Debug\Obj\md5.o + $PROJ_DIR$\Debug\Obj\blake2b.pbi + $PROJ_DIR$\Debug\Obj\sha.o + $PROJ_DIR$\Debug\Obj\ripemd.o + $PROJ_DIR$\Debug\Obj\tfm.o + $PROJ_DIR$\Debug\Obj\SSL-NB.pbi + $PROJ_DIR$\Debug\Obj\arc4.pbi + $PROJ_DIR$\Debug\Obj\compress.pbi + $PROJ_DIR$\Debug\Obj\random.o + $PROJ_DIR$\Debug\Obj\camellia.pbi + $PROJ_DIR$\Debug\Obj\aes.pbi + $PROJ_DIR$\Debug\Obj\port.o + $PROJ_DIR$\Debug\Obj\keys.pbi + $PROJ_DIR$\Debug\Obj\asn.pbi + $PROJ_DIR$\Debug\Obj\internal.pbi + $PROJ_DIR$\Debug\Obj\des3.pbi + $PROJ_DIR$\Debug\Obj\ssl.pbi + $PROJ_DIR$\Debug\Obj\HTTPS-maic.pbi + $PROJ_DIR$\Debug\Obj\coding.pbi + $PROJ_DIR$\Debug\Obj\asm.pbi + $PROJ_DIR$\Debug\Obj\pwdbased.o + $PROJ_DIR$\Debug\Obj\dh.pbi + $PROJ_DIR$\Debug\Obj\keys.o + $PROJ_DIR$\Debug\Obj\sha256.o + $PROJ_DIR$\Debug\Obj\HTTPS-maic.o + $PROJ_DIR$\Debug\Obj\rabbit.o + $PROJ_DIR$\Debug\Obj\tls.pbi + $PROJ_DIR$\Debug\Obj\memory.o + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dsa.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\error.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\logging.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\des3.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md2.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\pwdbased.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rabbit.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hmac.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hc128.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md5.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asm.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\blake2b.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\camellia.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\integer.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md4.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\random.c + $PROJ_DIR$\..\..\..\..\src\tls.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dh.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\aes.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory-orig.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\compress.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\misc.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\port.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\arc4.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asn.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\coding.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc_fp.c + $PROJ_DIR$\..\..\CyaSSL\SSL-NB.c + $PROJ_DIR$\..\..\..\..\src\internal.c + $PROJ_DIR$\..\..\CyaSSL\HTTPS-NB.c + $PROJ_DIR$\..\..\..\..\src\io.c + $PROJ_DIR$\Debug\Obj\CyaSSL-Lib.pbd + $PROJ_DIR$\..\..\..\..\src\ssl.c + $PROJ_DIR$\..\..\..\..\src\keys.c + $PROJ_DIR$\..\..\CyaSSL\HTTPS-maic.c + $PROJ_DIR$\Debug\Obj\tfm.pbi + $PROJ_DIR$\Debug\Exe\CyaSSL-Lib.a + $TOOLKIT_DIR$\inc\c\ycheck.h + $TOOLKIT_DIR$\inc\c\yvals.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\port\arch\bpstruct.h + $PROJ_DIR$\Debug\Obj\memory.pbi + $PROJ_DIR$\Debug\Obj\logging.pbi + $PROJ_DIR$\Debug\Obj\pwdbased.pbi + $PROJ_DIR$\Debug\Obj\md5.pbi + $PROJ_DIR$\Debug\Obj\rsa.o + $PROJ_DIR$\Debug\Obj\sha256.pbi + $PROJ_DIR$\Debug\Obj\io.pbi + $PROJ_DIR$\Debug\Obj\rsa.pbi + $PROJ_DIR$\Debug\Obj\random.pbi + $PROJ_DIR$\Debug\Obj\md2.pbi + $PROJ_DIR$\Debug\Obj\error.pbi + $PROJ_DIR$\Debug\Obj\ecc_fp.pbi + $PROJ_DIR$\Debug\Obj\hmac.pbi + $PROJ_DIR$\Debug\Obj\md4.pbi + $PROJ_DIR$\Debug\Obj\integer.pbi + $PROJ_DIR$\Debug\Obj\sha512.o + $PROJ_DIR$\Debug\Obj\misc.pbi + $PROJ_DIR$\Debug\Obj\misc.o + $PROJ_DIR$\Debug\Obj\rabbit.pbi + $PROJ_DIR$\Debug\Obj\dsa.pbi + $PROJ_DIR$\Debug\Obj\ripemd.pbi + $PROJ_DIR$\Debug\Obj\ecc.pbi + $PROJ_DIR$\Debug\Obj\port.pbi + $PROJ_DIR$\Debug\Obj\hc128.pbi + $PROJ_DIR$\Debug\Obj\sha512.pbi + $PROJ_DIR$\Debug\Obj\HTTPS-NB.pbi + $PROJ_DIR$\Debug\Obj\sha.pbi + $TOOLKIT_DIR$\inc\c\ysizet.h + $PROJ_DIR$\..\..\..\..\cyassl\ssl.h + $TOOLKIT_DIR$\inc\c\DLib_Threads.h + $TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\port\arch\epstruct.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\visibility.h + $PROJ_DIR$\..\..\CyaSSL\HTTPS-main.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\settings.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\ipv4\lwip\ip.h + $PROJ_DIR$\..\..\CyaSSL\SSL-NB.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\sys.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\netif.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\mem.h + $TOOLKIT_DIR$\inc\c\DLib_Defaults.h + $TOOLKIT_DIR$\inc\c\stdint.h + $TOOLKIT_DIR$\inc\c\ystdio.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\err.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\pbuf.h + $TOOLKIT_DIR$\inc\c\xencoding_limits.h + $TOOLKIT_DIR$\inc\c\DLib_Product.h + $TOOLKIT_DIR$\inc\c\inttypes.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\sockets.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\def.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\ipv4\lwip\icmp.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\ipv4\lwip\ip_addr.h + $TOOLKIT_DIR$\inc\c\DLib_Product_string.h + $PROJ_DIR$\..\..\..\..\cyassl\version.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\arc4.h + $TOOLKIT_DIR$\inc\c\stdlib.h + $TOOLKIT_DIR$\inc\c\xtls.h + $TOOLKIT_DIR$\inc\c\xmtx.h + $TOOLKIT_DIR$\inc\c\xlocale_c.h + $TOOLKIT_DIR$\inc\c\wchar.h + $TOOLKIT_DIR$\inc\c\xtgmath.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\des3.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\hc128.h + $TOOLKIT_DIR$\inc\c\xlocale.h + $TOOLKIT_DIR$\inc\c\xlocaleuse.h + $PROJ_DIR$\..\..\CyaSSL\HTTPS-NB.h + $PROJ_DIR$\..\..\..\..\cyassl\crl.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\integer.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\asn_public.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\memory.h + $TOOLKIT_DIR$\inc\c\math.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\md4.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\types.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\random.h + $TOOLKIT_DIR$\inc\c\ctype.h + $PROJ_DIR$\..\..\..\..\cyassl\internal.h + $TOOLKIT_DIR$\inc\c\limits.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\port.h + $TOOLKIT_DIR$\inc\c\ymath.h + $TOOLKIT_DIR$\inc\c\string.h + $TOOLKIT_DIR$\inc\c\time.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\error.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\mpi_class.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\dsa.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\mpi_superclass.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\sha.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\hmac.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\dh.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\camellia.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\coding.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\md2.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\misc.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\sha512.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\rabbit.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\pwdbased.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\logging.h + $PROJ_DIR$\..\..\..\..\cyassl\error.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\aes.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\rsa.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\sha256.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\md5.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\ecc.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\asn.h + + + [ROOT_NODE] + + + IARCHIVE + 105 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rsa.c + + + ICCARM + 113 + + + BICOMP + 116 + + + + + ICCARM + 143 141 207 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 176 185 191 193 182 163 190 204 + + + BICOMP + 143 141 207 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 176 185 191 193 182 163 190 204 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha.c + + + ICCARM + 41 + + + BICOMP + 135 + + + + + ICCARM + 143 141 194 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + BICOMP + 143 141 194 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha256.c + + + ICCARM + 62 + + + BICOMP + 114 + + + + + ICCARM + 143 141 208 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + BICOMP + 143 141 208 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha512.c + + + ICCARM + 124 + + + BICOMP + 133 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\tfm.c + + + ICCARM + 43 + + + BICOMP + 104 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ripemd.c + + + ICCARM + 42 + + + BICOMP + 129 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dsa.c + + + ICCARM + 11 + + + BICOMP + 128 + + + + + ICCARM + 143 141 192 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 176 185 191 193 182 163 194 190 + + + BICOMP + 143 141 192 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 176 185 191 193 182 163 194 190 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\error.c + + + ICCARM + 36 + + + BICOMP + 119 + + + + + ICCARM + 143 141 190 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + BICOMP + 143 141 190 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\logging.c + + + ICCARM + 30 + + + BICOMP + 110 + + + + + ICCARM + 143 141 204 190 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + BICOMP + 143 141 204 190 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\des3.c + + + ICCARM + 26 + + + BICOMP + 54 + + + + + ICCARM + 143 141 170 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + BICOMP + 143 141 170 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md2.c + + + ICCARM + 16 + + + BICOMP + 118 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\pwdbased.c + + + ICCARM + 59 + + + BICOMP + 111 + + + + + ICCARM + 143 141 203 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 209 194 195 208 176 185 191 193 190 90 200 + + + BICOMP + 143 141 203 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 209 194 195 208 176 185 191 193 190 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rabbit.c + + + ICCARM + 64 + + + BICOMP + 127 + + + + + ICCARM + 143 141 202 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 204 90 200 + + + BICOMP + 143 141 202 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 204 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hmac.c + + + ICCARM + 24 + + + BICOMP + 121 + + + + + ICCARM + 143 141 195 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 209 194 208 190 + + + BICOMP + 143 141 195 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 209 194 208 190 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc.c + + + ICCARM + 10 + + + BICOMP + 130 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hc128.c + + + ICCARM + 32 + + + BICOMP + 132 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md5.c + + + ICCARM + 39 + + + BICOMP + 112 + + + + + ICCARM + 143 141 209 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + BICOMP + 143 141 209 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asm.c + + + ICCARM + 12 + + + BICOMP + 58 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\blake2b.c + + + ICCARM + 25 + + + BICOMP + 40 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\camellia.c + + + ICCARM + 20 + + + BICOMP + 48 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\integer.c + + + ICCARM + 29 + + + BICOMP + 123 + + + + + ICCARM + 143 141 176 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 185 191 193 + + + BICOMP + 143 141 176 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 185 191 193 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md4.c + + + ICCARM + 38 + + + BICOMP + 122 + + + + + ICCARM + 143 141 180 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + BICOMP + 143 141 180 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\random.c + + + ICCARM + 47 + + + BICOMP + 117 + + + + + ICCARM + 143 141 182 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 163 190 + + + BICOMP + 143 141 182 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 163 190 + + + + + $PROJ_DIR$\..\..\..\..\src\tls.c + + + ICCARM + 9 + + + BICOMP + 65 + + + + + ICCARM + 143 141 137 162 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 + + + BICOMP + 143 141 137 162 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory.c + + + ICCARM + 66 + + + BICOMP + 109 + + + + + ICCARM + 143 141 178 164 106 107 149 139 155 154 138 136 190 181 186 188 161 183 172 165 166 173 167 168 + + + BICOMP + 143 141 178 164 106 107 149 139 155 154 138 136 190 181 186 188 161 183 172 165 166 173 167 168 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dh.c + + + ICCARM + 21 + + + BICOMP + 60 + + + + + ICCARM + 143 141 196 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 176 185 191 193 182 163 190 179 187 169 + + + BICOMP + 143 141 196 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 176 185 191 193 182 163 190 179 187 169 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\aes.c + + + ICCARM + 33 + + + BICOMP + 49 + + + + + ICCARM + 143 141 206 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 204 90 200 + + + BICOMP + 143 141 206 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 204 90 200 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\compress.c + + + ICCARM + 19 + + + BICOMP + 46 + + + + + ICCARM + 143 141 + + + BICOMP + 143 141 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\misc.c + + + ICCARM + 126 + + + BICOMP + 125 + + + + + ICCARM + 143 141 200 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + BICOMP + 143 141 200 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\port.c + + + ICCARM + 50 + + + BICOMP + 131 + + + + + ICCARM + 143 141 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 + + + BICOMP + 143 141 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\arc4.c + + + ICCARM + 17 + + + BICOMP + 45 + + + + + ICCARM + 143 141 163 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + BICOMP + 143 141 163 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asn.c + + + ICCARM + 37 + + + BICOMP + 52 + + + + + ICCARM + 143 141 176 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 185 191 193 211 207 182 163 196 192 194 209 177 210 198 199 190 203 170 208 201 204 189 + + + BICOMP + 143 141 176 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 185 191 193 211 207 182 163 196 192 194 209 177 210 198 199 190 203 170 208 201 204 189 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\coding.c + + + ICCARM + 34 + + + BICOMP + 57 + + + + + ICCARM + 143 141 198 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 204 + + + BICOMP + 143 141 198 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 190 204 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc_fp.c + + + ICCARM + 22 + + + BICOMP + 120 + + + + + $PROJ_DIR$\..\..\CyaSSL\SSL-NB.c + + + ICCARM + 18 + + + BICOMP + 44 + + + + + ICCARM + 143 141 8 106 107 149 139 155 154 138 136 151 188 161 5 6 28 15 27 13 156 150 146 148 153 152 144 158 160 108 140 147 159 157 137 162 184 181 186 178 164 183 172 165 166 173 167 168 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 145 + + + BICOMP + 143 141 8 106 107 149 139 155 154 138 136 151 188 161 5 6 28 15 27 13 156 150 146 148 153 152 144 158 160 108 140 147 159 157 137 162 184 181 186 178 164 183 172 165 166 173 167 168 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 145 + + + + + $PROJ_DIR$\..\..\..\..\src\internal.c + + + ICCARM + 23 + + + BICOMP + 53 + + + + + ICCARM + 143 141 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 137 162 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 189 + + + BICOMP + 143 141 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 137 162 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 189 + + + + + $PROJ_DIR$\..\..\CyaSSL\HTTPS-NB.c + + + ICCARM + 31 + + + BICOMP + 134 + + + + + ICCARM + 143 141 8 106 107 149 139 155 154 138 136 151 188 161 5 6 28 15 27 13 156 150 146 148 153 152 144 158 160 108 140 147 159 157 137 162 178 164 145 174 + + + BICOMP + 143 141 8 106 107 149 139 155 154 138 136 151 188 161 5 6 28 15 27 13 156 150 146 148 153 152 144 158 160 108 140 147 159 157 137 162 178 164 145 174 + + + + + $PROJ_DIR$\..\..\..\..\src\io.c + + + ICCARM + 14 + + + BICOMP + 115 + + + + + ICCARM + 143 141 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 137 162 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 5 6 28 15 27 13 8 151 156 150 146 148 153 152 144 158 160 108 140 147 159 157 145 + + + BICOMP + 143 141 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 137 162 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 5 6 28 15 27 13 8 151 156 150 146 148 153 152 144 158 160 108 140 147 159 157 145 + + + + + $PROJ_DIR$\..\..\..\..\src\ssl.c + + + ICCARM + 35 + + + BICOMP + 55 + + + + + ICCARM + 143 141 137 162 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 198 + + + BICOMP + 143 141 137 162 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 198 + + + + + $PROJ_DIR$\..\..\..\..\src\keys.c + + + ICCARM + 61 + + + BICOMP + 51 + + + + + ICCARM + 143 141 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 137 162 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 + + + BICOMP + 143 141 184 181 186 178 164 106 107 149 139 155 154 138 136 188 161 183 172 165 166 173 167 168 137 162 175 182 163 170 171 202 211 207 176 185 191 193 196 192 194 209 177 210 206 197 204 195 208 205 190 + + + + + $PROJ_DIR$\..\..\CyaSSL\HTTPS-maic.c + + + ICCARM + 63 + + + BICOMP + 56 + + + + + ICCARM + 5 6 28 15 27 13 8 106 107 149 139 155 154 138 136 151 156 150 146 148 153 152 144 158 160 108 140 147 159 157 143 141 137 162 178 164 145 174 142 + + + BICOMP + 5 6 28 15 27 13 8 106 107 149 139 155 154 138 136 151 156 150 146 148 153 152 144 158 160 108 140 147 159 157 143 141 137 162 178 164 145 174 142 + + + + + + Release + + + [MULTI_TOOL] + ILINK + + + + + diff --git a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewd b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewd new file mode 100644 index 000000000..258cae677 --- /dev/null +++ b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewd @@ -0,0 +1,2601 @@ + + + + 2 + + Debug + + ARM + + 1 + + C-SPY + 2 + + 25 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + CMSISDAP_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + IJET_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + XDS100_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + Release + + ARM + + 0 + + C-SPY + 2 + + 25 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 0 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + CMSISDAP_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 0 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 0 + + + + + + + + + IJET_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 15 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 0 + + + + + + + + XDS100_ID + 2 + + 2 + 1 + 0 + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\PowerPac\PowerPacRTOS.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB6_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + + diff --git a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp new file mode 100644 index 000000000..6ab3883f3 --- /dev/null +++ b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp @@ -0,0 +1,2015 @@ + + + + 2 + + Debug + + ARM + + 1 + + General + 3 + + 22 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 29 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Release + + ARM + + 0 + + General + 3 + + 22 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 29 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 0 + + + + + + + + + CUSTOM + 3 + + + + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 16 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 0 + + + + + + + BILINK + 0 + + + + + Apps + + $PROJ_DIR$\..\..\CyaSSL\HTTPS-maic.c + + + $PROJ_DIR$\..\..\CyaSSL\HTTPS-NB.c + + + $PROJ_DIR$\..\..\CyaSSL\SSL-NB.c + + + + CyaSSL + + $PROJ_DIR$\..\..\..\..\src\internal.c + + + $PROJ_DIR$\..\..\..\..\src\io.c + + + $PROJ_DIR$\..\..\..\..\src\keys.c + + + $PROJ_DIR$\..\..\..\..\src\ssl.c + + + $PROJ_DIR$\..\..\..\..\src\tls.c + + + + wolfCrypt + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\aes.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\arc4.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asm.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asn.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\blake2b.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\camellia.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\coding.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\compress.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\des3.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dh.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dsa.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc_fp.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\error.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hc128.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hmac.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\integer.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\logging.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md2.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md4.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md5.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory-orig.c + + Debug + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\misc.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\port.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\pwdbased.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rabbit.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\random.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ripemd.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rsa.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha256.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha512.c + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\tfm.c + + + + + diff --git a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.eww b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.eww new file mode 100644 index 000000000..17ce82d66 --- /dev/null +++ b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\CyaSSL-Lib.ewp + + + + + diff --git a/ctaocrypt/src/random.c b/ctaocrypt/src/random.c index 03dd75553..f88aab83b 100644 --- a/ctaocrypt/src/random.c +++ b/ctaocrypt/src/random.c @@ -51,7 +51,8 @@ #include #include #else - #if !defined(NO_DEV_RANDOM) && !defined(CYASSL_MDK_ARM) + #if !defined(NO_DEV_RANDOM) && !defined(CYASSL_MDK_ARM) \ + && !defined(CYASSL_IAR_ARM) #include #ifndef EBSNET #include @@ -484,7 +485,8 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz) return 0; } -#elif defined(CYASSL_SAFERTOS) || defined(CYASSL_LEANPSK) +#elif defined(CYASSL_SAFERTOS) || defined(CYASSL_LEANPSK) \ + || defined(CYASSL_IAR_ARM) #warning "write a real random seed!!!!, just for testing now" diff --git a/cyassl/ctaocrypt/settings.h b/cyassl/ctaocrypt/settings.h index 22dea06d0..07926942b 100644 --- a/cyassl/ctaocrypt/settings.h +++ b/cyassl/ctaocrypt/settings.h @@ -81,6 +81,8 @@ /* Uncomment next line if using QL SEP settings */ /* #define CYASSL_QL */ +/* Uncomment next line if using LwIP native TCP socket settings */ +/* #define HAVE_LWIP_NATIVE */ #include @@ -114,6 +116,14 @@ #include "nx_api.h" #endif +#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ + #define CYASSL_LWIP + #define NO_WRITEV + #define SINGLE_THREADED + #define CYASSL_USER_IO + #define NO_FILESYSTEM +#endif + #ifdef MICROCHIP_PIC32 #define SIZEOF_LONG_LONG 8 #define SINGLE_THREADED diff --git a/cyassl/internal.h b/cyassl/internal.h index 085d2a393..44f6cd347 100644 --- a/cyassl/internal.h +++ b/cyassl/internal.h @@ -960,8 +960,11 @@ int SetCipherList(Suites*, const char* list); #ifdef HAVE_NETX CYASSL_LOCAL int NetX_Receive(CYASSL *ssl, char *buf, int sz, void *ctx); CYASSL_LOCAL int NetX_Send(CYASSL *ssl, char *buf, int sz, void *ctx); -#endif /* HAVE_NETX */ - +#endif +#ifdef HAVE_LWIP_NATIVE + CYASSL_LOCAL int CyaSSL_LwIP_Send(CYASSL* ssl, char *buf, int sz, void *cb); + CYASSL_LOCAL int CyaSSL_LwIP_Receive(CYASSL* ssl, char *buf, int sz, void *cb); +#endif /* HAVE_{tcp stack} */ /* CyaSSL Cipher type just points back to SSL */ struct CYASSL_CIPHER { @@ -1515,7 +1518,8 @@ typedef void (*hmacfp) (CYASSL*, byte*, const byte*, word32, int, int); /* client connect state for nonblocking restart */ enum ConnectState { - CONNECT_BEGIN = 0, + CONNECT_INITIAL = 0, + CONNECT_BEGIN, CLIENT_HELLO_SENT, HELLO_AGAIN, /* HELLO_AGAIN s for DTLS case */ HELLO_AGAIN_REPLY, diff --git a/cyassl/ssl.h b/cyassl/ssl.h index 049e0d5eb..6f98483b8 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -675,7 +675,10 @@ enum { /* ssl Constants */ SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 103, SSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 104, - PEM_BUFSIZE = 1024 + PEM_BUFSIZE = 1024, + /* for non-blocking CyaSSL_connect */ + SSL_CONNECTING = 201, /* Ready for the next step */ + SSL_CONNECT_WAITING = 202 /* Waiting for the response */ }; diff --git a/src/internal.c b/src/internal.c index 0f438dd1b..28e6b85b3 100644 --- a/src/internal.c +++ b/src/internal.c @@ -397,6 +397,11 @@ int InitSSL_Ctx(CYASSL_CTX* ctx, CYASSL_METHOD* method) ctx->CBIORecv = NetX_Receive; ctx->CBIOSend = NetX_Send; #endif +#ifdef HAVE_LWIP_NATIVE + ctx->CBIORecv = CyaSSL_LwIP_Receive ; + ctx->CBIOSend = CyaSSL_LwIP_Send ; +#endif + ctx->partialWrite = 0; ctx->verifyCallback = 0; diff --git a/src/io.c b/src/io.c index 55f28eed3..bb4bb1ec2 100644 --- a/src/io.c +++ b/src/io.c @@ -1045,3 +1045,111 @@ void CyaSSL_SetIO_NetX(CYASSL* ssl, NX_TCP_SOCKET* nxSocket, ULONG waitOption) #endif /* HAVE_NETX */ +#ifdef HAVE_LWIP_NATIVE + +#include "lwip/tcp.h" +#include "lwip/pbuf.h" +#include "lwip/sockets.h" +#include "SSL-NB.h" + +#if 0 +/*Enable debug*/ +#define DBG_PRINTF_CB(x, ...) printf("[HTTPSClient : DBG]"x"\r\n", ##__VA_ARGS__); +#else +/*Disable debug*/ +#define DBG_PRINTF_CB(x, ...) +#endif + +void CyaSSL_PbufFree(struct pbuf *p) +{ + struct pbuf * next; + while(p->next != NULL) + { + next = p->next; + pbuf_free(p); + p = next; + } + pbuf_free(p); +} + +static int CyaSSL_GetDataFromPbuf(char *buff, CYASSL_NB *ssl_nb, int size) +{ + struct pbuf *p ; + struct pbuf *p_next ; + int totalLen ; + int skipLen = 0 ; + + p = ssl_nb->pbuf ; + if(p->tot_len < (ssl_nb->pulled + size)) + return 0 ; + + while(p) { /* skip the part pulled before */ + if(p->len && p->len > (ssl_nb->pulled - skipLen) ){ + skipLen = (ssl_nb->pulled - skipLen) ; + break ; + } else { + skipLen += p->len ; + if(p->next) + p = p->next ; + else return 0 ; + } + } + + totalLen = 0 ; + while(p){ + if(p->len) { + if((p->len - skipLen) > (size - totalLen)) { /* buffer full */ + memcpy(&buff[totalLen], (const char *)&(((char *)(p->payload))[skipLen]), size-totalLen) ; + totalLen = size ; + break ; + } else { + memcpy(&buff[totalLen], (const char *)&(((char *)(p->payload))[skipLen]), p->len - skipLen) ; + totalLen += (p->len-skipLen) ; + skipLen = 0 ; + } + } + if(p->next){ + p_next = p->next ; + p = p_next ; + } else break ; + } + ssl_nb->pulled += totalLen ; + if(ssl_nb->pbuf->tot_len <= ssl_nb->pulled) { + CyaSSL_PbufFree(ssl_nb->pbuf) ; + ssl_nb->pbuf = NULL ; + tcp_recved(ssl_nb->pcb,ssl_nb->pbuf->tot_len) ; + } + return totalLen; +} + +int CyaSSL_LwIP_Receive(CYASSL* ssl, char *buf, int sz, void *cb) +{ + int ret ; + CYASSL_NB *ssl_nb ; + ssl_nb = (CYASSL_NB *)cb ; + DBG_PRINTF_CB("CyaSSL_LwIP_Receive: ssl_nb = %x\n", ssl_nb) ; + + if(ssl_nb->pbuf) { + DBG_PRINTF_CB("Received Len=%d, Want Len= %d\n", ssl_nb->pbuf->tot_len, sz) ; + ret = CyaSSL_GetDataFromPbuf(buf, ssl_nb, sz) ; + if(ret == 0) + ret = CYASSL_CBIO_ERR_WANT_READ ; + } else { + DBG_PRINTF_CB("No Received Data\n") ; + ret = CYASSL_CBIO_ERR_WANT_READ ; + } + return ret ; +} + +int CyaSSL_LwIP_Send(CYASSL* ssl, char *buf, int sz, void *cb) +{ + CYASSL_NB *ssl_nb ; + ssl_nb = (CYASSL_NB *)cb ; + DBG_PRINTF_CB("CyaSSL_LwIP_Send: ssl_nb = %x\n", ssl_nb) ; + DBG_PRINTF_CB("Send buf[0,1,2,3]=%x,%x,%x,%x, sz=%d\n", buf[0], buf[1], buf[2], buf[3], sz) ; + tcp_write(ssl_nb->pcb, buf, sz, TCP_WRITE_FLAG_COPY) ; + return sz ; +} +#endif /* HAVE_LWIP_NATIVE */ + +