From e39308f0596079542958f223c1949916572bb797 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Mon, 3 Feb 2014 09:18:48 +0900 Subject: [PATCH] Take LwIP native TCP socket into io.c --- IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c | 267 ++- IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h | 12 +- IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c | 96 - IDE/IAR-EWARM/CyaSSL/HTTPS-main.h | 34 - IDE/IAR-EWARM/CyaSSL/SSL-NB.c | 210 -- IDE/IAR-EWARM/CyaSSL/SSL-NB.h | 68 - .../Projects/CyaSSL-Lib/CyaSSL-Lib.dep | 2048 ++++++++-------- .../Projects/CyaSSL-Lib/CyaSSL-Lib.ewp | 10 +- cyassl/internal.h | 19 +- cyassl/internal.h.orig | 2121 ----------------- cyassl/ssl.h | 9 +- src/internal.c | 4 + src/io.c | 117 +- 13 files changed, 1323 insertions(+), 3692 deletions(-) delete mode 100644 IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c delete mode 100644 IDE/IAR-EWARM/CyaSSL/HTTPS-main.h delete mode 100644 IDE/IAR-EWARM/CyaSSL/SSL-NB.c delete mode 100644 IDE/IAR-EWARM/CyaSSL/SSL-NB.h delete mode 100644 cyassl/internal.h.orig diff --git a/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c index b39a22a2e..bd0e005a6 100644 --- a/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c +++ b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.c @@ -24,29 +24,22 @@ #endif #include - -#if defined(CYASSL_MDK_ARM) - #include - #include - #include - #include "cyassl_MDK_ARM.h" -#endif + +#if defined(HAVE_LWIP_NATIVE) #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 -#include "SSL-NB.h" -#include "HTTPS-NB.h" +#include "https-nb.h" #if 0 /*Enable debug*/ @@ -58,65 +51,69 @@ #endif #define ERR_PRINTF(x, ...) printf("[HTTPSClient:ERROR]"x"\r\n", ##__VA_ARGS__); + +static int LwIP_cb_mutex = 0 ; 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) { + DBG_PRINTF("DataConnectedCallback(arg=%x, pcb=%x, err=%x)\n", arg, pcb, 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) +static err_t DataReceiveCallback(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) { struct pbuf *next ; - CYASSL_NB *ssl_nb ; - ssl_nb = (CYASSL_NB *)cb ; + CYASSL *ssl ; + ssl = (CYASSL *)arg ; 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 ; + if(*(enum HTTPS_Stat *)(ssl->lwipCtx.arg) == WAITING) { + *(enum HTTPS_Stat *)(ssl->lwipCtx.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 ; + if(ssl->lwipCtx.pbuf) { + next = ssl->lwipCtx.pbuf ; while(1) { - DBG_PRINTF("pbuf=%x, pbuf->next=%x, ",ssl_nb->pbuf, next) ; + DBG_PRINTF("pbuf=%x, pbuf->next=%x, ",ssl->lwipCtx.pbuf, next) ; if(next->next) next = next->next ; else break ; } next->next = p ; - ssl_nb->pbuf->tot_len += p->tot_len ; + ssl->lwipCtx.pbuf->tot_len += p->tot_len ; } else { - ssl_nb->pbuf = p ; + ssl->lwipCtx.pbuf = p ; } - ssl_nb->pulled = 0 ; + ssl->lwipCtx.pulled = 0 ; - if(ssl_nb->wait < 0) - ssl_nb->wait = 1000 ; - ssl_nb->pulled = 0 ; + if(ssl->lwipCtx.wait < 0) + ssl->lwipCtx.wait = 1000 ; + ssl->lwipCtx.pulled = 0 ; return ERR_OK; } + static int count = 0 ; void CyaSSL_HTTPS_Client_NB_init(void *nb, @@ -129,30 +126,27 @@ void CyaSSL_HTTPS_Client_NB_init(void *nb, 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() ; */ + 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) ; + { + void * p ; + p = (void *)malloc(1) ; + printf("Watermark=%x\n", p) ; + free(p) ; + } /*** Assuming LwIP has been initialized ***/ https_nb->stat = INITIALIZED ; case INITIALIZED: @@ -165,11 +159,11 @@ int CyaSSL_HTTPS_Client_NB(void *nb) 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) ; + DBG_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) { @@ -182,15 +176,14 @@ int CyaSSL_HTTPS_Client_NB(void *nb) } case TCP_CONNECT: - DBG_PRINTF("LwIPtest: TCP_CONNECT\n") ; + if(LwIP_cb_mutex)return ERR_OK ; + else LwIP_cb_mutex = 1 ; + DBG_PRINTF("LwIPtest: TCP_CONNECT(%x)\n", https_nb) ; 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); @@ -204,80 +197,186 @@ int CyaSSL_HTTPS_Client_NB(void *nb) } 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 ; + printf("LwIPtest: TCP CONNECTED(%x)\n", https_nb) ; + LwIP_cb_mutex = 0 ; + + /*CyaSSLv3_client_method() + CyaTLSv1_client_method() + CyaTLSv1_1_client_method() + CyaTLSv1_2_client_method() */ + https_nb->ctx = CyaSSL_CTX_new(CyaTLSv1_2_client_method()); + if (https_nb->ctx == NULL) { + ERR_PRINTF("CyaSSL_CTX_new: unable to get ctx"); return !ERR_OK ; } - https_nb->stat = SSL_CONN ; + + CyaSSL_CTX_set_verify(https_nb->ctx, SSL_VERIFY_NONE, 0); + + https_nb->ssl = CyaSSL_new(https_nb->ctx); + if (https_nb->ssl == NULL) { + ERR_PRINTF("CyaSSL_new: unable to get SSL object"); + return !ERR_OK ; + } + + CyaSSL_SetIO_LwIP(https_nb->ssl, https_nb->pcb); + CyaSSL_SetVersion(https_nb->ssl, CYASSL_TLSV1_2) ; + 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; + + if(LwIP_cb_mutex) return ERR_OK ; + ret = CyaSSL_connect(https_nb->ssl); + DBG_PRINTF("LwIPtest: SSL Connecting(CyaSSL_connect), ret = %d\n", ret) ; + if(ret == SSL_SUCCESS) { + https_nb->stat = SSL_CONN_WAITING ; + DBG_PRINTF("LwIPtest: SSL Connected\n") ; + https_nb->stat = HTTP_SEND ; + } else { + ret = CyaSSL_get_error(https_nb->ssl, NULL) ; + if(ret == SSL_ERROR_WANT_READ) { + https_nb->ssl->lwipCtx.wait = -1 ; + https_nb->stat = SSL_CONN_WAITING ; + return ERR_OK ; + } else { + ERR_PRINTF("CyaSSL_connecting_NB:ssl=%x, ret=%d\n", https_nb->ssl, ret) ; + return !ERR_OK ; + } + } + return ERR_OK ; + case SSL_CONN_WAITING: + if(https_nb->ssl->lwipCtx.wait-- == 0) { /* counting down after the callback + for multiple callbacks */ + https_nb->stat = SSL_CONN ; + LwIP_cb_mutex = 0 ; + } + 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)) ; + if(LwIP_cb_mutex)return ERR_OK ; + else LwIP_cb_mutex = 1 ; /* lock */ + printf("LwIPtest: SSL CONNECTED(%x)\n", https_nb) ; + CyaSSL_NB_setCallbackArg(https_nb->ssl, &(https_nb->stat)) ; tcp_sent(https_nb->pcb, DataSentCallback); tcp_recv(https_nb->pcb, DataReceiveCallback); - DBG_PRINTF("LwIPtest: HTTPS GET\n") ; + DBG_PRINTF("LwIPtest: HTTPS GET(%x)\n", https_nb) ; 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) ; + CyaSSL_write(https_nb->ssl, sendBuff, size) ; https_nb->stat = WAITING ; return ERR_OK; - } + } case HTTP_RECEIVE: - { + { #define HTTP_BUFF_SIZE 2048 char httpbuff[HTTP_BUFF_SIZE] ; + LwIP_cb_mutex = 0 ; 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 ; + ret = CyaSSL_read(https_nb->ssl, httpbuff, HTTP_BUFF_SIZE) ; + printf("LwIPtest: HTTPS GET(%x), Received(%d)\n",https_nb, strlen(httpbuff)) ; /* puts(httpbuff) ;*/ puts("===================\n") ; - } - case SSL_CLOSE: - CyaSSL_close_NB(ssl_nb) ; - + } + case SSL_CLOSE: + { + CYASSL_CTX *ctx ; ; + + ctx = https_nb->ssl->ctx ; + DBG_PRINTF("CyaSSL_close(%x)", https_nb->ssl) ; + CyaSSL_shutdown(https_nb->ssl); + CyaSSL_free(https_nb->ssl); + CyaSSL_CTX_free(ctx); ; https_nb->stat = TCP_CLOSE ; - - return ERR_OK ; - - case TCP_CLOSE: + } + 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; + case IDLE: + https_nb->idle ++ ; + if(https_nb->idle > 50000) + https_nb->stat = BEGIN ; + case WAITING: + default: + return ERR_OK; } } + +/*********************************************************************/ +/* + Usage Example: + CyaSSL_HTTPS_Client_NB_init + CyaSSL_HTTPS_Client_NB + */ +/*********************************************************************/ +#ifndef NO_MAIN_DRIVER + +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 ; + + +#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) } ; + +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(int i) +{ + 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((i % 5) == 0) { /* wait for initializing TCP/IP, DHCP */ + CyaSSL_HTTPS_Client_NB(CyaSSL_HTTPS_ClientP_5) ; + } + +} + +#endif /* NO_MAIN_DRIVER */ +#endif /* HAVE_LWIP_NATIVE */ diff --git a/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h index 1f88b2abe..6cac23155 100644 --- a/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h +++ b/IDE/IAR-EWARM/CyaSSL/HTTPS-NB.h @@ -18,6 +18,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ + +#ifndef HTTPS_NB_H +#define HTTPS_NB_H extern int CyaSSL_GetDataFromPbuf(char *buff, struct pbuf *p, int size) ; @@ -37,6 +40,7 @@ enum HTTPS_Stat { TCP_CONNECTED, SSL_INIT, SSL_CONN, + SSL_CONN_WAITING, HTTP_SEND, HTTP_RECEIVE, HTTP_DONE, @@ -50,7 +54,8 @@ enum HTTPS_Stat { #define HTTPS_PORT 443 typedef struct { - CYASSL_NB ssl_nb ; + CYASSL *ssl ; + CYASSL_CTX *ctx ; enum HTTPS_Stat stat ; struct tcp_pcb * pcb ; unsigned long ipaddress ; @@ -61,8 +66,11 @@ typedef struct { char *hostname ; char *path ; int idle ; + int wait_cnt ; /* wait tick counter */ } 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 +extern int CyaSSL_HTTPS_Client_NB(void *nb) ; + +#endif diff --git a/IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c b/IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c deleted file mode 100644 index 45bcd31f6..000000000 --- a/IDE/IAR-EWARM/CyaSSL/HTTPS-maic.c +++ /dev/null @@ -1,96 +0,0 @@ -/* 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/HTTPS-main.h b/IDE/IAR-EWARM/CyaSSL/HTTPS-main.h deleted file mode 100644 index 4cd54ab74..000000000 --- a/IDE/IAR-EWARM/CyaSSL/HTTPS-main.h +++ /dev/null @@ -1,34 +0,0 @@ -/* HTTPS-main.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 - */ - -#ifndef __HTTPS_MAIN_H__ -#define __HTTPS_MAIN_H__ - -extern CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_1 ; -extern CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_2 ; -extern CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_3 ; -extern CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_4 ; -extern CYASSL_HTTPS_NB CyaSSL_HTTPS_Client_5 ; - -extern void HTTPS_Clinet_main_init(void) ; -extern void HTTPS_Clinet_main(void) ; - -#endif diff --git a/IDE/IAR-EWARM/CyaSSL/SSL-NB.c b/IDE/IAR-EWARM/CyaSSL/SSL-NB.c deleted file mode 100644 index 36de4d908..000000000 --- a/IDE/IAR-EWARM/CyaSSL/SSL-NB.c +++ /dev/null @@ -1,210 +0,0 @@ -/* 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 deleted file mode 100644 index e0b468fa7..000000000 --- a/IDE/IAR-EWARM/CyaSSL/SSL-NB.h +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 index e6feba691..cddff700e 100644 --- a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.dep +++ b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.dep @@ -2,1057 +2,255 @@ 2 - 1657308038 + 3669433724 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\md5.pbi + $TOOLKIT_DIR$\inc\c\xtgmath.h + $PROJ_DIR$\Debug\Obj\error.pbi + $TOOLKIT_DIR$\inc\c\limits.h + $PROJ_DIR$\Debug\Obj\memory.o $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$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\ipv4\lwip\icmp.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\types.h + $TOOLKIT_DIR$\inc\c\xlocale.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\random.h + $PROJ_DIR$\..\..\..\..\cyassl\crl.h $PROJ_DIR$\Debug\Obj\integer.pbi $PROJ_DIR$\Debug\Obj\sha512.o - $PROJ_DIR$\Debug\Obj\misc.pbi - $PROJ_DIR$\Debug\Obj\misc.o + $TOOLKIT_DIR$\inc\c\xlocaleuse.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\memory.h + $TOOLKIT_DIR$\inc\c\math.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\hc128.h + $PROJ_DIR$\Debug\Obj\md2.pbi + $PROJ_DIR$\Debug\Obj\md4.pbi $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$\..\..\..\..\cyassl\ctaocrypt\md4.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\integer.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\asn_public.h + $TOOLKIT_DIR$\inc\c\ctype.h + $TOOLKIT_DIR$\inc\c\DLib_Product_string.h + $TOOLKIT_DIR$\inc\c\wchar.h + $PROJ_DIR$\..\..\..\..\cyassl\internal.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\sha512.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\md5.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\ipv4\lwip\ip_addr.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\arc4.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\port.h + $TOOLKIT_DIR$\inc\c\string.h + $TOOLKIT_DIR$\inc\c\ymath.h + $TOOLKIT_DIR$\inc\c\xlocale_c.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\des3.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\dsa.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\rabbit.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\misc.h + $PROJ_DIR$\..\..\..\..\cyassl\error.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\camellia.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\aes.h + $TOOLKIT_DIR$\inc\c\xmtx.h + $TOOLKIT_DIR$\inc\c\time.h + $TOOLKIT_DIR$\inc\c\xtls.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\sha.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\ecc.h + $PROJ_DIR$\..\..\CyaSSL\https-nb.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\mpi_class.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\rsa.h + $TOOLKIT_DIR$\inc\c\stdlib.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\logging.h + $PROJ_DIR$\..\..\..\..\cyassl\version.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\dh.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\asn.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\md2.h + $PROJ_DIR$\..\..\CyaSSL\https-nb.c + $PROJ_DIR$\..\..\..\..\src\ssl.c + $PROJ_DIR$\..\..\..\..\src\internal.c + $PROJ_DIR$\..\..\..\..\src\keys.c + $PROJ_DIR$\..\..\..\..\src\tls.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\aes.c + $PROJ_DIR$\..\..\CyaSSL\https-maic.c + $PROJ_DIR$\..\..\..\..\src\io.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\compress.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\camellia.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\error.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md2.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\port.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dh.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\pwdbased.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rsa.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md4.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ripemd.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asm.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dsa.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc_fp.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\arc4.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\logging.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rabbit.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asn.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\blake2b.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\coding.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hmac.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\integer.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory-orig.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\misc.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\random.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\des3.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hc128.c + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md5.c + $PROJ_DIR$\Debug\Obj\hc128.o + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\tfm.c + $PROJ_DIR$\Debug\Obj\logging.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\debug.h + $PROJ_DIR$\Debug\Obj\blake2b.o + $PROJ_DIR$\Debug\Obj\error.o + $PROJ_DIR$\Debug\Obj\io.o + $PROJ_DIR$\Debug\Obj\ssl.o + $PROJ_DIR$\Debug\Obj\aes.o + $PROJ_DIR$\Debug\Obj\camellia.o + $PROJ_DIR$\Debug\Obj\hmac.o + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha512.c + $PROJ_DIR$\Debug\Obj\md4.o + $PROJ_DIR$\Debug\Obj\ecc_fp.o + $PROJ_DIR$\Debug\Obj\compress.o + $PROJ_DIR$\Debug\Obj\arc4.o + $PROJ_DIR$\Debug\Obj\des3.o + $PROJ_DIR$\Debug\Obj\asn.o + $PROJ_DIR$\Debug\Obj\https-nb.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\fm3_adaption\lwipopts.h + $PROJ_DIR$\Debug\Obj\coding.o + $PROJ_DIR$\Debug\Obj\integer.o + $PROJ_DIR$\Debug\Obj\tls.o + $PROJ_DIR$\Debug\Obj\dsa.o + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha256.c + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\tcp.h + $PROJ_DIR$\Debug\Obj\dh.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\arch.h + $PROJ_DIR$\Debug\Obj\md2.o + $PROJ_DIR$\Debug\Obj\internal.o + $PROJ_DIR$\Debug\Obj\asm.o + $PROJ_DIR$\Debug\Obj\ecc.o + $PROJ_DIR$\Debug\Obj\blake2b.pbi + $PROJ_DIR$\Debug\Obj\internal.pbi + $PROJ_DIR$\Debug\Obj\tls.pbi + $PROJ_DIR$\Debug\Obj\md5.o + $PROJ_DIR$\Debug\Obj\ripemd.o + $PROJ_DIR$\Debug\Obj\ssl.pbi + $PROJ_DIR$\Debug\Obj\keys.o + $TOOLKIT_DIR$\inc\c\stdio.h + $PROJ_DIR$\Debug\Obj\dh.pbi + $PROJ_DIR$\Debug\Obj\sha256.o + $PROJ_DIR$\Debug\Obj\port.o + $PROJ_DIR$\Debug\Obj\rabbit.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\opt.h + $PROJ_DIR$\Debug\Obj\sha.o + $PROJ_DIR$\Debug\Obj\coding.pbi + $PROJ_DIR$\Debug\Obj\pwdbased.o + $PROJ_DIR$\Debug\Obj\camellia.pbi + $PROJ_DIR$\Debug\Obj\aes.pbi + $PROJ_DIR$\Debug\Obj\asm.pbi + $PROJ_DIR$\Debug\Obj\asn.pbi + $PROJ_DIR$\Debug\Obj\compress.pbi + $PROJ_DIR$\Debug\Obj\https-maic.o + $PROJ_DIR$\Debug\Obj\https-maic.pbi + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\port\arch\cc.h + $PROJ_DIR$\Debug\Obj\des3.pbi + $PROJ_DIR$\Debug\Obj\random.o + $PROJ_DIR$\Debug\Obj\tfm.o + $PROJ_DIR$\Debug\Obj\arc4.pbi + $PROJ_DIR$\Debug\Obj\keys.pbi + $PROJ_DIR$\..\..\CyaSSL\https-main.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\ip.h $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 + $PROJ_DIR$\Debug\Obj\sha.pbi + $PROJ_DIR$\..\..\..\..\cyassl\ssl.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\sys.h + $TOOLKIT_DIR$\inc\c\ysizet.h + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\port\arch\epstruct.h + $TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h + $PROJ_DIR$\Debug\Obj\https-nb.pbi $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\err.h + $TOOLKIT_DIR$\inc\c\ystdio.h + $PROJ_DIR$\Debug\Obj\port.pbi + $PROJ_DIR$\Debug\Obj\ecc.pbi + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\netif.h + $TOOLKIT_DIR$\inc\c\stdint.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\settings.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$\Debug\Obj\ripemd.pbi + $TOOLKIT_DIR$\inc\c\DLib_Threads.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$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\src\include\lwip\mem.h + $PROJ_DIR$\Debug\Obj\misc.pbi + $PROJ_DIR$\Debug\Obj\rsa.pbi + $PROJ_DIR$\Debug\Obj\rsa.o + $PROJ_DIR$\..\..\..\..\..\mb9bf61xt_ethernet_lwip_v12\example\source\lwip1_4_0\port\arch\bpstruct.h + $PROJ_DIR$\Debug\Obj\ecc_fp.pbi + $PROJ_DIR$\Debug\Obj\CyaSSL-Lib.pbd + $TOOLKIT_DIR$\inc\c\yvals.h + $PROJ_DIR$\Debug\Obj\random.pbi + $TOOLKIT_DIR$\inc\c\inttypes.h + $PROJ_DIR$\Debug\Obj\sha256.pbi + $TOOLKIT_DIR$\inc\c\ycheck.h + $PROJ_DIR$\Debug\Obj\tfm.pbi + $PROJ_DIR$\Debug\Obj\dsa.pbi + $PROJ_DIR$\Debug\Obj\io.pbi + $PROJ_DIR$\Debug\Obj\hmac.pbi + $PROJ_DIR$\Debug\Obj\misc.o + $TOOLKIT_DIR$\inc\c\stddef.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\hmac.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\error.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\mpi_superclass.h + $PROJ_DIR$\..\..\..\..\cyassl\ctaocrypt\coding.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 + 0 - $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rsa.c + $PROJ_DIR$\..\..\CyaSSL\https-nb.c - - ICCARM - 113 - BICOMP - 116 + 171 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 + 178 163 136 196 192 166 170 181 180 183 168 173 35 27 122 141 116 100 124 152 194 177 167 185 202 179 172 160 159 32 189 169 176 9 184 165 55 29 10 34 17 53 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 50 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 + 178 163 136 196 192 166 170 181 180 183 168 173 35 27 122 141 116 100 124 152 194 177 167 185 202 179 172 160 159 32 189 169 176 9 184 165 55 29 10 34 17 53 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 50 - $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha.c + $PROJ_DIR$\..\..\..\..\src\ssl.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 @@ -1061,57 +259,34 @@ 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 + 178 163 165 55 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 207 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 + 178 163 165 55 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 207 - $PROJ_DIR$\..\..\..\..\src\io.c + $PROJ_DIR$\..\..\..\..\src\internal.c ICCARM - 14 + 126 BICOMP - 115 + 130 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 + 178 163 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 165 55 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 46 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 + 178 163 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 165 55 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 46 @@ -1120,44 +295,839 @@ ICCARM - 61 + 135 BICOMP - 51 + 157 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 + 178 163 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 165 55 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 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 + 178 163 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 165 55 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 - $PROJ_DIR$\..\..\CyaSSL\HTTPS-maic.c + $PROJ_DIR$\..\..\..\..\src\tls.c ICCARM - 63 + 119 BICOMP - 56 + 131 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 + 178 163 165 55 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 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 + 178 163 165 55 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\aes.c + + + ICCARM + 105 + + + BICOMP + 146 + + + + + ICCARM + 178 163 44 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 54 92 41 + + + BICOMP + 178 163 44 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 54 92 41 + + + + + $PROJ_DIR$\..\..\CyaSSL\https-maic.c + + + ICCARM + 150 + + + BICOMP + 151 + + + + + ICCARM + 122 141 116 100 124 152 136 196 192 166 170 181 180 183 168 173 194 177 167 185 202 179 172 160 159 32 189 169 176 9 184 178 163 165 55 29 10 34 17 53 35 27 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 50 158 + + + BICOMP + 122 141 116 100 124 152 136 196 192 166 170 181 180 183 168 173 194 177 167 185 202 179 172 160 159 32 189 169 176 9 184 178 163 165 55 29 10 34 17 53 35 27 26 11 47 45 16 37 28 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 50 158 + + + + + $PROJ_DIR$\..\..\..\..\src\io.c + + + ICCARM + 103 + + + BICOMP + 199 + + + + + ICCARM + 178 163 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 165 55 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 122 141 116 100 124 152 136 173 194 177 167 185 202 179 172 160 159 32 189 169 176 9 184 + + + BICOMP + 178 163 29 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 165 55 13 12 33 38 19 40 57 52 24 4 51 206 56 39 48 31 25 49 44 43 54 204 208 42 205 122 141 116 100 124 152 136 173 194 177 167 185 202 179 172 160 159 32 189 169 176 9 184 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\compress.c + + + ICCARM + 111 + + + BICOMP + 149 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\camellia.c + + + ICCARM + 106 + + + BICOMP + 145 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\error.c + + + ICCARM + 102 + + + BICOMP + 3 + + + + + ICCARM + 178 163 205 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + BICOMP + 178 163 205 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md2.c + + + ICCARM + 125 + + + BICOMP + 20 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\port.c + + + ICCARM + 139 + + + BICOMP + 174 + + + + + ICCARM + 178 163 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 + + + BICOMP + 178 163 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dh.c + + + ICCARM + 123 + + + BICOMP + 137 + + + + + ICCARM + 178 163 56 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 24 4 51 206 12 33 205 18 36 2 + + + BICOMP + 178 163 56 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 24 4 51 206 12 33 205 18 36 2 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\pwdbased.c + + + ICCARM + 144 + + + BICOMP + 8 + + + + + ICCARM + 178 163 203 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 31 48 204 208 24 4 51 206 205 92 41 + + + BICOMP + 178 163 203 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 31 48 204 208 24 4 51 206 205 92 41 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rsa.c + + + ICCARM + 188 + + + BICOMP + 187 + + + + + ICCARM + 178 163 52 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 24 4 51 206 12 33 205 54 + + + BICOMP + 178 163 52 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 24 4 51 206 12 33 205 54 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha.c + + + ICCARM + 142 + + + BICOMP + 164 + + + + + ICCARM + 178 163 48 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + BICOMP + 178 163 48 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md4.c + + + ICCARM + 109 + + + BICOMP + 21 + + + + + ICCARM + 178 163 23 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + BICOMP + 178 163 23 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ripemd.c + + + ICCARM + 133 + + + BICOMP + 182 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asm.c + + + ICCARM + 127 + + + BICOMP + 147 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\dsa.c + + + ICCARM + 120 + + + BICOMP + 198 + + + + + ICCARM + 178 163 39 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 24 4 51 206 12 33 48 205 + + + BICOMP + 178 163 39 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 24 4 51 206 12 33 48 205 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc_fp.c + + + ICCARM + 110 + + + BICOMP + 190 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\arc4.c + + + ICCARM + 112 + + + BICOMP + 156 + + + + + ICCARM + 178 163 33 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + BICOMP + 178 163 33 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\logging.c + + + ICCARM + 99 + + + BICOMP + 7 + + + + + ICCARM + 178 163 54 205 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + BICOMP + 178 163 54 205 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\rabbit.c + + + ICCARM + 140 + + + BICOMP + 22 + + + + + ICCARM + 178 163 40 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 54 92 41 + + + BICOMP + 178 163 40 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 54 92 41 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\asn.c + + + ICCARM + 114 + + + BICOMP + 148 + + + + + ICCARM + 178 163 24 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 4 51 206 57 52 12 33 56 39 48 31 25 49 207 58 205 203 38 208 30 54 46 + + + BICOMP + 178 163 24 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 4 51 206 57 52 12 33 56 39 48 31 25 49 207 58 205 203 38 208 30 54 46 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\blake2b.c + + + ICCARM + 101 + + + BICOMP + 129 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\coding.c + + + ICCARM + 117 + + + BICOMP + 143 + + + + + ICCARM + 178 163 207 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 54 + + + BICOMP + 178 163 207 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 205 54 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\ecc.c + + + ICCARM + 128 + + + BICOMP + 175 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hmac.c + + + ICCARM + 107 + + + BICOMP + 200 + + + + + ICCARM + 178 163 204 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 31 48 208 205 + + + BICOMP + 178 163 204 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 31 48 208 205 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\integer.c + + + ICCARM + 118 + + + BICOMP + 14 + + + + + ICCARM + 178 163 24 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 4 51 206 + + + BICOMP + 178 163 24 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 4 51 206 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\memory.c + + + ICCARM + 5 + + + BICOMP + 6 + + + + + ICCARM + 178 163 17 53 196 192 166 170 181 180 183 168 205 10 34 35 27 26 11 47 45 16 37 28 + + + BICOMP + 178 163 17 53 196 192 166 170 181 180 183 168 205 10 34 35 27 26 11 47 45 16 37 28 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\misc.c + + + ICCARM + 201 + + + BICOMP + 186 + + + + + ICCARM + 178 163 41 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + BICOMP + 178 163 41 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\random.c + + + ICCARM + 154 + + + BICOMP + 193 + + + + + ICCARM + 178 163 12 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 33 205 + + + BICOMP + 178 163 12 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 33 205 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\des3.c + + + ICCARM + 113 + + + BICOMP + 153 + + + + + ICCARM + 178 163 38 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + BICOMP + 178 163 38 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\hc128.c + + + ICCARM + 97 + + + BICOMP + 161 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\md5.c + + + ICCARM + 132 + + + BICOMP + 1 + + + + + ICCARM + 178 163 31 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + BICOMP + 178 163 31 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\tfm.c + + + ICCARM + 155 + + + BICOMP + 197 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha512.c + + + ICCARM + 15 + + + BICOMP + 162 + + + + + ICCARM + 178 163 + + + BICOMP + 178 163 + + + + + $PROJ_DIR$\..\..\..\..\ctaocrypt\src\sha256.c + + + ICCARM + 138 + + + BICOMP + 195 + + + + + ICCARM + 178 163 208 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 + + + BICOMP + 178 163 208 10 34 17 53 196 192 166 170 181 180 183 168 35 27 26 11 47 45 16 37 28 92 41 diff --git a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp index 6ab3883f3..e35c88a81 100644 --- a/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp +++ b/IDE/IAR-EWARM/Projects/CyaSSL-Lib/CyaSSL-Lib.ewp @@ -930,7 +930,7 @@ @@ -1875,13 +1875,7 @@ Apps - $PROJ_DIR$\..\..\CyaSSL\HTTPS-maic.c - - - $PROJ_DIR$\..\..\CyaSSL\HTTPS-NB.c - - - $PROJ_DIR$\..\..\CyaSSL\SSL-NB.c + $PROJ_DIR$\..\..\CyaSSL\https-nb.c diff --git a/cyassl/internal.h b/cyassl/internal.h index cd14d72c0..9c903814a 100644 --- a/cyassl/internal.h +++ b/cyassl/internal.h @@ -964,6 +964,8 @@ int SetCipherList(Suites*, const char* list); #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); + CYASSL_LOCAL void CyaSSL_NB_setCallbackArg(CYASSL *ssl, void *arg) ; + CYASSL_LOCAL void CyaSSL_PbufFree(void *p); #endif /* HAVE_{tcp stack} */ /* CyaSSL Cipher type just points back to SSL */ @@ -1533,8 +1535,7 @@ typedef void (*hmacfp) (CYASSL*, byte*, const byte*, word32, int, int); /* client connect state for nonblocking restart */ enum ConnectState { - CONNECT_INITIAL = 0, - CONNECT_BEGIN, + CONNECT_BEGIN = 0, CLIENT_HELLO_SENT, HELLO_AGAIN, /* HELLO_AGAIN s for DTLS case */ HELLO_AGAIN_REPLY, @@ -1801,6 +1802,17 @@ typedef struct DtlsMsg { #endif +#ifdef HAVE_LWIP_NATIVE + /* LwIP native tpc socket context */ + typedef struct LwIP_native_Ctx { + struct tcp_pcb * pcb ; + int pulled ; + struct pbuf *pbuf ; + int wait ; + void * arg ; /* arg for application */ + int idle_count ; + } LwIP_native_Ctx ; +#endif /* CyaSSL ssl type */ struct CYASSL { @@ -1912,6 +1924,9 @@ struct CYASSL { #ifdef HAVE_NETX NetX_Ctx nxCtx; /* NetX IO Context */ #endif +#ifdef HAVE_LWIP_NATIVE + LwIP_native_Ctx lwipCtx; /* NetX IO Context */ +#endif #ifdef SESSION_INDEX int sessionIndex; /* Session's location in the cache. */ #endif diff --git a/cyassl/internal.h.orig b/cyassl/internal.h.orig deleted file mode 100644 index 085d2a393..000000000 --- a/cyassl/internal.h.orig +++ /dev/null @@ -1,2121 +0,0 @@ -/* internal.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 CYASSL_INT_H -#define CYASSL_INT_H - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef NO_RC4 - #include -#endif -#ifdef HAVE_ECC - #include -#endif -#ifndef NO_SHA256 - #include -#endif -#ifdef HAVE_OCSP - #include -#endif -#ifdef CYASSL_SHA512 - #include -#endif - -#ifdef HAVE_AESGCM - #include -#endif - -#ifdef CYASSL_RIPEMD - #include -#endif - -#ifdef CYASSL_CALLBACKS - #include - #include -#endif - -#ifdef USE_WINDOWS_API - #ifdef CYASSL_GAME_BUILD - #include "system/xtl.h" - #else - #if defined(_WIN32_WCE) || defined(WIN32_LEAN_AND_MEAN) - /* On WinCE winsock2.h must be included before windows.h */ - #include - #endif - #include - #endif -#elif defined(THREADX) - #ifndef SINGLE_THREADED - #include "tx_api.h" - #endif -#elif defined(MICRIUM) - /* do nothing, just don't pick Unix */ -#elif defined(FREERTOS) || defined(CYASSL_SAFERTOS) - /* do nothing */ -#elif defined(EBSNET) - /* do nothing */ -#elif defined(FREESCALE_MQX) - /* do nothing */ -#elif defined(CYASSL_MDK_ARM) - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #else - #include - #endif -#else - #ifndef SINGLE_THREADED - #define CYASSL_PTHREADS - #include - #endif - #if defined(OPENSSL_EXTRA) || defined(GOAHEAD_WS) - #include /* for close of BIO */ - #endif -#endif - - -#ifdef HAVE_LIBZ - #include "zlib.h" -#endif - -#ifdef _MSC_VER - /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ - #pragma warning(disable: 4996) -#endif - -#ifdef NO_AES - #if !defined (ALIGN16) - #define ALIGN16 - #endif -#endif - -#ifdef NO_SHA - #define SHA_DIGEST_SIZE 20 -#endif - -#ifdef NO_SHA256 - #define SHA256_DIGEST_SIZE 32 -#endif - - -#ifdef __cplusplus - extern "C" { -#endif - - -#ifdef USE_WINDOWS_API - typedef unsigned int SOCKET_T; -#else - typedef int SOCKET_T; -#endif - - -typedef byte word24[3]; - -/* used by ssl.c and cyassl_int.c */ -void c32to24(word32 in, word24 out); - -/* Define or comment out the cipher suites you'd like to be compiled in - make sure to use at least one BUILD_SSL_xxx or BUILD_TLS_xxx is defined - - When adding cipher suites, add name to cipher_names, idx to cipher_name_idx -*/ -#if !defined(NO_RSA) && !defined(NO_RC4) - #if !defined(NO_SHA) - #define BUILD_SSL_RSA_WITH_RC4_128_SHA - #endif - #if !defined(NO_MD5) - #define BUILD_SSL_RSA_WITH_RC4_128_MD5 - #endif - #if !defined(NO_TLS) && defined(HAVE_NTRU) && !defined(NO_SHA) - #define BUILD_TLS_NTRU_RSA_WITH_RC4_128_SHA - #endif -#endif - -#if !defined(NO_RSA) && !defined(NO_DES3) - #if !defined(NO_SHA) - #define BUILD_SSL_RSA_WITH_3DES_EDE_CBC_SHA - #if !defined(NO_TLS) && defined(HAVE_NTRU) - #define BUILD_TLS_NTRU_RSA_WITH_3DES_EDE_CBC_SHA - #endif - #endif -#endif - -#if !defined(NO_RSA) && !defined(NO_AES) && !defined(NO_TLS) - #if !defined(NO_SHA) - #define BUILD_TLS_RSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_RSA_WITH_AES_256_CBC_SHA - #if defined(HAVE_NTRU) - #define BUILD_TLS_NTRU_RSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_NTRU_RSA_WITH_AES_256_CBC_SHA - #endif - #endif - #if !defined (NO_SHA256) - #define BUILD_TLS_RSA_WITH_AES_128_CBC_SHA256 - #define BUILD_TLS_RSA_WITH_AES_256_CBC_SHA256 - #endif - #if defined (HAVE_AESGCM) - #define BUILD_TLS_RSA_WITH_AES_128_GCM_SHA256 - #if defined (CYASSL_SHA384) - #define BUILD_TLS_RSA_WITH_AES_256_GCM_SHA384 - #endif - #endif - #if defined (HAVE_AESCCM) - #define BUILD_TLS_RSA_WITH_AES_128_CCM_8 - #define BUILD_TLS_RSA_WITH_AES_256_CCM_8 - #endif - #if defined(HAVE_BLAKE2) - #define BUILD_TLS_RSA_WITH_AES_128_CBC_B2B256 - #define BUILD_TLS_RSA_WITH_AES_256_CBC_B2B256 - #endif -#endif - -#if defined(HAVE_CAMELLIA) && !defined(NO_TLS) - #ifndef NO_RSA - #if !defined(NO_SHA) - #define BUILD_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA - #define BUILD_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA - #endif - #ifndef NO_SHA256 - #define BUILD_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 - #define BUILD_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 - #endif - #if !defined(NO_DH) && defined(OPENSSL_EXTRA) - #if !defined(NO_SHA) - #define BUILD_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA - #define BUILD_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA - #endif - #ifndef NO_SHA256 - #define BUILD_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 - #define BUILD_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 - #endif - #endif - #endif -#endif - -#if !defined(NO_PSK) && !defined(NO_AES) && !defined(NO_TLS) - #if !defined(NO_SHA) - #define BUILD_TLS_PSK_WITH_AES_128_CBC_SHA - #define BUILD_TLS_PSK_WITH_AES_256_CBC_SHA - #endif - #ifndef NO_SHA256 - #define BUILD_TLS_PSK_WITH_AES_128_CBC_SHA256 - #ifdef HAVE_AESCCM - #define BUILD_TLS_PSK_WITH_AES_128_CCM_8 - #define BUILD_TLS_PSK_WITH_AES_256_CCM_8 - #endif - #endif -#endif - -#if !defined(NO_TLS) && defined(HAVE_NULL_CIPHER) - #if !defined(NO_RSA) - #if !defined(NO_SHA) - #define BUILD_TLS_RSA_WITH_NULL_SHA - #endif - #ifndef NO_SHA256 - #define BUILD_TLS_RSA_WITH_NULL_SHA256 - #endif - #endif - #if !defined(NO_PSK) - #if !defined(NO_SHA) - #define BUILD_TLS_PSK_WITH_NULL_SHA - #endif - #ifndef NO_SHA256 - #define BUILD_TLS_PSK_WITH_NULL_SHA256 - #endif - #endif -#endif - -#if !defined(NO_HC128) && !defined(NO_RSA) && !defined(NO_TLS) - #define BUILD_TLS_RSA_WITH_HC_128_MD5 - #if !defined(NO_SHA) - #define BUILD_TLS_RSA_WITH_HC_128_SHA - #endif - #if defined(HAVE_BLAKE2) - #define BUILD_TLS_RSA_WITH_HC_128_B2B256 - #endif -#endif - -#if !defined(NO_RABBIT) && !defined(NO_TLS) && !defined(NO_RSA) - #if !defined(NO_SHA) - #define BUILD_TLS_RSA_WITH_RABBIT_SHA - #endif -#endif - -#if !defined(NO_DH) && !defined(NO_AES) && !defined(NO_TLS) && \ - !defined(NO_RSA) && defined(OPENSSL_EXTRA) - #if !defined(NO_SHA) - #define BUILD_TLS_DHE_RSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_DHE_RSA_WITH_AES_256_CBC_SHA - #endif - #if !defined (NO_SHA256) - #define BUILD_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 - #define BUILD_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 - #if defined (HAVE_AESGCM) - #define BUILD_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - #if defined (CYASSL_SHA384) - #define BUILD_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 - #endif - #endif - #endif -#endif - -#if defined(HAVE_ECC) && !defined(NO_TLS) - #if !defined(NO_AES) - #if !defined(NO_SHA) - #if !defined(NO_RSA) - #define BUILD_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA - #define BUILD_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA - #endif - - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA - - #define BUILD_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA - #define BUILD_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA - #endif /* NO_SHA */ - #ifndef NO_SHA256 - #if !defined(NO_RSA) - #define BUILD_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 - #define BUILD_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 - #endif - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 - #define BUILD_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 - #endif - - #ifdef CYASSL_SHA384 - #if !defined(NO_RSA) - #define BUILD_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 - #define BUILD_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 - #endif - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 - #define BUILD_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 - #endif - - #if defined (HAVE_AESGCM) - #if !defined(NO_RSA) - #define BUILD_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 - #define BUILD_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 - #if defined(CYASSL_SHA384) - #define BUILD_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 - #define BUILD_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 - #endif - #endif - - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 - #define BUILD_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 - - #if defined(CYASS_SHA384) - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 - #define BUILD_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 - #endif - #endif - #if defined (HAVE_AESCCM) - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 - #define BUILD_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 - #endif - #endif /* NO_AES */ - #if !defined(NO_RC4) - #if !defined(NO_SHA) - #if !defined(NO_RSA) - #define BUILD_TLS_ECDHE_RSA_WITH_RC4_128_SHA - #define BUILD_TLS_ECDH_RSA_WITH_RC4_128_SHA - #endif - - #define BUILD_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA - #define BUILD_TLS_ECDH_ECDSA_WITH_RC4_128_SHA - #endif - #endif - #if !defined(NO_DES3) - #if !defined(NO_RSA) - #define BUILD_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA - #define BUILD_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA - #endif - - #define BUILD_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA - #define BUILD_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA - #endif -#endif - - -#if defined(BUILD_SSL_RSA_WITH_RC4_128_SHA) || \ - defined(BUILD_SSL_RSA_WITH_RC4_128_MD5) - #define BUILD_ARC4 -#endif - -#if defined(BUILD_SSL_RSA_WITH_3DES_EDE_CBC_SHA) - #define BUILD_DES3 -#endif - -#if defined(BUILD_TLS_RSA_WITH_AES_128_CBC_SHA) || \ - defined(BUILD_TLS_RSA_WITH_AES_256_CBC_SHA) || \ - defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) - #undef BUILD_AES - #define BUILD_AES -#endif - -#if defined(BUILD_TLS_RSA_WITH_AES_128_GCM_SHA256) || \ - defined(BUILD_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256) - #define BUILD_AESGCM -#endif - -#if defined(BUILD_TLS_RSA_WITH_HC_128_SHA) || \ - defined(BUILD_TLS_RSA_WITH_HC_128_MD5) || \ - defined(BUILD_TLS_RSA_WITH_HC_128_B2B256) - #define BUILD_HC128 -#endif - -#if defined(BUILD_TLS_RSA_WITH_RABBIT_SHA) - #define BUILD_RABBIT -#endif - -#ifdef NO_DES3 - #define DES_BLOCK_SIZE 8 -#else - #undef BUILD_DES3 - #define BUILD_DES3 -#endif - -#ifdef NO_AES - #define AES_BLOCK_SIZE 16 -#else - #undef BUILD_AES - #define BUILD_AES -#endif - -#ifndef NO_RC4 - #undef BUILD_ARC4 - #define BUILD_ARC4 -#endif - - - -#if defined(BUILD_AESGCM) || defined(HAVE_AESCCM) - #define HAVE_AEAD -#endif - - -/* actual cipher values, 2nd byte */ -enum { - TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x39, - TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x33, - TLS_RSA_WITH_AES_256_CBC_SHA = 0x35, - TLS_RSA_WITH_AES_128_CBC_SHA = 0x2F, - TLS_RSA_WITH_NULL_SHA = 0x02, - TLS_PSK_WITH_AES_256_CBC_SHA = 0x8d, - TLS_PSK_WITH_AES_128_CBC_SHA256 = 0xae, - TLS_PSK_WITH_AES_128_CBC_SHA = 0x8c, - TLS_PSK_WITH_NULL_SHA256 = 0xb0, - TLS_PSK_WITH_NULL_SHA = 0x2c, - SSL_RSA_WITH_RC4_128_SHA = 0x05, - SSL_RSA_WITH_RC4_128_MD5 = 0x04, - SSL_RSA_WITH_3DES_EDE_CBC_SHA = 0x0A, - - /* ECC suites, first byte is 0xC0 (ECC_BYTE) */ - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0x14, - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA = 0x13, - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA = 0x0A, - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA = 0x09, - TLS_ECDHE_RSA_WITH_RC4_128_SHA = 0x11, - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA = 0x07, - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x12, - TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA = 0x08, - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 = 0x27, - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 = 0x23, - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 = 0x28, - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 = 0x24, - - /* static ECDH, first byte is 0xC0 (ECC_BYTE) */ - TLS_ECDH_RSA_WITH_AES_256_CBC_SHA = 0x0F, - TLS_ECDH_RSA_WITH_AES_128_CBC_SHA = 0x0E, - TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA = 0x05, - TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA = 0x04, - TLS_ECDH_RSA_WITH_RC4_128_SHA = 0x0C, - TLS_ECDH_ECDSA_WITH_RC4_128_SHA = 0x02, - TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA = 0x0D, - TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA = 0x03, - TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 = 0x29, - TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 = 0x25, - TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 = 0x2A, - TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 = 0x26, - - /* CyaSSL extension - eSTREAM */ - TLS_RSA_WITH_HC_128_MD5 = 0xFB, - TLS_RSA_WITH_HC_128_SHA = 0xFC, - TLS_RSA_WITH_RABBIT_SHA = 0xFD, - - /* CyaSSL extension - Blake2b 256 */ - TLS_RSA_WITH_AES_128_CBC_B2B256 = 0xF8, - TLS_RSA_WITH_AES_256_CBC_B2B256 = 0xF9, - TLS_RSA_WITH_HC_128_B2B256 = 0xFA, /* eSTREAM too */ - - /* CyaSSL extension - NTRU */ - TLS_NTRU_RSA_WITH_RC4_128_SHA = 0xe5, - TLS_NTRU_RSA_WITH_3DES_EDE_CBC_SHA = 0xe6, - TLS_NTRU_RSA_WITH_AES_128_CBC_SHA = 0xe7, /* clases w/ official SHA-256 */ - TLS_NTRU_RSA_WITH_AES_256_CBC_SHA = 0xe8, - - /* SHA256 */ - TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x6b, - TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x67, - TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x3d, - TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x3c, - TLS_RSA_WITH_NULL_SHA256 = 0x3b, - - /* AES-GCM */ - TLS_RSA_WITH_AES_128_GCM_SHA256 = 0x9c, - TLS_RSA_WITH_AES_256_GCM_SHA384 = 0x9d, - TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 = 0x9e, - TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 = 0x9f, - - /* ECC AES-GCM, first byte is 0xC0 (ECC_BYTE) */ - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 = 0x2b, - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 = 0x2c, - TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 = 0x2d, - TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 = 0x2e, - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 = 0x2f, - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 = 0x30, - TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 = 0x31, - TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 = 0x32, - - /* AES-CCM, first byte is 0xC0 but isn't ECC, - * also, in some of the other AES-CCM suites - * there will be second byte number conflicts - * with non-ECC AES-GCM */ - TLS_RSA_WITH_AES_128_CCM_8 = 0xa0, - TLS_RSA_WITH_AES_256_CCM_8 = 0xa1, - TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 = 0xc6, /* Still TBD, made up */ - TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 = 0xc7, /* Still TBD, made up */ - TLS_PSK_WITH_AES_128_CCM = 0xa4, - TLS_PSK_WITH_AES_256_CCM = 0xa5, - TLS_PSK_WITH_AES_128_CCM_8 = 0xa8, - TLS_PSK_WITH_AES_256_CCM_8 = 0xa9, - - TLS_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x41, - TLS_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x84, - TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xba, - TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0xc0, - TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA = 0x45, - TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA = 0x88, - TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 = 0xbe, - TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 = 0xc4, - - /* Renegotiation Indication Extension Special Suite */ - TLS_EMPTY_RENEGOTIATION_INFO_SCSV = 0xff -}; - - -enum Misc { - ECC_BYTE = 0xC0, /* ECC first cipher suite byte */ - - SEND_CERT = 1, - SEND_BLANK_CERT = 2, - - DTLS_MAJOR = 0xfe, /* DTLS major version number */ - DTLS_MINOR = 0xff, /* DTLS minor version number */ - DTLSv1_2_MINOR = 0xfd, /* DTLS minor version number */ - SSLv3_MAJOR = 3, /* SSLv3 and TLSv1+ major version number */ - SSLv3_MINOR = 0, /* TLSv1 minor version number */ - TLSv1_MINOR = 1, /* TLSv1 minor version number */ - TLSv1_1_MINOR = 2, /* TLSv1_1 minor version number */ - TLSv1_2_MINOR = 3, /* TLSv1_2 minor version number */ - INVALID_BYTE = 0xff, /* Used to initialize cipher specs values */ - NO_COMPRESSION = 0, - ZLIB_COMPRESSION = 221, /* CyaSSL zlib compression */ - HELLO_EXT_SIG_ALGO = 13, /* ID for the sig_algo hello extension */ - SECRET_LEN = 48, /* pre RSA and all master */ - ENCRYPT_LEN = 512, /* allow 4096 bit static buffer */ - SIZEOF_SENDER = 4, /* clnt or srvr */ - FINISHED_SZ = 36, /* MD5_DIGEST_SIZE + SHA_DIGEST_SIZE */ - MAX_RECORD_SIZE = 16384, /* 2^14, max size by standard */ - MAX_MSG_EXTRA = 38 + MAX_DIGEST_SIZE, - /* max added to msg, mac + pad from */ - /* RECORD_HEADER_SZ + BLOCK_SZ (pad) + Max - digest sz + BLOC_SZ (iv) + pad byte (1) */ - MAX_COMP_EXTRA = 1024, /* max compression extra */ - MAX_MTU = 1500, /* max expected MTU */ - MAX_UDP_SIZE = 8192 - 100, /* was MAX_MTU - 100 */ - MAX_DH_SZ = 612, /* 2240 p, pub, g + 2 byte size for each */ - MAX_STR_VERSION = 8, /* string rep of protocol version */ - - PAD_MD5 = 48, /* pad length for finished */ - PAD_SHA = 40, /* pad length for finished */ - MAX_PAD_SIZE = 256, /* maximum length of padding */ - COMPRESS_DUMMY_SIZE = 64, /* compression dummy round size */ - COMPRESS_CONSTANT = 13, /* compression calc constant */ - COMPRESS_UPPER = 55, /* compression calc numerator */ - COMPRESS_LOWER = 64, /* compression calc denominator */ - - PEM_LINE_LEN = 80, /* PEM line max + fudge */ - LENGTH_SZ = 2, /* length field for HMAC, data only */ - VERSION_SZ = 2, /* length of proctocol version */ - SEQ_SZ = 8, /* 64 bit sequence number */ - BYTE3_LEN = 3, /* up to 24 bit byte lengths */ - ALERT_SIZE = 2, /* level + description */ - REQUEST_HEADER = 2, /* always use 2 bytes */ - VERIFY_HEADER = 2, /* always use 2 bytes */ - EXT_ID_SZ = 2, /* always use 2 bytes */ - MAX_DH_SIZE = 513, /* 4096 bit plus possible leading 0 */ - - MAX_SUITE_SZ = 200, /* 100 suites for now! */ - RAN_LEN = 32, /* random length */ - SEED_LEN = RAN_LEN * 2, /* tls prf seed length */ - ID_LEN = 32, /* session id length */ - MAX_COOKIE_LEN = 32, /* max dtls cookie size */ - COOKIE_SZ = 20, /* use a 20 byte cookie */ - SUITE_LEN = 2, /* cipher suite sz length */ - ENUM_LEN = 1, /* always a byte */ - OPAQUE16_LEN = 2, /* always 2 bytes */ - COMP_LEN = 1, /* compression length */ - CURVE_LEN = 2, /* ecc named curve length */ - SERVER_ID_LEN = 20, /* server session id length */ - - HANDSHAKE_HEADER_SZ = 4, /* type + length(3) */ - RECORD_HEADER_SZ = 5, /* type + version + len(2) */ - CERT_HEADER_SZ = 3, /* always 3 bytes */ - REQ_HEADER_SZ = 2, /* cert request header sz */ - HINT_LEN_SZ = 2, /* length of hint size field */ - TRUNCATED_HMAC_SZ = 10, /* length of hmac w/ truncated hmac extension */ - HELLO_EXT_TYPE_SZ = 2, /* length of a hello extension type */ - HELLO_EXT_SZ = 8, /* total length of the lazy hello extensions */ - HELLO_EXT_LEN = 6, /* length of the lazy hello extensions */ - HELLO_EXT_SIGALGO_SZ = 2, /* length of signature algo extension */ - HELLO_EXT_SIGALGO_MAX = 32, /* number of items in the signature algo list */ - - DTLS_HANDSHAKE_HEADER_SZ = 12, /* normal + seq(2) + offset(3) + length(3) */ - DTLS_RECORD_HEADER_SZ = 13, /* normal + epoch(2) + seq_num(6) */ - DTLS_HANDSHAKE_EXTRA = 8, /* diff from normal */ - DTLS_RECORD_EXTRA = 8, /* diff from normal */ - DTLS_HANDSHAKE_SEQ_SZ = 2, /* handshake header sequence number */ - DTLS_HANDSHAKE_FRAG_SZ = 3, /* fragment offset and length are 24 bit */ - DTLS_POOL_SZ = 5, /* buffers to hold in the retry pool */ - - FINISHED_LABEL_SZ = 15, /* TLS finished label size */ - TLS_FINISHED_SZ = 12, /* TLS has a shorter size */ - MASTER_LABEL_SZ = 13, /* TLS master secret label sz */ - KEY_LABEL_SZ = 13, /* TLS key block expansion sz */ - MAX_PRF_HALF = 128, /* Maximum half secret len */ - MAX_PRF_LABSEED = 128, /* Maximum label + seed len */ - MAX_PRF_DIG = 224, /* Maximum digest len */ - MAX_REQUEST_SZ = 256, /* Maximum cert req len (no auth yet */ - SESSION_FLUSH_COUNT = 256, /* Flush session cache unless user turns off */ - - RC4_KEY_SIZE = 16, /* always 128bit */ - DES_KEY_SIZE = 8, /* des */ - DES3_KEY_SIZE = 24, /* 3 des ede */ - DES_IV_SIZE = DES_BLOCK_SIZE, - AES_256_KEY_SIZE = 32, /* for 256 bit */ - AES_192_KEY_SIZE = 24, /* for 192 bit */ - AES_IV_SIZE = 16, /* always block size */ - AES_128_KEY_SIZE = 16, /* for 128 bit */ - - AEAD_SEQ_OFFSET = 4, /* Auth Data: Sequence number */ - AEAD_TYPE_OFFSET = 8, /* Auth Data: Type */ - AEAD_VMAJ_OFFSET = 9, /* Auth Data: Major Version */ - AEAD_VMIN_OFFSET = 10, /* Auth Data: Minor Version */ - AEAD_LEN_OFFSET = 11, /* Auth Data: Length */ - AEAD_AUTH_DATA_SZ = 13, /* Size of the data to authenticate */ - AEAD_IMP_IV_SZ = 4, /* Size of the implicit IV */ - AEAD_EXP_IV_SZ = 8, /* Size of the explicit IV */ - AEAD_NONCE_SZ = AEAD_EXP_IV_SZ + AEAD_IMP_IV_SZ, - - AES_GCM_AUTH_SZ = 16, /* AES-GCM Auth Tag length */ - AES_CCM_16_AUTH_SZ = 16, /* AES-CCM-16 Auth Tag length */ - AES_CCM_8_AUTH_SZ = 8, /* AES-CCM-8 Auth Tag Length */ - - CAMELLIA_128_KEY_SIZE = 16, /* for 128 bit */ - CAMELLIA_192_KEY_SIZE = 24, /* for 192 bit */ - CAMELLIA_256_KEY_SIZE = 32, /* for 256 bit */ - CAMELLIA_IV_SIZE = 16, /* always block size */ - - HC_128_KEY_SIZE = 16, /* 128 bits */ - HC_128_IV_SIZE = 16, /* also 128 bits */ - - RABBIT_KEY_SIZE = 16, /* 128 bits */ - RABBIT_IV_SIZE = 8, /* 64 bits for iv */ - - EVP_SALT_SIZE = 8, /* evp salt size 64 bits */ - - ECDHE_SIZE = 32, /* ECHDE server size defaults to 256 bit */ - MAX_EXPORT_ECC_SZ = 256, /* Export ANS X9.62 max future size */ - - MAX_HELLO_SZ = 128, /* max client or server hello */ - MAX_CERT_VERIFY_SZ = 1024, /* max */ - CLIENT_HELLO_FIRST = 35, /* Protocol + RAN_LEN + sizeof(id_len) */ - MAX_SUITE_NAME = 48, /* maximum length of cipher suite string */ - DEFAULT_TIMEOUT = 500, /* default resumption timeout in seconds */ - - DTLS_TIMEOUT_INIT = 1, /* default timeout init for DTLS receive */ - DTLS_TIMEOUT_MAX = 64, /* default max timeout for DTLS receive */ - DTLS_TIMEOUT_MULTIPLIER = 2, /* default timeout multiplier for DTLS recv */ - - MAX_PSK_ID_LEN = 128, /* max psk identity/hint supported */ - MAX_PSK_KEY_LEN = 64, /* max psk key supported */ - - MAX_CYASSL_FILE_SIZE = 1024 * 1024 * 4, /* 4 mb file size alloc limit */ - -#ifdef FORTRESS - MAX_EX_DATA = 3, /* allow for three items of ex_data */ -#endif - - MAX_X509_SIZE = 2048, /* max static x509 buffer size */ - CERT_MIN_SIZE = 256, /* min PEM cert size with header/footer */ - MAX_FILENAME_SZ = 256, /* max file name length */ - FILE_BUFFER_SIZE = 1024, /* default static file buffer size for input, - will use dynamic buffer if not big enough */ - - MAX_NTRU_PUB_KEY_SZ = 1027, /* NTRU max for now */ - MAX_NTRU_ENCRYPT_SZ = 1027, /* NTRU max for now */ - MAX_NTRU_BITS = 256, /* max symmetric bit strength */ - NO_SNIFF = 0, /* not sniffing */ - SNIFF = 1, /* currently sniffing */ - - HASH_SIG_SIZE = 2, /* default SHA1 RSA */ - - NO_CAVIUM_DEVICE = -2, /* invalid cavium device id */ - - NO_COPY = 0, /* should we copy static buffer for write */ - COPY = 1 /* should we copy static buffer for write */ -}; - - -#ifdef SESSION_INDEX -/* Shift values for making a session index */ -#define SESSIDX_ROW_SHIFT 4 -#define SESSIDX_IDX_MASK 0x0F -#endif - - -/* max cert chain peer depth */ -#ifndef MAX_CHAIN_DEPTH - #define MAX_CHAIN_DEPTH 9 -#endif - - -/* don't use extra 3/4k stack space unless need to */ -#ifdef HAVE_NTRU - #define MAX_ENCRYPT_SZ MAX_NTRU_ENCRYPT_SZ -#else - #define MAX_ENCRYPT_SZ ENCRYPT_LEN -#endif - - -/* states */ -enum states { - NULL_STATE = 0, - - SERVER_HELLOVERIFYREQUEST_COMPLETE, - SERVER_HELLO_COMPLETE, - SERVER_CERT_COMPLETE, - SERVER_KEYEXCHANGE_COMPLETE, - SERVER_HELLODONE_COMPLETE, - SERVER_FINISHED_COMPLETE, - - CLIENT_HELLO_COMPLETE, - CLIENT_KEYEXCHANGE_COMPLETE, - CLIENT_FINISHED_COMPLETE, - - HANDSHAKE_DONE -}; - - -#if defined(__GNUC__) - #define CYASSL_PACK __attribute__ ((packed)) -#else - #define CYASSL_PACK -#endif - -/* SSL Version */ -typedef struct ProtocolVersion { - byte major; - byte minor; -} CYASSL_PACK ProtocolVersion; - - -CYASSL_LOCAL ProtocolVersion MakeSSLv3(void); -CYASSL_LOCAL ProtocolVersion MakeTLSv1(void); -CYASSL_LOCAL ProtocolVersion MakeTLSv1_1(void); -CYASSL_LOCAL ProtocolVersion MakeTLSv1_2(void); - -#ifdef CYASSL_DTLS - CYASSL_LOCAL ProtocolVersion MakeDTLSv1(void); - CYASSL_LOCAL ProtocolVersion MakeDTLSv1_2(void); -#endif - - -enum BIO_TYPE { - BIO_BUFFER = 1, - BIO_SOCKET = 2, - BIO_SSL = 3, - BIO_MEMORY = 4 -}; - - -/* CyaSSL BIO_METHOD type */ -struct CYASSL_BIO_METHOD { - byte type; /* method type */ -}; - - -/* CyaSSL BIO type */ -struct CYASSL_BIO { - byte type; /* method type */ - byte close; /* close flag */ - byte eof; /* eof flag */ - CYASSL* ssl; /* possible associated ssl */ - byte* mem; /* memory buffer */ - int memLen; /* memory buffer length */ - int fd; /* possible file descriptor */ - CYASSL_BIO* prev; /* previous in chain */ - CYASSL_BIO* next; /* next in chain */ -}; - - -/* CyaSSL method type */ -struct CYASSL_METHOD { - ProtocolVersion version; - byte side; /* connection side, server or client */ - byte downgrade; /* whether to downgrade version, default no */ -}; - - -/* defautls to client */ -CYASSL_LOCAL void InitSSL_Method(CYASSL_METHOD*, ProtocolVersion); - -/* for sniffer */ -CYASSL_LOCAL int DoFinished(CYASSL* ssl, const byte* input, word32* inOutIdx, - int sniff); -CYASSL_LOCAL int DoApplicationData(CYASSL* ssl, byte* input, word32* inOutIdx); - - -/* CyaSSL buffer type */ -typedef struct buffer { - word32 length; - byte* buffer; -} buffer; - - -enum { - FORCED_FREE = 1, - NO_FORCED_FREE = 0 -}; - - -/* only use compression extra if using compression */ -#ifdef HAVE_LIBZ - #define COMP_EXTRA MAX_COMP_EXTRA -#else - #define COMP_EXTRA 0 -#endif - -/* only the sniffer needs space in the buffer for extra MTU record(s) */ -#ifdef CYASSL_SNIFFER - #define MTU_EXTRA MAX_MTU * 3 -#else - #define MTU_EXTRA 0 -#endif - - -/* embedded callbacks require large static buffers, make sure on */ -#ifdef CYASSL_CALLBACKS - #undef LARGE_STATIC_BUFFERS - #define LARGE_STATIC_BUFFERS -#endif - - -/* give user option to use 16K static buffers */ -#if defined(LARGE_STATIC_BUFFERS) - #define RECORD_SIZE MAX_RECORD_SIZE -#else - #ifdef CYASSL_DTLS - #define RECORD_SIZE MAX_MTU - #else - #define RECORD_SIZE 128 - #endif -#endif - - -/* user option to turn off 16K output option */ -/* if using small static buffers (default) and SSL_write tries to write data - larger than the record we have, dynamically get it, unless user says only - write in static buffer chuncks */ -#ifndef STATIC_CHUNKS_ONLY - #define OUTPUT_RECORD_SIZE MAX_RECORD_SIZE -#else - #define OUTPUT_RECORD_SIZE RECORD_SIZE -#endif - -/* CyaSSL input buffer - - RFC 2246: - - length - The length (in bytes) of the following TLSPlaintext.fragment. - The length should not exceed 2^14. -*/ -#if defined(LARGE_STATIC_BUFFERS) - #define STATIC_BUFFER_LEN RECORD_HEADER_SZ + RECORD_SIZE + COMP_EXTRA + \ - MTU_EXTRA + MAX_MSG_EXTRA -#else - /* zero length arrays may not be supported */ - #define STATIC_BUFFER_LEN 1 -#endif - -typedef struct { - word32 length; /* total buffer length used */ - word32 idx; /* idx to part of length already consumed */ - byte* buffer; /* place holder for static or dynamic buffer */ - word32 bufferSize; /* current buffer size */ - ALIGN16 byte staticBuffer[STATIC_BUFFER_LEN]; - byte dynamicFlag; /* dynamic memory currently in use */ - byte offset; /* alignment offset attempt */ -} bufferStatic; - -/* Cipher Suites holder */ -typedef struct Suites { - int setSuites; /* user set suites from default */ - byte suites[MAX_SUITE_SZ]; - word16 suiteSz; /* suite length in bytes */ - byte hashSigAlgo[HELLO_EXT_SIGALGO_MAX]; /* sig/algo to offer */ - word16 hashSigAlgoSz; /* SigAlgo extension length in bytes */ - byte hashAlgo; /* selected hash algorithm */ - byte sigAlgo; /* selected sig algorithm */ -} Suites; - - -CYASSL_LOCAL -void InitSuites(Suites*, ProtocolVersion, - byte, byte, byte, byte, byte, byte, int); -CYASSL_LOCAL -int SetCipherList(Suites*, const char* list); - -#ifndef PSK_TYPES_DEFINED - typedef unsigned int (*psk_client_callback)(CYASSL*, const char*, char*, - unsigned int, unsigned char*, unsigned int); - typedef unsigned int (*psk_server_callback)(CYASSL*, const char*, - unsigned char*, unsigned int); -#endif /* PSK_TYPES_DEFINED */ - - -#ifndef CYASSL_USER_IO - /* default IO callbacks */ - CYASSL_LOCAL - int EmbedReceive(CYASSL *ssl, char *buf, int sz, void *ctx); - CYASSL_LOCAL - int EmbedSend(CYASSL *ssl, char *buf, int sz, void *ctx); - - #ifdef HAVE_OCSP - CYASSL_LOCAL - int EmbedOcspLookup(void*, const char*, int, byte*, int, byte**); - CYASSL_LOCAL - void EmbedOcspRespFree(void*, byte*); - #endif - - #ifdef CYASSL_DTLS - CYASSL_LOCAL - int EmbedReceiveFrom(CYASSL *ssl, char *buf, int sz, void *ctx); - CYASSL_LOCAL - int EmbedSendTo(CYASSL *ssl, char *buf, int sz, void *ctx); - CYASSL_LOCAL - int EmbedGenerateCookie(CYASSL* ssl, byte *buf, int sz, void *ctx); - CYASSL_LOCAL - int IsUDP(void*); - #endif /* CYASSL_DTLS */ -#endif /* CYASSL_USER_IO */ - -#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 */ - - -/* CyaSSL Cipher type just points back to SSL */ -struct CYASSL_CIPHER { - CYASSL* ssl; -}; - - -typedef struct OCSP_Entry OCSP_Entry; - -#ifdef SHA_DIGEST_SIZE - #define OCSP_DIGEST_SIZE SHA_DIGEST_SIZE -#else - #define OCSP_DIGEST_SIZE 160 -#endif - -#ifdef NO_ASN - /* no_asn won't have */ - typedef struct CertStatus CertStatus; -#endif - -struct OCSP_Entry { - OCSP_Entry* next; /* next entry */ - byte issuerHash[OCSP_DIGEST_SIZE]; /* issuer hash */ - byte issuerKeyHash[OCSP_DIGEST_SIZE]; /* issuer public key hash */ - CertStatus* status; /* OCSP response list */ - int totalStatus; /* number on list */ -}; - - -#ifndef HAVE_OCSP - typedef struct CYASSL_OCSP CYASSL_OCSP; -#endif - -/* CyaSSL OCSP controller */ -struct CYASSL_OCSP { - CYASSL_CERT_MANAGER* cm; /* pointer back to cert manager */ - OCSP_Entry* ocspList; /* OCSP response list */ -}; - -#ifndef MAX_DATE_SIZE -#define MAX_DATE_SIZE 32 -#endif - -typedef struct CRL_Entry CRL_Entry; - -#ifdef SHA_DIGEST_SIZE - #define CRL_DIGEST_SIZE SHA_DIGEST_SIZE -#else - #define CRL_DIGEST_SIZE 160 -#endif - -#ifdef NO_ASN - typedef struct RevokedCert RevokedCert; -#endif - -/* Complete CRL */ -struct CRL_Entry { - CRL_Entry* next; /* next entry */ - byte issuerHash[CRL_DIGEST_SIZE]; /* issuer hash */ - /* byte crlHash[CRL_DIGEST_SIZE]; raw crl data hash */ - /* restore the hash here if needed for optimized comparisons */ - byte lastDate[MAX_DATE_SIZE]; /* last date updated */ - byte nextDate[MAX_DATE_SIZE]; /* next update date */ - byte lastDateFormat; /* last date format */ - byte nextDateFormat; /* next date format */ - RevokedCert* certs; /* revoked cert list */ - int totalCerts; /* number on list */ -}; - - -typedef struct CRL_Monitor CRL_Monitor; - -/* CRL directory monitor */ -struct CRL_Monitor { - char* path; /* full dir path, if valid pointer we're using */ - int type; /* PEM or ASN1 type */ -}; - - -#ifndef HAVE_CRL - typedef struct CYASSL_CRL CYASSL_CRL; -#endif - -/* CyaSSL CRL controller */ -struct CYASSL_CRL { - CYASSL_CERT_MANAGER* cm; /* pointer back to cert manager */ - CRL_Entry* crlList; /* our CRL list */ - CyaSSL_Mutex crlLock; /* CRL list lock */ - CRL_Monitor monitors[2]; /* PEM and DER possible */ -#ifdef HAVE_CRL_MONITOR - pthread_t tid; /* monitoring thread */ -#endif -}; - - -#ifdef NO_ASN - typedef struct Signer Signer; -#endif - - -#ifndef CA_TABLE_SIZE - #define CA_TABLE_SIZE 11 -#endif - -/* CyaSSL Certificate Manager */ -struct CYASSL_CERT_MANAGER { - Signer* caTable[CA_TABLE_SIZE]; /* the CA signer table */ - CyaSSL_Mutex caLock; /* CA list lock */ - CallbackCACache caCacheCallback; /* CA cache addition callback */ - void* heap; /* heap helper */ - CYASSL_CRL* crl; /* CRL checker */ - byte crlEnabled; /* is CRL on ? */ - byte crlCheckAll; /* always leaf, but all ? */ - CbMissingCRL cbMissingCRL; /* notify through cb of missing crl */ - CYASSL_OCSP* ocsp; /* OCSP checker */ - byte ocspEnabled; /* is OCSP on ? */ - byte ocspSendNonce; /* send the OCSP nonce ? */ - byte ocspUseOverrideURL; /* ignore cert's responder, override */ - char* ocspOverrideURL; /* use this responder */ - void* ocspIOCtx; /* I/O callback CTX */ - CbOCSPIO ocspIOCb; /* I/O callback for OCSP lookup */ - CbOCSPRespFree ocspRespFreeCb; /* Frees OCSP Response from IO Cb */ -}; - -CYASSL_LOCAL int CM_SaveCertCache(CYASSL_CERT_MANAGER*, const char*); -CYASSL_LOCAL int CM_RestoreCertCache(CYASSL_CERT_MANAGER*, const char*); -CYASSL_LOCAL int CM_MemSaveCertCache(CYASSL_CERT_MANAGER*, void*, int, int*); -CYASSL_LOCAL int CM_MemRestoreCertCache(CYASSL_CERT_MANAGER*, const void*, int); -CYASSL_LOCAL int CM_GetCertCacheMemSize(CYASSL_CERT_MANAGER*); - -/* CyaSSL Sock Addr */ -struct CYASSL_SOCKADDR { - unsigned int sz; /* sockaddr size */ - void* sa; /* pointer to the sockaddr_in or sockaddr_in6 */ -}; - -typedef struct CYASSL_DTLS_CTX { - CYASSL_SOCKADDR peer; - int fd; -} CYASSL_DTLS_CTX; - -/* RFC 6066 TLS Extensions */ -#ifdef HAVE_TLS_EXTENSIONS - -typedef enum { - SERVER_NAME_INDICATION = 0, - MAX_FRAGMENT_LENGTH = 1, - /*CLIENT_CERTIFICATE_URL = 2, - TRUSTED_CA_KEYS = 3,*/ - TRUNCATED_HMAC = 4, - /*STATUS_REQUEST = 5, - SIGNATURE_ALGORITHMS = 13,*/ -} TLSX_Type; - -typedef struct TLSX { - TLSX_Type type; /* Extension Type */ - void* data; /* Extension Data */ - byte resp; /* IsResponse Flag */ - struct TLSX* next; /* List Behavior */ -} TLSX; - -CYASSL_LOCAL TLSX* TLSX_Find(TLSX* list, TLSX_Type type); -CYASSL_LOCAL void TLSX_FreeAll(TLSX* list); - -#ifndef NO_CYASSL_CLIENT -CYASSL_LOCAL word16 TLSX_GetRequestSize(CYASSL* ssl); -CYASSL_LOCAL word16 TLSX_WriteRequest(CYASSL* ssl, byte* output); -#endif - -#ifndef NO_CYASSL_SERVER -CYASSL_LOCAL word16 TLSX_GetResponseSize(CYASSL* ssl); -CYASSL_LOCAL word16 TLSX_WriteResponse(CYASSL* ssl, byte* output); -#endif - -CYASSL_LOCAL int TLSX_Parse(CYASSL* ssl, byte* input, word16 length, - byte isRequest, Suites *suites); - -/* Server Name Indication */ -#ifdef HAVE_SNI - -typedef struct SNI { - byte type; /* SNI Type */ - union { char* host_name; } data; /* SNI Data */ - struct SNI* next; /* List Behavior */ -#ifndef NO_CYASSL_SERVER - byte options; /* Behaviour options */ - byte status; /* Matching result */ -#endif -} SNI; - -CYASSL_LOCAL int TLSX_UseSNI(TLSX** extensions, byte type, const void* data, - word16 size); - -#ifndef NO_CYASSL_SERVER -CYASSL_LOCAL void TLSX_SNI_SetOptions(TLSX* extensions, byte type, - byte options); -CYASSL_LOCAL byte TLSX_SNI_Status(TLSX* extensions, byte type); -CYASSL_LOCAL word16 TLSX_SNI_GetRequest(TLSX* extensions, byte type, - void** data); -CYASSL_LOCAL int TLSX_SNI_GetFromBuffer(const byte* buffer, word32 bufferSz, - byte type, byte* sni, word32* inOutSz); -#endif - -#endif /* HAVE_SNI */ - -/* Maximum Fragment Length */ -#ifdef HAVE_MAX_FRAGMENT - -CYASSL_LOCAL int TLSX_UseMaxFragment(TLSX** extensions, byte mfl); - -#endif /* HAVE_MAX_FRAGMENT */ - -#ifdef HAVE_TRUNCATED_HMAC - -CYASSL_LOCAL int TLSX_UseTruncatedHMAC(TLSX** extensions); - -#endif /* HAVE_TRUNCATED_HMAC */ - -#endif /* HAVE_TLS_EXTENSIONS */ - -/* CyaSSL context type */ -struct CYASSL_CTX { - CYASSL_METHOD* method; - CyaSSL_Mutex countMutex; /* reference count mutex */ - int refCount; /* reference count */ -#ifndef NO_CERTS - buffer certificate; - buffer certChain; - /* chain after self, in DER, with leading size for each cert */ - buffer privateKey; - buffer serverDH_P; - buffer serverDH_G; - CYASSL_CERT_MANAGER* cm; /* our cert manager, ctx owns SSL will use */ -#endif - Suites suites; - void* heap; /* for user memory overrides */ - byte verifyPeer; - byte verifyNone; - byte failNoCert; - byte sessionCacheOff; - byte sessionCacheFlushOff; - byte sendVerify; /* for client side */ - byte haveRSA; /* RSA available */ - byte haveDH; /* server DH parms set by user */ - byte haveNTRU; /* server private NTRU key loaded */ - byte haveECDSAsig; /* server cert signed w/ ECDSA */ - byte haveStaticECC; /* static server ECC private key */ - byte partialWrite; /* only one msg per write call */ - byte quietShutdown; /* don't send close notify */ - byte groupMessages; /* group handshake messages before sending */ - CallbackIORecv CBIORecv; - CallbackIOSend CBIOSend; -#ifdef CYASSL_DTLS - CallbackGenCookie CBIOCookie; /* gen cookie callback */ -#endif - VerifyCallback verifyCallback; /* cert verification callback */ - word32 timeout; /* session timeout */ -#ifdef HAVE_ECC - word16 eccTempKeySz; /* in octets 20 - 66 */ -#endif -#ifndef NO_PSK - byte havePSK; /* psk key set by user */ - psk_client_callback client_psk_cb; /* client callback */ - psk_server_callback server_psk_cb; /* server callback */ - char server_hint[MAX_PSK_ID_LEN]; -#endif /* NO_PSK */ -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - pem_password_cb passwd_cb; - void* userdata; -#endif /* OPENSSL_EXTRA */ -#ifdef HAVE_OCSP - CYASSL_OCSP ocsp; -#endif -#ifdef HAVE_CAVIUM - int devId; /* cavium device id to use */ -#endif -#ifdef HAVE_TLS_EXTENSIONS - TLSX* extensions; /* RFC 6066 TLS Extensions data */ -#endif -#ifdef ATOMIC_USER - CallbackMacEncrypt MacEncryptCb; /* Atomic User Mac/Encrypt Cb */ - CallbackDecryptVerify DecryptVerifyCb; /* Atomic User Decrypt/Verify Cb */ -#endif -#ifdef HAVE_PK_CALLBACKS - #ifdef HAVE_ECC - CallbackEccSign EccSignCb; /* User EccSign Callback handler */ - CallbackEccVerify EccVerifyCb; /* User EccVerify Callback handler */ - #endif /* HAVE_ECC */ - #ifndef NO_RSA - CallbackRsaSign RsaSignCb; /* User RsaSign Callback handler */ - CallbackRsaVerify RsaVerifyCb; /* User RsaVerify Callback handler */ - CallbackRsaEnc RsaEncCb; /* User Rsa Public Encrypt handler */ - CallbackRsaDec RsaDecCb; /* User Rsa Private Decrypt handler */ - #endif /* NO_RSA */ -#endif /* HAVE_PK_CALLBACKS */ -}; - - -CYASSL_LOCAL -int InitSSL_Ctx(CYASSL_CTX*, CYASSL_METHOD*); -CYASSL_LOCAL -void FreeSSL_Ctx(CYASSL_CTX*); -CYASSL_LOCAL -void SSL_CtxResourceFree(CYASSL_CTX*); - -CYASSL_LOCAL -int DeriveTlsKeys(CYASSL* ssl); -CYASSL_LOCAL -int ProcessOldClientHello(CYASSL* ssl, const byte* input, word32* inOutIdx, - word32 inSz, word16 sz); -#ifndef NO_CERTS - CYASSL_LOCAL - int AddCA(CYASSL_CERT_MANAGER* ctx, buffer der, int type, int verify); - CYASSL_LOCAL - int AlreadySigner(CYASSL_CERT_MANAGER* cm, byte* hash); -#endif - -/* All cipher suite related info */ -typedef struct CipherSpecs { - byte bulk_cipher_algorithm; - byte cipher_type; /* block, stream, or aead */ - byte mac_algorithm; - byte kea; /* key exchange algo */ - byte sig_algo; - byte hash_size; - byte pad_size; - byte static_ecdh; - word16 key_size; - word16 iv_size; - word16 block_size; - word16 aead_mac_size; -} CipherSpecs; - - -void InitCipherSpecs(CipherSpecs* cs); - - -/* Supported Message Authentication Codes from page 43 */ -enum MACAlgorithm { - no_mac, - md5_mac, - sha_mac, - sha224_mac, - sha256_mac, - sha384_mac, - sha512_mac, - rmd_mac, - blake2b_mac -}; - - -/* Supported Key Exchange Protocols */ -enum KeyExchangeAlgorithm { - no_kea, - rsa_kea, - diffie_hellman_kea, - fortezza_kea, - psk_kea, - ntru_kea, - ecc_diffie_hellman_kea, - ecc_static_diffie_hellman_kea /* for verify suite only */ -}; - - -/* Supported Authentication Schemes */ -enum SignatureAlgorithm { - anonymous_sa_algo, - rsa_sa_algo, - dsa_sa_algo, - ecc_dsa_sa_algo -}; - - -/* Supprted ECC Curve Types */ -enum EccCurves { - named_curve = 3 -}; - - -/* Supprted ECC Named Curves */ -enum EccNamedCurves { - secp256r1 = 0x17, /* default, OpenSSL also calls it prime256v1 */ - secp384r1 = 0x18, - secp521r1 = 0x19, - - secp160r1 = 0x10, - secp192r1 = 0x13, /* Openssl also call it prime192v1 */ - secp224r1 = 0x15 -}; - - -/* Valid client certificate request types from page 27 */ -enum ClientCertificateType { - rsa_sign = 1, - dss_sign = 2, - rsa_fixed_dh = 3, - dss_fixed_dh = 4, - rsa_ephemeral_dh = 5, - dss_ephemeral_dh = 6, - fortezza_kea_cert = 20 -}; - - -enum CipherType { stream, block, aead }; - - -#ifdef CYASSL_DTLS - - #ifdef WORD64_AVAILABLE - typedef word64 DtlsSeq; - #else - typedef word32 DtlsSeq; - #endif - #define DTLS_SEQ_BITS (sizeof(DtlsSeq) * CHAR_BIT) - - typedef struct DtlsState { - DtlsSeq window; /* Sliding window for current epoch */ - word16 nextEpoch; /* Expected epoch in next record */ - word32 nextSeq; /* Expected sequence in next record */ - - word16 curEpoch; /* Received epoch in current record */ - word32 curSeq; /* Received sequence in current record */ - - DtlsSeq prevWindow; /* Sliding window for old epoch */ - word32 prevSeq; /* Next sequence in allowed old epoch */ - } DtlsState; - -#endif /* CYASSL_DTLS */ - - -/* keys and secrets */ -typedef struct Keys { - byte client_write_MAC_secret[MAX_DIGEST_SIZE]; /* max sizes */ - byte server_write_MAC_secret[MAX_DIGEST_SIZE]; - byte client_write_key[AES_256_KEY_SIZE]; /* max sizes */ - byte server_write_key[AES_256_KEY_SIZE]; - byte client_write_IV[AES_IV_SIZE]; /* max sizes */ - byte server_write_IV[AES_IV_SIZE]; -#ifdef HAVE_AEAD - byte aead_exp_IV[AEAD_EXP_IV_SZ]; - byte aead_enc_imp_IV[AEAD_IMP_IV_SZ]; - byte aead_dec_imp_IV[AEAD_IMP_IV_SZ]; -#endif - - word32 peer_sequence_number; - word32 sequence_number; - -#ifdef CYASSL_DTLS - DtlsState dtls_state; /* Peer's state */ - word16 dtls_peer_handshake_number; - word16 dtls_expected_peer_handshake_number; - - word16 dtls_epoch; /* Current tx epoch */ - word32 dtls_sequence_number; /* Current tx sequence */ - word16 dtls_handshake_number; /* Current tx handshake seq */ -#endif - - word32 encryptSz; /* last size of encrypted data */ - word32 padSz; /* how much to advance after decrypt part */ - byte encryptionOn; /* true after change cipher spec */ - byte decryptedCur; /* only decrypt current record once */ -} Keys; - - -/* cipher for now */ -typedef struct Ciphers { -#ifdef BUILD_ARC4 - Arc4* arc4; -#endif -#ifdef BUILD_DES3 - Des3* des3; -#endif -#if defined(BUILD_AES) || defined(BUILD_AESGCM) - Aes* aes; -#endif -#ifdef HAVE_CAMELLIA - Camellia* cam; -#endif -#ifdef HAVE_HC128 - HC128* hc128; -#endif -#ifdef BUILD_RABBIT - Rabbit* rabbit; -#endif - byte setup; /* have we set it up flag for detection */ -} Ciphers; - - -CYASSL_LOCAL void InitCiphers(CYASSL* ssl); -CYASSL_LOCAL void FreeCiphers(CYASSL* ssl); - - -/* hashes type */ -typedef struct Hashes { - #ifndef NO_OLD_TLS - byte md5[MD5_DIGEST_SIZE]; - #endif - byte sha[SHA_DIGEST_SIZE]; - #ifndef NO_SHA256 - byte sha256[SHA256_DIGEST_SIZE]; - #endif - #ifdef CYASSL_SHA384 - byte sha384[SHA384_DIGEST_SIZE]; - #endif -} Hashes; - - -/* Static x509 buffer */ -typedef struct x509_buffer { - int length; /* actual size */ - byte buffer[MAX_X509_SIZE]; /* max static cert size */ -} x509_buffer; - - -/* CyaSSL X509_CHAIN, for no dynamic memory SESSION_CACHE */ -struct CYASSL_X509_CHAIN { - int count; /* total number in chain */ - x509_buffer certs[MAX_CHAIN_DEPTH]; /* only allow max depth 4 for now */ -}; - - -/* CyaSSL session type */ -struct CYASSL_SESSION { - byte sessionID[ID_LEN]; /* id for protocol */ - byte masterSecret[SECRET_LEN]; /* stored secret */ - word32 bornOn; /* create time in seconds */ - word32 timeout; /* timeout in seconds */ -#ifdef SESSION_CERTS - CYASSL_X509_CHAIN chain; /* peer cert chain, static */ - ProtocolVersion version; /* which version was used */ - byte cipherSuite0; /* first byte, normally 0 */ - byte cipherSuite; /* 2nd byte, actual suite */ -#endif -#ifndef NO_CLIENT_CACHE - byte serverID[SERVER_ID_LEN]; /* for easier client lookup */ - word16 idLen; /* serverID length */ -#endif -}; - - -CYASSL_LOCAL -CYASSL_SESSION* GetSession(CYASSL*, byte*); -CYASSL_LOCAL -int SetSession(CYASSL*, CYASSL_SESSION*); - -typedef void (*hmacfp) (CYASSL*, byte*, const byte*, word32, int, int); - -#ifndef NO_CLIENT_CACHE - CYASSL_SESSION* GetSessionClient(CYASSL*, const byte*, int); -#endif - -/* client connect state for nonblocking restart */ -enum ConnectState { - CONNECT_BEGIN = 0, - CLIENT_HELLO_SENT, - HELLO_AGAIN, /* HELLO_AGAIN s for DTLS case */ - HELLO_AGAIN_REPLY, - FIRST_REPLY_DONE, - FIRST_REPLY_FIRST, - FIRST_REPLY_SECOND, - FIRST_REPLY_THIRD, - FIRST_REPLY_FOURTH, - FINISHED_DONE, - SECOND_REPLY_DONE -}; - - -/* server accept state for nonblocking restart */ -enum AcceptState { - ACCEPT_BEGIN = 0, - ACCEPT_CLIENT_HELLO_DONE, - HELLO_VERIFY_SENT, - ACCEPT_FIRST_REPLY_DONE, - SERVER_HELLO_SENT, - CERT_SENT, - KEY_EXCHANGE_SENT, - CERT_REQ_SENT, - SERVER_HELLO_DONE, - ACCEPT_SECOND_REPLY_DONE, - CHANGE_CIPHER_SENT, - ACCEPT_FINISHED_DONE, - ACCEPT_THIRD_REPLY_DONE -}; - - -typedef struct Buffers { -#ifndef NO_CERTS - buffer certificate; /* CYASSL_CTX owns, unless we own */ - buffer key; /* CYASSL_CTX owns, unless we own */ - buffer certChain; /* CYASSL_CTX owns */ - /* chain after self, in DER, with leading size for each cert */ - buffer serverDH_P; /* CYASSL_CTX owns, unless we own */ - buffer serverDH_G; /* CYASSL_CTX owns, unless we own */ - buffer serverDH_Pub; - buffer serverDH_Priv; -#endif - buffer domainName; /* for client check */ - bufferStatic inputBuffer; - bufferStatic outputBuffer; - buffer clearOutputBuffer; - int prevSent; /* previous plain text bytes sent - when got WANT_WRITE */ - int plainSz; /* plain text bytes in buffer to send - when got WANT_WRITE */ - byte weOwnCert; /* SSL own cert flag */ - byte weOwnKey; /* SSL own key flag */ - byte weOwnDH; /* SSL own dh (p,g) flag */ -#ifdef CYASSL_DTLS - CYASSL_DTLS_CTX dtlsCtx; /* DTLS connection context */ -#endif -#ifdef HAVE_PK_CALLBACKS - #ifdef HAVE_ECC - buffer peerEccDsaKey; /* we own for Ecc Verify Callbacks */ - #endif /* HAVE_ECC */ - #ifndef NO_RSA - buffer peerRsaKey; /* we own for Rsa Verify Callbacks */ - #endif /* NO_RSA */ -#endif /* HAVE_PK_CALLBACKS */ -} Buffers; - -typedef struct Options { - byte sessionCacheOff; - byte sessionCacheFlushOff; - byte cipherSuite0; /* first byte, normally 0 */ - byte cipherSuite; /* second byte, actual suite */ - byte serverState; - byte clientState; - byte handShakeState; - byte side; /* client or server end */ - byte verifyPeer; - byte verifyNone; - byte failNoCert; - byte downgrade; /* allow downgrade of versions */ - byte sendVerify; /* false = 0, true = 1, sendBlank = 2 */ - byte resuming; - byte haveSessionId; /* server may not send */ - byte tls; /* using TLS ? */ - byte tls1_1; /* using TLSv1.1+ ? */ - byte dtls; /* using datagrams ? */ - byte connReset; /* has the peer reset */ - byte isClosed; /* if we consider conn closed */ - byte closeNotify; /* we've recieved a close notify */ - byte sentNotify; /* we've sent a close notify */ - byte connectState; /* nonblocking resume */ - byte acceptState; /* nonblocking resume */ - byte usingCompression; /* are we using compression */ - byte haveRSA; /* RSA available */ - byte haveDH; /* server DH parms set by user */ - byte haveNTRU; /* server NTRU private key loaded */ - byte haveECDSAsig; /* server ECDSA signed cert */ - byte haveStaticECC; /* static server ECC private key */ - byte havePeerCert; /* do we have peer's cert */ - byte havePeerVerify; /* and peer's cert verify */ - byte usingPSK_cipher; /* whether we're using psk as cipher */ - byte sendAlertState; /* nonblocking resume */ - byte processReply; /* nonblocking resume */ - byte partialWrite; /* only one msg per write call */ - byte quietShutdown; /* don't send close notify */ - byte certOnly; /* stop once we get cert */ - byte groupMessages; /* group handshake messages */ - byte usingNonblock; /* set when using nonblocking socket */ - byte saveArrays; /* save array Memory for user get keys - or psk */ -#ifndef NO_PSK - byte havePSK; /* psk key set by user */ - psk_client_callback client_psk_cb; - psk_server_callback server_psk_cb; -#endif /* NO_PSK */ -} Options; - -typedef struct Arrays { - byte clientRandom[RAN_LEN]; - byte serverRandom[RAN_LEN]; - byte sessionID[ID_LEN]; - byte preMasterSecret[ENCRYPT_LEN]; - byte masterSecret[SECRET_LEN]; -#ifdef CYASSL_DTLS - byte cookie[MAX_COOKIE_LEN]; - byte cookieSz; -#endif -#ifndef NO_PSK - char client_identity[MAX_PSK_ID_LEN]; - char server_hint[MAX_PSK_ID_LEN]; - byte psk_key[MAX_PSK_KEY_LEN]; - word32 psk_keySz; /* acutal size */ -#endif - word32 preMasterSz; /* differs for DH, actual size */ -} Arrays; - -#ifndef ASN_NAME_MAX -#define ASN_NAME_MAX 256 -#endif - -#ifndef MAX_DATE_SZ -#define MAX_DATE_SZ 32 -#endif - -struct CYASSL_X509_NAME { - char *name; - char staticName[ASN_NAME_MAX]; - int dynamicName; - int sz; -#ifdef OPENSSL_EXTRA - DecodedName fullName; -#endif /* OPENSSL_EXTRA */ -}; - -#ifndef EXTERNAL_SERIAL_SIZE - #define EXTERNAL_SERIAL_SIZE 32 -#endif - -#ifdef NO_ASN - typedef struct DNS_entry DNS_entry; -#endif - -struct CYASSL_X509 { - int version; - CYASSL_X509_NAME issuer; - CYASSL_X509_NAME subject; - int serialSz; - byte serial[EXTERNAL_SERIAL_SIZE]; - char subjectCN[ASN_NAME_MAX]; /* common name short cut */ -#ifdef CYASSL_SEP - int deviceTypeSz; - byte deviceType[EXTERNAL_SERIAL_SIZE]; - int hwTypeSz; - byte hwType[EXTERNAL_SERIAL_SIZE]; - int hwSerialNumSz; - byte hwSerialNum[EXTERNAL_SERIAL_SIZE]; - #ifdef OPENSSL_EXTRA - byte certPolicySet; - byte certPolicyCrit; - #endif /* OPENSSL_EXTRA */ -#endif - int notBeforeSz; - byte notBefore[MAX_DATE_SZ]; - int notAfterSz; - byte notAfter[MAX_DATE_SZ]; - int sigOID; - buffer sig; - int pubKeyOID; - buffer pubKey; - #ifdef HAVE_ECC - word32 pkCurveOID; - #endif /* HAVE_ECC */ - buffer derCert; /* may need */ - DNS_entry* altNames; /* alt names list */ - DNS_entry* altNamesNext; /* hint for retrieval */ - byte dynamicMemory; /* dynamic memory flag */ - byte isCa; -#ifdef OPENSSL_EXTRA - word32 pathLength; - word16 keyUsage; - byte basicConstSet; - byte basicConstCrit; - byte basicConstPlSet; - byte subjAltNameSet; - byte subjAltNameCrit; - byte authKeyIdSet; - byte authKeyIdCrit; - byte* authKeyId; - word32 authKeyIdSz; - byte subjKeyIdSet; - byte subjKeyIdCrit; - byte* subjKeyId; - word32 subjKeyIdSz; - byte keyUsageSet; - byte keyUsageCrit; -#endif /* OPENSSL_EXTRA */ -}; - - -/* record layer header for PlainText, Compressed, and CipherText */ -typedef struct RecordLayerHeader { - byte type; - byte pvMajor; - byte pvMinor; - byte length[2]; -} RecordLayerHeader; - - -/* record layer header for DTLS PlainText, Compressed, and CipherText */ -typedef struct DtlsRecordLayerHeader { - byte type; - byte pvMajor; - byte pvMinor; - byte epoch[2]; /* increment on cipher state change */ - byte sequence_number[6]; /* per record */ - byte length[2]; -} DtlsRecordLayerHeader; - - -typedef struct DtlsPool { - buffer buf[DTLS_POOL_SZ]; - int used; -} DtlsPool; - -typedef struct DtlsMsg { - struct DtlsMsg* next; - word32 seq; /* Handshake sequence number */ - word32 sz; /* Length of whole mesage */ - word32 fragSz; /* Length of fragments received */ - byte type; - byte* buf; - byte* msg; -} DtlsMsg; - - -#ifdef HAVE_NETX - - /* NETX I/O Callback default */ - typedef struct NetX_Ctx { - NX_TCP_SOCKET* nxSocket; /* send/recv socket handle */ - NX_PACKET* nxPacket; /* incoming packet handle for short reads */ - ULONG nxOffset; /* offset already read from nxPacket */ - ULONG nxWait; /* wait option flag */ - } NetX_Ctx; - -#endif - - -/* CyaSSL ssl type */ -struct CYASSL { - CYASSL_CTX* ctx; - int error; - ProtocolVersion version; /* negotiated version */ - ProtocolVersion chVersion; /* client hello version */ - Suites* suites; /* only need during handshake */ - Ciphers encrypt; - Ciphers decrypt; - CipherSpecs specs; - Keys keys; - int rfd; /* read file descriptor */ - int wfd; /* write file descriptor */ - int rflags; /* user read flags */ - int wflags; /* user write flags */ - CYASSL_BIO* biord; /* socket bio read to free/close */ - CYASSL_BIO* biowr; /* socket bio write to free/close */ - void* IOCB_ReadCtx; - void* IOCB_WriteCtx; - RNG* rng; -#ifndef NO_OLD_TLS -#ifndef NO_SHA - Sha hashSha; /* sha hash of handshake msgs */ -#endif -#ifndef NO_MD5 - Md5 hashMd5; /* md5 hash of handshake msgs */ -#endif -#endif -#ifndef NO_SHA256 - Sha256 hashSha256; /* sha256 hash of handshake msgs */ -#endif -#ifdef CYASSL_SHA384 - Sha384 hashSha384; /* sha384 hash of handshake msgs */ -#endif - Hashes verifyHashes; - Hashes certHashes; /* for cert verify */ - Buffers buffers; - Options options; - Arrays* arrays; - CYASSL_SESSION session; - VerifyCallback verifyCallback; /* cert verification callback */ - void* verifyCbCtx; /* cert verify callback user ctx*/ -#ifndef NO_RSA - RsaKey* peerRsaKey; - byte peerRsaKeyPresent; -#endif -#ifdef HAVE_NTRU - word16 peerNtruKeyLen; - byte peerNtruKey[MAX_NTRU_PUB_KEY_SZ]; - byte peerNtruKeyPresent; -#endif -#ifdef HAVE_ECC - ecc_key* peerEccKey; /* peer's ECDHE key */ - ecc_key* peerEccDsaKey; /* peer's ECDSA key */ - ecc_key* eccTempKey; /* private ECDHE key */ - ecc_key* eccDsaKey; /* private ECDSA key */ - word16 eccTempKeySz; /* in octets 20 - 66 */ - byte peerEccKeyPresent; - byte peerEccDsaKeyPresent; - byte eccTempKeyPresent; - byte eccDsaKeyPresent; -#endif - hmacfp hmac; - void* heap; /* for user overrides */ - RecordLayerHeader curRL; - word16 curSize; - word32 timeout; /* session timeout */ - CYASSL_CIPHER cipher; -#ifdef HAVE_LIBZ - z_stream c_stream; /* compression stream */ - z_stream d_stream; /* decompression stream */ - byte didStreamInit; /* for stream init and end */ -#endif -#ifdef CYASSL_DTLS - int dtls_timeout_init; /* starting timeout vaule */ - int dtls_timeout_max; /* maximum timeout value */ - int dtls_timeout; /* current timeout value, changes */ - DtlsPool* dtls_pool; - DtlsMsg* dtls_msg_list; - void* IOCB_CookieCtx; /* gen cookie ctx */ - word32 dtls_expected_rx; -#endif -#ifdef CYASSL_CALLBACKS - HandShakeInfo handShakeInfo; /* info saved during handshake */ - TimeoutInfo timeoutInfo; /* info saved during handshake */ - byte hsInfoOn; /* track handshake info */ - byte toInfoOn; /* track timeout info */ -#endif -#ifdef KEEP_PEER_CERT - CYASSL_X509 peerCert; /* X509 peer cert */ -#endif -#ifdef FORTRESS - void* ex_data[MAX_EX_DATA]; /* external data, for Fortress */ -#endif -#ifdef HAVE_CAVIUM - int devId; /* cavium device id to use */ -#endif -#ifdef HAVE_TLS_EXTENSIONS - TLSX* extensions; /* RFC 6066 TLS Extensions data */ -#ifdef HAVE_MAX_FRAGMENT - word16 max_fragment; -#endif -#ifdef HAVE_TRUNCATED_HMAC - byte truncated_hmac; -#endif -#endif -#ifdef HAVE_NETX - NetX_Ctx nxCtx; /* NetX IO Context */ -#endif -#ifdef SESSION_INDEX - int sessionIndex; /* Session's location in the cache. */ -#endif - CYASSL_ALERT_HISTORY alert_history; -#ifdef ATOMIC_USER - void* MacEncryptCtx; /* Atomic User Mac/Encrypt Callback Context */ - void* DecryptVerifyCtx; /* Atomic User Decrypt/Verify Callback Context */ -#endif -#ifdef HAVE_PK_CALLBACKS - #ifdef HAVE_ECC - void* EccSignCtx; /* Ecc Sign Callback Context */ - void* EccVerifyCtx; /* Ecc Verify Callback Context */ - #endif /* HAVE_ECC */ - #ifndef NO_RSA - void* RsaSignCtx; /* Rsa Sign Callback Context */ - void* RsaVerifyCtx; /* Rsa Verify Callback Context */ - void* RsaEncCtx; /* Rsa Public Encrypt Callback Context */ - void* RsaDecCtx; /* Rsa Private Decrypt Callback Context */ - #endif /* NO_RSA */ -#endif /* HAVE_PK_CALLBACKS */ -}; - - -CYASSL_LOCAL -int InitSSL(CYASSL*, CYASSL_CTX*); -CYASSL_LOCAL -void FreeSSL(CYASSL*); -CYASSL_API void SSL_ResourceFree(CYASSL*); /* Micrium uses */ - - -enum { - IV_SZ = 32, /* max iv sz */ - NAME_SZ = 80 /* max one line */ -}; - - -typedef struct EncryptedInfo { - char name[NAME_SZ]; /* encryption name */ - byte iv[IV_SZ]; /* encrypted IV */ - word32 ivSz; /* encrypted IV size */ - long consumed; /* tracks PEM bytes consumed */ - byte set; /* if encryption set */ - CYASSL_CTX* ctx; /* CTX owner */ -} EncryptedInfo; - - -#ifndef NO_CERTS - CYASSL_LOCAL int PemToDer(const unsigned char* buff, long sz, int type, - buffer* der, void* heap, EncryptedInfo* info, - int* eccKey); - - CYASSL_LOCAL int ProcessFile(CYASSL_CTX* ctx, const char* fname, int format, - int type, CYASSL* ssl, int userChain, - CYASSL_CRL* crl); -#endif - - -#ifdef CYASSL_CALLBACKS - CYASSL_LOCAL - void InitHandShakeInfo(HandShakeInfo*); - CYASSL_LOCAL - void FinishHandShakeInfo(HandShakeInfo*, const CYASSL*); - CYASSL_LOCAL - void AddPacketName(const char*, HandShakeInfo*); - - CYASSL_LOCAL - void InitTimeoutInfo(TimeoutInfo*); - CYASSL_LOCAL - void FreeTimeoutInfo(TimeoutInfo*, void*); - CYASSL_LOCAL - void AddPacketInfo(const char*, TimeoutInfo*, const byte*, int, void*); - CYASSL_LOCAL - void AddLateName(const char*, TimeoutInfo*); - CYASSL_LOCAL - void AddLateRecordHeader(const RecordLayerHeader* rl, TimeoutInfo* info); -#endif - - -/* Record Layer Header identifier from page 12 */ -enum ContentType { - no_type = 0, - change_cipher_spec = 20, - alert = 21, - handshake = 22, - application_data = 23 -}; - - -/* handshake header, same for each message type, pgs 20/21 */ -typedef struct HandShakeHeader { - byte type; - word24 length; -} HandShakeHeader; - - -/* DTLS handshake header, same for each message type */ -typedef struct DtlsHandShakeHeader { - byte type; - word24 length; - byte message_seq[2]; /* start at 0, restransmit gets same # */ - word24 fragment_offset; /* bytes in previous fragments */ - word24 fragment_length; /* length of this fragment */ -} DtlsHandShakeHeader; - - -enum HandShakeType { - no_shake = -1, - hello_request = 0, - client_hello = 1, - server_hello = 2, - hello_verify_request = 3, /* DTLS addition */ - session_ticket = 4, - certificate = 11, - server_key_exchange = 12, - certificate_request = 13, - server_hello_done = 14, - certificate_verify = 15, - client_key_exchange = 16, - finished = 20 -}; - - -static const byte client[SIZEOF_SENDER] = { 0x43, 0x4C, 0x4E, 0x54 }; -static const byte server[SIZEOF_SENDER] = { 0x53, 0x52, 0x56, 0x52 }; - -static const byte tls_client[FINISHED_LABEL_SZ + 1] = "client finished"; -static const byte tls_server[FINISHED_LABEL_SZ + 1] = "server finished"; - - -/* internal functions */ -CYASSL_LOCAL int SendChangeCipher(CYASSL*); -CYASSL_LOCAL int SendData(CYASSL*, const void*, int); -CYASSL_LOCAL int SendCertificate(CYASSL*); -CYASSL_LOCAL int SendCertificateRequest(CYASSL*); -CYASSL_LOCAL int SendServerKeyExchange(CYASSL*); -CYASSL_LOCAL int SendBuffered(CYASSL*); -CYASSL_LOCAL int ReceiveData(CYASSL*, byte*, int, int); -CYASSL_LOCAL int SendFinished(CYASSL*); -CYASSL_LOCAL int SendAlert(CYASSL*, int, int); -CYASSL_LOCAL int ProcessReply(CYASSL*); - -CYASSL_LOCAL int SetCipherSpecs(CYASSL*); -CYASSL_LOCAL int MakeMasterSecret(CYASSL*); - -CYASSL_LOCAL int AddSession(CYASSL*); -CYASSL_LOCAL int DeriveKeys(CYASSL* ssl); -CYASSL_LOCAL int StoreKeys(CYASSL* ssl, const byte* keyData); - -CYASSL_LOCAL int IsTLS(const CYASSL* ssl); -CYASSL_LOCAL int IsAtLeastTLSv1_2(const CYASSL* ssl); - -CYASSL_LOCAL void FreeHandshakeResources(CYASSL* ssl); -CYASSL_LOCAL void ShrinkInputBuffer(CYASSL* ssl, int forcedFree); -CYASSL_LOCAL void ShrinkOutputBuffer(CYASSL* ssl); -#ifndef NO_CERTS - CYASSL_LOCAL Signer* GetCA(void* cm, byte* hash); - #ifndef NO_SKID - CYASSL_LOCAL Signer* GetCAByName(void* cm, byte* hash); - #endif -#endif -CYASSL_LOCAL void BuildTlsFinished(CYASSL* ssl, Hashes* hashes, - const byte* sender); -CYASSL_LOCAL void FreeArrays(CYASSL* ssl, int keep); -CYASSL_LOCAL int CheckAvailableSize(CYASSL *ssl, int size); -CYASSL_LOCAL int GrowInputBuffer(CYASSL* ssl, int size, int usedLength); - -#ifndef NO_TLS - CYASSL_LOCAL int MakeTlsMasterSecret(CYASSL*); - CYASSL_LOCAL void TLS_hmac(CYASSL* ssl, byte* digest, const byte* in, - word32 sz, int content, int verify); -#endif - -#ifndef NO_CYASSL_CLIENT - CYASSL_LOCAL int SendClientHello(CYASSL*); - CYASSL_LOCAL int SendClientKeyExchange(CYASSL*); - CYASSL_LOCAL int SendCertificateVerify(CYASSL*); -#endif /* NO_CYASSL_CLIENT */ - -#ifndef NO_CYASSL_SERVER - CYASSL_LOCAL int SendServerHello(CYASSL*); - CYASSL_LOCAL int SendServerHelloDone(CYASSL*); - #ifdef CYASSL_DTLS - CYASSL_LOCAL int SendHelloVerifyRequest(CYASSL*); - #endif -#endif /* NO_CYASSL_SERVER */ - -#ifdef CYASSL_DTLS - CYASSL_LOCAL int DtlsPoolInit(CYASSL*); - CYASSL_LOCAL int DtlsPoolSave(CYASSL*, const byte*, int); - CYASSL_LOCAL int DtlsPoolTimeout(CYASSL*); - CYASSL_LOCAL int DtlsPoolSend(CYASSL*); - CYASSL_LOCAL void DtlsPoolReset(CYASSL*); - - CYASSL_LOCAL DtlsMsg* DtlsMsgNew(word32, void*); - CYASSL_LOCAL void DtlsMsgDelete(DtlsMsg*, void*); - CYASSL_LOCAL void DtlsMsgListDelete(DtlsMsg*, void*); - CYASSL_LOCAL void DtlsMsgSet(DtlsMsg*, word32, const byte*, byte, - word32, word32); - CYASSL_LOCAL DtlsMsg* DtlsMsgFind(DtlsMsg*, word32); - CYASSL_LOCAL DtlsMsg* DtlsMsgStore(DtlsMsg*, word32, const byte*, word32, - byte, word32, word32, void*); - CYASSL_LOCAL DtlsMsg* DtlsMsgInsert(DtlsMsg*, DtlsMsg*); -#endif /* CYASSL_DTLS */ - -#ifndef NO_TLS - - -#endif /* NO_TLS */ - - -CYASSL_LOCAL word32 LowResTimer(void); - -CYASSL_LOCAL void InitX509Name(CYASSL_X509_NAME*, int); -CYASSL_LOCAL void FreeX509Name(CYASSL_X509_NAME* name); -CYASSL_LOCAL void InitX509(CYASSL_X509*, int); -CYASSL_LOCAL void FreeX509(CYASSL_X509*); -#ifndef NO_CERTS - CYASSL_LOCAL int CopyDecodedToX509(CYASSL_X509*, DecodedCert*); -#endif - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - -#endif /* CyaSSL_INT_H */ - diff --git a/cyassl/ssl.h b/cyassl/ssl.h index 6473dcc73..b791c2a49 100644 --- a/cyassl/ssl.h +++ b/cyassl/ssl.h @@ -675,10 +675,7 @@ enum { /* ssl Constants */ SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN = 103, SSL_R_SSLV3_ALERT_BAD_CERTIFICATE = 104, - PEM_BUFSIZE = 1024, - /* for non-blocking CyaSSL_connect */ - SSL_CONNECTING = 201, /* Ready for the next step */ - SSL_CONNECT_WAITING = 202 /* Waiting for the response */ + PEM_BUFSIZE = 1024 }; @@ -942,7 +939,9 @@ CYASSL_API void CyaSSL_SetIOWriteFlags(CYASSL* ssl, int flags); CYASSL_API void CyaSSL_SetIO_NetX(CYASSL* ssl, NX_TCP_SOCKET* nxsocket, ULONG waitoption); #endif - +#ifdef HAVE_LWIP_NATIVE + CYASSL_API int CyaSSL_SetIO_LwIP(CYASSL* ssl, void *pcb); +#endif typedef int (*CallbackGenCookie)(CYASSL* ssl, unsigned char* buf, int sz, void* ctx); CYASSL_API void CyaSSL_CTX_SetGenCookie(CYASSL_CTX*, CallbackGenCookie); diff --git a/src/internal.c b/src/internal.c index c050f856c..964f7af6a 100644 --- a/src/internal.c +++ b/src/internal.c @@ -1434,6 +1434,10 @@ int InitSSL(CYASSL* ssl, CYASSL_CTX* ctx) ssl->IOCB_ReadCtx = &ssl->nxCtx; /* default NetX IO ctx, same for read */ ssl->IOCB_WriteCtx = &ssl->nxCtx; /* and write */ #endif +#ifdef HAVE_LWIP_NATIVE + ssl->lwipCtx.pbuf = NULL ; + ssl->lwipCtx.pulled = 0 ; +#endif #ifdef CYASSL_DTLS ssl->IOCB_CookieCtx = NULL; /* we don't use for default cb */ ssl->dtls_expected_rx = MAX_MTU; diff --git a/src/io.c b/src/io.c index bb4bb1ec2..02ff56803 100644 --- a/src/io.c +++ b/src/io.c @@ -1050,7 +1050,15 @@ void CyaSSL_SetIO_NetX(CYASSL* ssl, NX_TCP_SOCKET* nxSocket, ULONG waitOption) #include "lwip/tcp.h" #include "lwip/pbuf.h" #include "lwip/sockets.h" -#include "SSL-NB.h" + +#if 0 +/*Enable debug*/ +#include +#define DBG_PRINTF(x, ...) printf("[SSLClient : DBG]"x"\r\n", ##__VA_ARGS__); +#else +/*Disable debug*/ +#define DBG_PRINTF(x, ...) +#endif #if 0 /*Enable debug*/ @@ -1060,9 +1068,13 @@ void CyaSSL_SetIO_NetX(CYASSL* ssl, NX_TCP_SOCKET* nxSocket, ULONG waitOption) #define DBG_PRINTF_CB(x, ...) #endif -void CyaSSL_PbufFree(struct pbuf *p) +#define ERR_PRINTF(x, ...) printf("[SSLClient:ERROR]"x"\r\n", ##__VA_ARGS__); + +void CyaSSL_PbufFree(void *vp) { + struct pbuf *p ; struct pbuf * next; + p = (struct pbuf *) vp ; while(p->next != NULL) { next = p->next; @@ -1072,20 +1084,20 @@ void CyaSSL_PbufFree(struct pbuf *p) pbuf_free(p); } -static int CyaSSL_GetDataFromPbuf(char *buff, CYASSL_NB *ssl_nb, int size) +static int CyaSSL_GetDataFromPbuf(char *buff, CYASSL *ssl, 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)) + p = ssl->lwipCtx.pbuf ; + if(p->tot_len < (ssl->lwipCtx.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) ; + if(p->len && p->len > (ssl->lwipCtx.pulled - skipLen) ){ + skipLen = (ssl->lwipCtx.pulled - skipLen) ; break ; } else { skipLen += p->len ; @@ -1113,25 +1125,62 @@ static int CyaSSL_GetDataFromPbuf(char *buff, CYASSL_NB *ssl_nb, int size) 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) ; + ssl->lwipCtx.pulled += totalLen ; + if(ssl->lwipCtx.pbuf->tot_len <= ssl->lwipCtx.pulled) { + CyaSSL_PbufFree(ssl->lwipCtx.pbuf) ; + ssl->lwipCtx.pbuf = NULL ; + tcp_recved(ssl->lwipCtx.pcb,ssl->lwipCtx.pbuf->tot_len) ; } return totalLen; } +err_t CyaSSL_connectCallback(void *cb, struct tcp_pcb *pcb, struct pbuf *p, s8_t err) +{ + struct pbuf *next ; + CYASSL *ssl ; + ssl = (CYASSL *)cb ; + + if((cb == NULL)||(pcb == NULL)) + ERR_PRINTF("CyaSSL_connectCallBack, cb=%x, pcb=%d\n", cb, pcb) ; + if(p && (err == 0)) { + DBG_PRINTF_CB("CyaSSL_connectCallBack, 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->lwipCtx.pbuf) { + next = ssl->lwipCtx.pbuf ; + while(1) { + if(next->next) + next = next->next ; + else break ; + } + next->next = p ; + ssl->lwipCtx.pbuf->tot_len += p->tot_len ; + } else { + ssl->lwipCtx.pbuf = p ; + } + ssl->lwipCtx.pulled = 0 ; + if(ssl->lwipCtx.wait < 0) + ssl->lwipCtx.wait = 10000 ; + return ERR_OK; +} + +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_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) ; + DBG_PRINTF_CB("CyaSSL_LwIP_Receive: ssl_nb = %x\n", ssl) ; - 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(ssl->lwipCtx.pbuf) { + DBG_PRINTF_CB("Received Len=%d, Want Len= %d\n", ssl->lwipCtx.pbuf->tot_len, sz) ; + ret = CyaSSL_GetDataFromPbuf(buf, ssl, sz) ; if(ret == 0) ret = CYASSL_CBIO_ERR_WANT_READ ; } else { @@ -1143,13 +1192,35 @@ int CyaSSL_LwIP_Receive(CYASSL* ssl, char *buf, int sz, void *cb) 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) ; + err_t ret ; + + DBG_PRINTF_CB("CyaSSL_LwIP_Send: ssl = %x\n", ssl) ; 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 ; + ret = tcp_write(ssl->lwipCtx.pcb, buf, sz, TCP_WRITE_FLAG_COPY) ; + if(ret == ERR_OK) + return sz ; + else { + ERR_PRINTF("Send ssl=%x, ret=%d\n", ssl, ret) ; + return -1 ; + } } + +void CyaSSL_NB_setCallbackArg(CYASSL *ssl, void *arg) +{ + ssl->lwipCtx.arg = arg ; +} + +int CyaSSL_SetIO_LwIP(CYASSL* ssl, void* pcb) +{ + if (ssl && pcb) { + ssl->lwipCtx.pcb = (struct tcp_pcb *)pcb ; + tcp_recv(pcb, CyaSSL_connectCallback); + tcp_sent(pcb, DataSentCallback); + tcp_arg (pcb, (void *)ssl) ; + } else return BAD_FUNC_ARG ; + return ERR_OK ; +} + #endif /* HAVE_LWIP_NATIVE */