forked from wolfSSL/wolfssl
This commit is contained in:
@@ -20,14 +20,13 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
|
||||
// <h> wolfCrypt Configuration
|
||||
|
||||
// <h>Cert/Key Strage
|
||||
// <o>Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
|
||||
#define MDK_CONF_CERT_BUFF 2
|
||||
#define MDK_CONF_CERT_BUFF 0
|
||||
#if MDK_CONF_CERT_BUFF== 1
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#elif MDK_CONF_CERT_BUFF == 2
|
||||
@@ -147,8 +146,9 @@
|
||||
|
||||
// <e>POLY1305
|
||||
#define MDK_CONF_POLY1305 1
|
||||
#if MDK_CONF_POLY1305 == 0
|
||||
#if MDK_CONF_POLY1305 == 1
|
||||
#define HAVE_POLY1305
|
||||
#define HAVE_ONE_TIME_AUTH
|
||||
#endif
|
||||
// </e>
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
@@ -20,15 +17,13 @@
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define USER_TIME
|
||||
#define TIME_OVERRIDES
|
||||
#define XTIME time_dummy /* Have to be replaced with operational function */
|
||||
static long time_dummy(long *t) { return (365*24*60*60*(2016-1970)) ; }
|
||||
#define WOLFSSL_USER_CURRTIME
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
|
||||
86
IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
Normal file
86
IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/* wolfssl_KEIL_ARM.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
/******************************************************************************/
|
||||
/** This file is for defining types, values for specific to KEIL-MDK-ARM. **/
|
||||
/******************************************************************************/
|
||||
#ifndef WOLFSSL_KEIL_ARM_H
|
||||
#define WOLFSSL_KEIL_ARM_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Go to STDIN */
|
||||
#define fgets(buff, sz, fd) wolfssl_fgets(buff, sz, fd)
|
||||
extern char * wolfssl_fgets ( char * str, int num, FILE * f ) ;
|
||||
|
||||
#define SOCKET_T int
|
||||
|
||||
/*** #include <socket.h> ***/
|
||||
#define NUMBITSPERBYTE 8
|
||||
#define FD_SETSIZE 10
|
||||
|
||||
typedef long fd_mask;
|
||||
#define NFDBITS (sizeof(fd_mask) * NUMBITSPERBYTE) /* bits per mask */
|
||||
|
||||
typedef struct fd_set {
|
||||
fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS];
|
||||
} fd_set;
|
||||
|
||||
/*** #include <sys/types.h> ***/
|
||||
struct timeval {
|
||||
long tv_sec; /* seconds */
|
||||
long tv_usec; /* microseconds */
|
||||
};
|
||||
|
||||
|
||||
#if defined(WOLFSSL_KEIL_TCP_NET)
|
||||
|
||||
#define SCK_EWOULDBLOCK BSD_ERROR_WOULDBLOCK
|
||||
#define SCK_ETIMEOUT BSD_ERROR_TIMEOUT
|
||||
#include "rl_net.h"
|
||||
|
||||
typedef int socklen_t ;
|
||||
|
||||
/* for avoiding conflict with KEIL-TCPnet BSD socket */
|
||||
/* Bodies are in cyassl_KEIL_RL.c */
|
||||
#if defined(HAVE_KEIL_RTX)
|
||||
#define sleep(t) os_dly_wait(t/1000+1) ;
|
||||
#elif defined (WOLFSSL_CMSIS_RTOS)
|
||||
#define sleep(t) osDelay(t/1000+1) ;
|
||||
#endif
|
||||
|
||||
/* for avoiding conflicting with KEIL-TCPnet TCP socket */
|
||||
/* Bodies are in test.h */
|
||||
#define tcp_connect wolfssl_tcp_connect
|
||||
#define tcp_socket wolfssl_tcp_soket
|
||||
#define tcp_listen wolfssl_tcp_listen
|
||||
#define tcp_select(a,b) (0)
|
||||
|
||||
/** KEIL-RL TCPnet ****/
|
||||
/* TCPnet BSD socket does not have following functions. */
|
||||
extern char *inet_ntoa(struct in_addr in);
|
||||
extern unsigned long inet_addr(const char *cp);
|
||||
extern int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, const struct timeval *timeout);
|
||||
|
||||
#endif /* WOLFSSL_KEIL_TCP_NET */
|
||||
|
||||
#endif /* WOLFSSL_KEIL_ARM_H */
|
||||
@@ -426,12 +426,12 @@
|
||||
<File>
|
||||
<FileName>config-Crypt.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>.\RTE\wolfSSL\config-Crypt.h</FilePath>
|
||||
<FilePath>.\RTE\wolfssl\config-Crypt.h</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>user_settings.h</FileName>
|
||||
<FileType>5</FileType>
|
||||
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
|
||||
<FilePath>.\RTE\wolfssl\user_settings.h</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
@@ -468,6 +468,36 @@
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.02" Cclass="CMSIS Driver" Cgroup="MCI" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0"/>
|
||||
@@ -585,20 +615,20 @@
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Benchmark" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Benchmark" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Dummy" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Dummy" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
@@ -733,54 +763,54 @@
|
||||
<package name="MDK-Middleware" url="http://www.keil.com/pack/" vendor="Keil" version="5.1.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<instance index="0">RTE\wolfssl\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfssl\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\wolfcrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.4.6"/>
|
||||
<instance index="0" removed="1">RTE\wolfssl\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<instance index="0">RTE\wolfssl\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptBenchmark"/>
|
||||
</targetInfos>
|
||||
|
||||
@@ -1,668 +0,0 @@
|
||||
/* settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
/* Place OS specific preprocessor flags, defines, includes here, will be
|
||||
included into every file because types.h includes it */
|
||||
|
||||
|
||||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
/* Uncomment next line if using ThreadX */
|
||||
/* #define THREADX */
|
||||
|
||||
/* Uncomment next line if using Micrium ucOS */
|
||||
/* #define MICRIUM */
|
||||
|
||||
/* Uncomment next line if using Mbed */
|
||||
/* #define MBED */
|
||||
|
||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||
/* #define MICROCHIP_PIC32 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
||||
/* #define MICROCHIP_TCPIP_V5 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
||||
/* #define MICROCHIP_TCPIP */
|
||||
|
||||
/* Uncomment next line if using PIC32MZ Crypto Engine */
|
||||
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for a game console */
|
||||
/* #define CYASSL_GAME_BUILD */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for LSR */
|
||||
/* #define CYASSL_LSR */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define CYASSL_STM32F2 */
|
||||
|
||||
/* Uncomment next line if using Comverge settings */
|
||||
/* #define COMVERGE */
|
||||
|
||||
/* Uncomment next line if using QL SEP settings */
|
||||
/* #define CYASSL_QL */
|
||||
|
||||
/* Uncomment next line if using LwIP native TCP socket settings */
|
||||
/* #define HAVE_LWIP_NATIVE */
|
||||
|
||||
/* Uncomment next line if building for EROAD */
|
||||
/* #define CYASSL_EROAD */
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
|
||||
#ifdef IPHONE
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_USER_SETTINGS
|
||||
#include <user_settings.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMVERGE
|
||||
#define THREADX
|
||||
#define HAVE_NETX
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_SESSION_CACHE
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef THREADX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETX
|
||||
#include "nx_api.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
|
||||
#define CYASSL_LWIP
|
||||
#define NO_WRITEV
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_PIC32
|
||||
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_MICROCHIP_PIC32MZ
|
||||
#define CYASSL_PIC32MZ_CE
|
||||
#define CYASSL_PIC32MZ_CRYPT
|
||||
#define HAVE_AES_ENGINE
|
||||
#define CYASSL_PIC32MZ_RNG
|
||||
/* #define CYASSL_PIC32MZ_HASH */
|
||||
#define CYASSL_AES_COUNTER
|
||||
#define HAVE_AESGCM
|
||||
#define NO_BIG_INT
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP_V5
|
||||
/* include timer functions */
|
||||
#include "TCPIP Stack/TCPIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP
|
||||
/* include timer, NTP functions */
|
||||
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||
#include "tcpip/tcpip.h"
|
||||
#else
|
||||
#include "system/system_services.h"
|
||||
#include "tcpip/sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MBED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_CERT
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define HAVE_ECC
|
||||
#define NO_SESSION_CACHE
|
||||
#define CYASSL_CMSIS_RTOS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_EROAD
|
||||
#define FREESCALE_MQX
|
||||
#define FREESCALE_MMCAU
|
||||
#define SINGLE_THREADED
|
||||
#define NO_STDIO_FILESYSTEM
|
||||
#define CYASSL_LEANPSK
|
||||
#define HAVE_NULL_CIPHER
|
||||
#define NO_OLD_TLS
|
||||
#define NO_ASN
|
||||
#define NO_BIG_INT
|
||||
#define NO_RSA
|
||||
#define NO_DSA
|
||||
#define NO_DH
|
||||
#define NO_CERTS
|
||||
#define NO_PWDBASED
|
||||
#define NO_DES3
|
||||
#define NO_MD4
|
||||
#define NO_RC4
|
||||
#define NO_MD5
|
||||
#define NO_SESSION_CACHE
|
||||
#define NO_MAIN_DRIVER
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET) && !defined(CYASSL_EROAD)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
||||
#include <stdlib.h>
|
||||
#define XMALLOC(s, h, type) malloc((s))
|
||||
#define XFREE(p, h, type) free((p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
||||
#undef XMALLOC
|
||||
#define XMALLOC yaXMALLOC
|
||||
#undef XFREE
|
||||
#define XFREE yaXFREE
|
||||
#undef XREALLOC
|
||||
#define XREALLOC yaXREALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifndef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
#ifndef NO_SHA512
|
||||
#define NO_SHA512
|
||||
#endif
|
||||
#ifndef NO_DH
|
||||
#define NO_DH
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
#define NO_DSA
|
||||
#endif
|
||||
#ifndef NO_HC128
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
|
||||
/* #define DEBUG_CYASSL */
|
||||
#define NO_CYASSL_DIR /* tbd */
|
||||
|
||||
#if (POLLOS)
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (RTPLATFORM)
|
||||
#if (!RTP_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#else
|
||||
#if (!KS_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (WINMSP3)
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
||||
#define XFREE(p, h, type) (rtp_free(p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
|
||||
#endif /* EBSNET */
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LSR
|
||||
#define HAVE_WEBSERVER
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define CYASSL_LOW_MEMORY
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#ifndef NO_FILESYSTEM
|
||||
#define LSR_FS
|
||||
#include "inc/hw_types.h"
|
||||
#include "fs.h"
|
||||
#endif
|
||||
#define CYASSL_LWIP
|
||||
#include <errno.h> /* for tcp errno */
|
||||
#define CYASSL_SAFERTOS
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
/* enum uses enum */
|
||||
#pragma diag_suppress=Pa089
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SAFERTOS
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "SafeRTOS/semphr.h"
|
||||
#endif
|
||||
|
||||
#include "SafeRTOS/heap.h"
|
||||
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||
#define XFREE(p, h, type) vPortFree((p))
|
||||
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LOW_MEMORY
|
||||
#undef RSA_LOW_MEM
|
||||
#define RSA_LOW_MEM
|
||||
#undef CYASSL_SMALL_STACK
|
||||
#define CYASSL_SMALL_STACK
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_CYASSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#define STM32F2_RNG
|
||||
#define STM32F2_CRYPTO
|
||||
#define KEIL_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifdef MICRIUM
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "net_cfg.h"
|
||||
#include "ssl_cfg.h"
|
||||
#include "net_secure_os.h"
|
||||
|
||||
#define CYASSL_TYPES
|
||||
|
||||
typedef CPU_INT08U byte;
|
||||
typedef CPU_INT16U word16;
|
||||
typedef CPU_INT32U word32;
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
|
||||
#define SIZEOF_LONG 4
|
||||
#undef SIZEOF_LONG_LONG
|
||||
#else
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#define STRING_USER
|
||||
|
||||
#define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
||||
#define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
||||
((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
||||
(CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
||||
((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
||||
(CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRSTR(pstr, pstr_srch) \
|
||||
((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
||||
(CPU_CHAR *)(pstr_srch)))
|
||||
#define XMEMSET(pmem, data_val, size) \
|
||||
((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
||||
(CPU_SIZE_T)(size)))
|
||||
#define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
||||
(void *)(psrc), (CPU_SIZE_T)(size)))
|
||||
#define XMEMCMP(pmem_1, pmem_2, size) \
|
||||
(((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
||||
(CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
||||
#define XMEMMOVE XMEMCPY
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
|
||||
#define MICRIUM_MALLOC
|
||||
#define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
|
||||
(CPU_SIZE_T)(s), (void *)0))
|
||||
#define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
|
||||
(p), (void *)0))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
|
||||
#undef NO_FILESYSTEM
|
||||
#else
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
|
||||
#define DEBUG_CYASSL
|
||||
#else
|
||||
#undef DEBUG_CYASSL
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
|
||||
#define OPENSSL_EXTRA
|
||||
#else
|
||||
#undef OPENSSL_EXTRA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
|
||||
#undef SINGLE_THREADED
|
||||
#else
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DH_EN == DEF_ENABLED)
|
||||
#undef NO_DH
|
||||
#else
|
||||
#define NO_DH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DSA_EN == DEF_ENABLED)
|
||||
#undef NO_DSA
|
||||
#else
|
||||
#define NO_DSA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_PSK_EN == DEF_ENABLED)
|
||||
#undef NO_PSK
|
||||
#else
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_3DES_EN == DEF_ENABLED)
|
||||
#undef NO_DES
|
||||
#else
|
||||
#define NO_DES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_AES_EN == DEF_ENABLED)
|
||||
#undef NO_AES
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RC4_EN == DEF_ENABLED)
|
||||
#undef NO_RC4
|
||||
#else
|
||||
#define NO_RC4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
|
||||
#undef NO_RABBIT
|
||||
#else
|
||||
#define NO_RABBIT
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_HC128_EN == DEF_ENABLED)
|
||||
#undef NO_HC128
|
||||
#else
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#else
|
||||
#undef BIG_ENDIAN_ORDER
|
||||
#define LITTLE_ENDIAN_ORDER
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MD4_EN == DEF_ENABLED)
|
||||
#undef NO_MD4
|
||||
#else
|
||||
#define NO_MD4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
|
||||
#undef NO_WRITEV
|
||||
#else
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
|
||||
#define NO_DEV_RANDOM
|
||||
#else
|
||||
#undef NO_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
|
||||
#define CYASSL_USER_IO
|
||||
#else
|
||||
#undef CYASSL_USER_IO
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
|
||||
#undef LARGE_STATIC_BUFFERS
|
||||
#undef STATIC_CHUNKS_ONLY
|
||||
#else
|
||||
#define LARGE_STATIC_BUFFERS
|
||||
#define STATIC_CHUNKS_ONLY
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
|
||||
#define CYASSL_DER_LOAD
|
||||
#else
|
||||
#undef CYASSL_DER_LOAD
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DTLS_EN == DEF_ENABLED)
|
||||
#define CYASSL_DTLS
|
||||
#else
|
||||
#undef CYASSL_DTLS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
|
||||
#define CYASSL_CALLBACKS
|
||||
#else
|
||||
#undef CYASSL_CALLBACKS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
|
||||
#define USE_FAST_MATH
|
||||
#else
|
||||
#undef USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#else
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#endif /* MICRIUM */
|
||||
|
||||
|
||||
#ifdef CYASSL_QL
|
||||
#ifndef CYASSL_SEP
|
||||
#define CYASSL_SEP
|
||||
#endif
|
||||
#ifndef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
#endif
|
||||
#ifndef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
#endif
|
||||
#ifndef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#endif
|
||||
#ifndef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
#endif
|
||||
#ifndef CYASSL_DER_LOAD
|
||||
#define CYASSL_DER_LOAD
|
||||
#endif
|
||||
#ifndef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
#ifndef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
#ifndef SESSION_INDEX
|
||||
#define SESSION_INDEX
|
||||
#endif
|
||||
#endif /* CYASSL_QL */
|
||||
|
||||
|
||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
||||
#define USE_CYASSL_MEMORY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
|
||||
|
||||
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
||||
#ifndef XSTREAM_ALIGNMENT
|
||||
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
||||
#define NO_XSTREAM_ALIGNMENT
|
||||
#else
|
||||
#define XSTREAM_ALIGNMENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef CYASSL_GENERAL_ALIGNMENT
|
||||
#ifdef CYASSL_AESNI
|
||||
#define CYASSL_GENERAL_ALIGNMENT 16
|
||||
#elif defined(XSTREAM_ALIGNMENT)
|
||||
#define CYASSL_GENERAL_ALIGNMENT 4
|
||||
#else
|
||||
#define CYASSL_GENERAL_ALIGNMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL
|
||||
/* not widely supported yet */
|
||||
#undef NO_SKID
|
||||
#define NO_SKID
|
||||
#endif
|
||||
|
||||
/* Place any other flags or defines here */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_SETTINGS_H */
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
@@ -19,22 +19,31 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_fs.h"
|
||||
#include "wolfcrypt/test/test.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stm32f2xx_hal.h"
|
||||
#include "cmsis_os.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* System Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize a Flash Memory Card
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
#include "rl_fs.h" /* FileSystem definitions */
|
||||
|
||||
static void init_filesystem (void) {
|
||||
int32_t retv;
|
||||
|
||||
@@ -52,21 +61,27 @@ static void init_filesystem (void) {
|
||||
printf ("Drive M0 initialization failed!\n");
|
||||
}
|
||||
}
|
||||
extern void benchmark_test(void * arg) ;
|
||||
extern void init_time(void) ;
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
void benchmark_test(void *arg) ;
|
||||
int main()
|
||||
{
|
||||
void * arg = NULL ;
|
||||
|
||||
HAL_Init(); /* Initialize the HAL Library */
|
||||
SystemClock_Config(); /* Configure the System Clock */
|
||||
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
init_filesystem ();
|
||||
#endif
|
||||
osDelay(300) ;
|
||||
|
||||
printf("=== Start: Crypt Benchmark ===\n") ;
|
||||
benchmark_test(arg) ;
|
||||
printf("=== End: Crypt Benchmark ===\n") ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* time-dummy.c.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
struct tm *Cyassl_MDK_gmtime(const time_t *c)
|
||||
{
|
||||
static struct tm date ;
|
||||
return(&date) ;
|
||||
}
|
||||
|
||||
time_t time(time_t * t) { return 0 ; }
|
||||
@@ -487,7 +487,7 @@
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
@@ -616,20 +616,20 @@
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Dummy" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Dummy" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Test" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Test" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
@@ -776,54 +776,54 @@
|
||||
<package name="MDK-Middleware" url="http://www.keil.com/pack/" vendor="Keil" version="5.1.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="3.9.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\cyassl\ctaocrypt\settings.h">
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\ctaocrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\CyaSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="CryptTest"/>
|
||||
</targetInfos>
|
||||
|
||||
@@ -1,668 +0,0 @@
|
||||
/* settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
/* Place OS specific preprocessor flags, defines, includes here, will be
|
||||
included into every file because types.h includes it */
|
||||
|
||||
|
||||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
/* Uncomment next line if using ThreadX */
|
||||
/* #define THREADX */
|
||||
|
||||
/* Uncomment next line if using Micrium ucOS */
|
||||
/* #define MICRIUM */
|
||||
|
||||
/* Uncomment next line if using Mbed */
|
||||
/* #define MBED */
|
||||
|
||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||
/* #define MICROCHIP_PIC32 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
||||
/* #define MICROCHIP_TCPIP_V5 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
||||
/* #define MICROCHIP_TCPIP */
|
||||
|
||||
/* Uncomment next line if using PIC32MZ Crypto Engine */
|
||||
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for a game console */
|
||||
/* #define CYASSL_GAME_BUILD */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for LSR */
|
||||
/* #define CYASSL_LSR */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define CYASSL_STM32F2 */
|
||||
|
||||
/* Uncomment next line if using Comverge settings */
|
||||
/* #define COMVERGE */
|
||||
|
||||
/* Uncomment next line if using QL SEP settings */
|
||||
/* #define CYASSL_QL */
|
||||
|
||||
/* Uncomment next line if using LwIP native TCP socket settings */
|
||||
/* #define HAVE_LWIP_NATIVE */
|
||||
|
||||
/* Uncomment next line if building for EROAD */
|
||||
/* #define CYASSL_EROAD */
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
|
||||
#ifdef IPHONE
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_USER_SETTINGS
|
||||
#include <user_settings.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMVERGE
|
||||
#define THREADX
|
||||
#define HAVE_NETX
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_SESSION_CACHE
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef THREADX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETX
|
||||
#include "nx_api.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
|
||||
#define CYASSL_LWIP
|
||||
#define NO_WRITEV
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_PIC32
|
||||
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_MICROCHIP_PIC32MZ
|
||||
#define CYASSL_PIC32MZ_CE
|
||||
#define CYASSL_PIC32MZ_CRYPT
|
||||
#define HAVE_AES_ENGINE
|
||||
#define CYASSL_PIC32MZ_RNG
|
||||
/* #define CYASSL_PIC32MZ_HASH */
|
||||
#define CYASSL_AES_COUNTER
|
||||
#define HAVE_AESGCM
|
||||
#define NO_BIG_INT
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP_V5
|
||||
/* include timer functions */
|
||||
#include "TCPIP Stack/TCPIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP
|
||||
/* include timer, NTP functions */
|
||||
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||
#include "tcpip/tcpip.h"
|
||||
#else
|
||||
#include "system/system_services.h"
|
||||
#include "tcpip/sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MBED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_CERT
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define HAVE_ECC
|
||||
#define NO_SESSION_CACHE
|
||||
#define CYASSL_CMSIS_RTOS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_EROAD
|
||||
#define FREESCALE_MQX
|
||||
#define FREESCALE_MMCAU
|
||||
#define SINGLE_THREADED
|
||||
#define NO_STDIO_FILESYSTEM
|
||||
#define CYASSL_LEANPSK
|
||||
#define HAVE_NULL_CIPHER
|
||||
#define NO_OLD_TLS
|
||||
#define NO_ASN
|
||||
#define NO_BIG_INT
|
||||
#define NO_RSA
|
||||
#define NO_DSA
|
||||
#define NO_DH
|
||||
#define NO_CERTS
|
||||
#define NO_PWDBASED
|
||||
#define NO_DES3
|
||||
#define NO_MD4
|
||||
#define NO_RC4
|
||||
#define NO_MD5
|
||||
#define NO_SESSION_CACHE
|
||||
#define NO_MAIN_DRIVER
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET) && !defined(CYASSL_EROAD)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
||||
#include <stdlib.h>
|
||||
#define XMALLOC(s, h, type) malloc((s))
|
||||
#define XFREE(p, h, type) free((p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
||||
#undef XMALLOC
|
||||
#define XMALLOC yaXMALLOC
|
||||
#undef XFREE
|
||||
#define XFREE yaXFREE
|
||||
#undef XREALLOC
|
||||
#define XREALLOC yaXREALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifndef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
#ifndef NO_SHA512
|
||||
#define NO_SHA512
|
||||
#endif
|
||||
#ifndef NO_DH
|
||||
#define NO_DH
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
#define NO_DSA
|
||||
#endif
|
||||
#ifndef NO_HC128
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
|
||||
/* #define DEBUG_CYASSL */
|
||||
#define NO_CYASSL_DIR /* tbd */
|
||||
|
||||
#if (POLLOS)
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (RTPLATFORM)
|
||||
#if (!RTP_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#else
|
||||
#if (!KS_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (WINMSP3)
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
||||
#define XFREE(p, h, type) (rtp_free(p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
|
||||
#endif /* EBSNET */
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LSR
|
||||
#define HAVE_WEBSERVER
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define CYASSL_LOW_MEMORY
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#ifndef NO_FILESYSTEM
|
||||
#define LSR_FS
|
||||
#include "inc/hw_types.h"
|
||||
#include "fs.h"
|
||||
#endif
|
||||
#define CYASSL_LWIP
|
||||
#include <errno.h> /* for tcp errno */
|
||||
#define CYASSL_SAFERTOS
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
/* enum uses enum */
|
||||
#pragma diag_suppress=Pa089
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SAFERTOS
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "SafeRTOS/semphr.h"
|
||||
#endif
|
||||
|
||||
#include "SafeRTOS/heap.h"
|
||||
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||
#define XFREE(p, h, type) vPortFree((p))
|
||||
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LOW_MEMORY
|
||||
#undef RSA_LOW_MEM
|
||||
#define RSA_LOW_MEM
|
||||
#undef CYASSL_SMALL_STACK
|
||||
#define CYASSL_SMALL_STACK
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_CYASSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#define STM32F2_RNG
|
||||
#define STM32F2_CRYPTO
|
||||
#define KEIL_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifdef MICRIUM
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "net_cfg.h"
|
||||
#include "ssl_cfg.h"
|
||||
#include "net_secure_os.h"
|
||||
|
||||
#define CYASSL_TYPES
|
||||
|
||||
typedef CPU_INT08U byte;
|
||||
typedef CPU_INT16U word16;
|
||||
typedef CPU_INT32U word32;
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
|
||||
#define SIZEOF_LONG 4
|
||||
#undef SIZEOF_LONG_LONG
|
||||
#else
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#define STRING_USER
|
||||
|
||||
#define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
||||
#define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
||||
((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
||||
(CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
||||
((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
||||
(CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRSTR(pstr, pstr_srch) \
|
||||
((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
||||
(CPU_CHAR *)(pstr_srch)))
|
||||
#define XMEMSET(pmem, data_val, size) \
|
||||
((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
||||
(CPU_SIZE_T)(size)))
|
||||
#define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
||||
(void *)(psrc), (CPU_SIZE_T)(size)))
|
||||
#define XMEMCMP(pmem_1, pmem_2, size) \
|
||||
(((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
||||
(CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
||||
#define XMEMMOVE XMEMCPY
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
|
||||
#define MICRIUM_MALLOC
|
||||
#define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
|
||||
(CPU_SIZE_T)(s), (void *)0))
|
||||
#define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
|
||||
(p), (void *)0))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
|
||||
#undef NO_FILESYSTEM
|
||||
#else
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
|
||||
#define DEBUG_CYASSL
|
||||
#else
|
||||
#undef DEBUG_CYASSL
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
|
||||
#define OPENSSL_EXTRA
|
||||
#else
|
||||
#undef OPENSSL_EXTRA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
|
||||
#undef SINGLE_THREADED
|
||||
#else
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DH_EN == DEF_ENABLED)
|
||||
#undef NO_DH
|
||||
#else
|
||||
#define NO_DH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DSA_EN == DEF_ENABLED)
|
||||
#undef NO_DSA
|
||||
#else
|
||||
#define NO_DSA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_PSK_EN == DEF_ENABLED)
|
||||
#undef NO_PSK
|
||||
#else
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_3DES_EN == DEF_ENABLED)
|
||||
#undef NO_DES
|
||||
#else
|
||||
#define NO_DES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_AES_EN == DEF_ENABLED)
|
||||
#undef NO_AES
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RC4_EN == DEF_ENABLED)
|
||||
#undef NO_RC4
|
||||
#else
|
||||
#define NO_RC4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
|
||||
#undef NO_RABBIT
|
||||
#else
|
||||
#define NO_RABBIT
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_HC128_EN == DEF_ENABLED)
|
||||
#undef NO_HC128
|
||||
#else
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#else
|
||||
#undef BIG_ENDIAN_ORDER
|
||||
#define LITTLE_ENDIAN_ORDER
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MD4_EN == DEF_ENABLED)
|
||||
#undef NO_MD4
|
||||
#else
|
||||
#define NO_MD4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
|
||||
#undef NO_WRITEV
|
||||
#else
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
|
||||
#define NO_DEV_RANDOM
|
||||
#else
|
||||
#undef NO_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
|
||||
#define CYASSL_USER_IO
|
||||
#else
|
||||
#undef CYASSL_USER_IO
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
|
||||
#undef LARGE_STATIC_BUFFERS
|
||||
#undef STATIC_CHUNKS_ONLY
|
||||
#else
|
||||
#define LARGE_STATIC_BUFFERS
|
||||
#define STATIC_CHUNKS_ONLY
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
|
||||
#define CYASSL_DER_LOAD
|
||||
#else
|
||||
#undef CYASSL_DER_LOAD
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DTLS_EN == DEF_ENABLED)
|
||||
#define CYASSL_DTLS
|
||||
#else
|
||||
#undef CYASSL_DTLS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
|
||||
#define CYASSL_CALLBACKS
|
||||
#else
|
||||
#undef CYASSL_CALLBACKS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
|
||||
#define USE_FAST_MATH
|
||||
#else
|
||||
#undef USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#else
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#endif /* MICRIUM */
|
||||
|
||||
|
||||
#ifdef CYASSL_QL
|
||||
#ifndef CYASSL_SEP
|
||||
#define CYASSL_SEP
|
||||
#endif
|
||||
#ifndef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
#endif
|
||||
#ifndef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
#endif
|
||||
#ifndef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#endif
|
||||
#ifndef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
#endif
|
||||
#ifndef CYASSL_DER_LOAD
|
||||
#define CYASSL_DER_LOAD
|
||||
#endif
|
||||
#ifndef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
#ifndef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
#ifndef SESSION_INDEX
|
||||
#define SESSION_INDEX
|
||||
#endif
|
||||
#endif /* CYASSL_QL */
|
||||
|
||||
|
||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
||||
#define USE_CYASSL_MEMORY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
|
||||
|
||||
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
||||
#ifndef XSTREAM_ALIGNMENT
|
||||
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
||||
#define NO_XSTREAM_ALIGNMENT
|
||||
#else
|
||||
#define XSTREAM_ALIGNMENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef CYASSL_GENERAL_ALIGNMENT
|
||||
#ifdef CYASSL_AESNI
|
||||
#define CYASSL_GENERAL_ALIGNMENT 16
|
||||
#elif defined(XSTREAM_ALIGNMENT)
|
||||
#define CYASSL_GENERAL_ALIGNMENT 4
|
||||
#else
|
||||
#define CYASSL_GENERAL_ALIGNMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL
|
||||
/* not widely supported yet */
|
||||
#undef NO_SKID
|
||||
#define NO_SKID
|
||||
#endif
|
||||
|
||||
/* Place any other flags or defines here */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_SETTINGS_H */
|
||||
|
||||
31
IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h
Normal file
31
IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -19,23 +19,29 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include "wolfcrypt/test/test.h"
|
||||
#include "cmsis_os.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stm32f2xx_hal.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* System Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize a Flash Memory Card
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
#include "rl_fs.h"
|
||||
#include "rl_fs.h" /* FileSystem definitions */
|
||||
|
||||
static void init_filesystem (void) {
|
||||
int32_t retv;
|
||||
@@ -56,8 +62,6 @@ static void init_filesystem (void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void ctaocrypt_test(void * arg) ;
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
@@ -66,12 +70,16 @@ int main()
|
||||
{
|
||||
void * arg = NULL ;
|
||||
|
||||
HAL_Init(); /* Initialize the HAL Library */
|
||||
SystemClock_Config(); /* Configure the System Clock */
|
||||
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
init_filesystem ();
|
||||
#endif
|
||||
osDelay(1000) ;
|
||||
|
||||
printf("=== Start: Crypt test ===\n") ;
|
||||
ctaocrypt_test(arg) ;
|
||||
wolfcrypt_test(arg) ;
|
||||
printf("=== End: Crypt test ===\n") ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* time-dummy.c.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
struct tm *Cyassl_MDK_gmtime(const time_t *c)
|
||||
{
|
||||
static struct tm date ;
|
||||
return(&date) ;
|
||||
}
|
||||
|
||||
time_t time(time_t * t) { return 0 ; }
|
||||
@@ -471,6 +471,41 @@
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Network_DS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="0.10.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.01" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0"/>
|
||||
@@ -654,20 +689,20 @@
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.9" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.9"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.9" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.9"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoClient" Cvendor="wolfSSL" Cversion="3.6.9" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.9"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoClient" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
@@ -838,68 +873,68 @@
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="6.4.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-CyaSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-wolfSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-CyaSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-Licnese.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-wolfSSL.h">
|
||||
<instance index="0">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\wolfcrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.4." condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.4.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
|
||||
@@ -1,628 +0,0 @@
|
||||
/* settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
/* Place OS specific preprocessor flags, defines, includes here, will be
|
||||
included into every file because types.h includes it */
|
||||
|
||||
|
||||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
/* Uncomment next line if using ThreadX */
|
||||
/* #define THREADX */
|
||||
|
||||
/* Uncomment next line if using Micrium ucOS */
|
||||
/* #define MICRIUM */
|
||||
|
||||
/* Uncomment next line if using Mbed */
|
||||
/* #define MBED */
|
||||
|
||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||
/* #define MICROCHIP_PIC32 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
||||
/* #define MICROCHIP_TCPIP_V5 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
||||
/* #define MICROCHIP_TCPIP */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for a game console */
|
||||
/* #define CYASSL_GAME_BUILD */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for LSR */
|
||||
/* #define CYASSL_LSR */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define CYASSL_STM32F2 */
|
||||
|
||||
/* Uncomment next line if using Comverge settings */
|
||||
/* #define COMVERGE */
|
||||
|
||||
/* Uncomment next line if using QL SEP settings */
|
||||
/* #define CYASSL_QL */
|
||||
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
|
||||
#ifdef IPHONE
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMVERGE
|
||||
#define THREADX
|
||||
#define HAVE_NETX
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_SESSION_CACHE
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef THREADX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETX
|
||||
#include "nx_api.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_PIC32
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP_V5
|
||||
/* include timer functions */
|
||||
#include "TCPIP Stack/TCPIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP
|
||||
/* include timer, NTP functions */
|
||||
#include "system/system_services.h"
|
||||
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||
#include "tcpip/tcpip.h"
|
||||
#else
|
||||
#include "tcpip/sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MBED
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#endif /* MBED */
|
||||
|
||||
#ifdef CYASSL_TYTO
|
||||
#include "rand.h"
|
||||
#define FREERTOS
|
||||
#define NO_FILESYSTEM
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_DEV_RANDOM
|
||||
#define HAVE_ECC
|
||||
#define HAVE_ECC_ENCRYPT
|
||||
#define ECC_SHAMIR
|
||||
#define HAVE_HKDF
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FP_MAX_BITS 512
|
||||
#define NO_OLD_TLS
|
||||
#define NO_MD4
|
||||
#define NO_RABBIT
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_DSA
|
||||
#define NO_PWDBASED
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
||||
#include <stdlib.h>
|
||||
#define XMALLOC(s, h, type) malloc((s))
|
||||
#define XFREE(p, h, type) free((p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
||||
#undef XMALLOC
|
||||
#define XMALLOC yaXMALLOC
|
||||
#undef XFREE
|
||||
#define XFREE yaXFREE
|
||||
#undef XREALLOC
|
||||
#define XREALLOC yaXREALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifndef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
#ifndef NO_SHA512
|
||||
#define NO_SHA512
|
||||
#endif
|
||||
#ifndef NO_DH
|
||||
#define NO_DH
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
#define NO_DSA
|
||||
#endif
|
||||
#ifndef NO_HC128
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
|
||||
/* #define DEBUG_CYASSL */
|
||||
#define NO_CYASSL_DIR /* tbd */
|
||||
|
||||
#if (POLLOS)
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (RTPLATFORM)
|
||||
#if (!RTP_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#else
|
||||
#if (!KS_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (WINMSP3)
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
||||
#define XFREE(p, h, type) (rtp_free(p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
|
||||
#endif /* EBSNET */
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LSR
|
||||
#define HAVE_WEBSERVER
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define CYASSL_LOW_MEMORY
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#ifndef NO_FILESYSTEM
|
||||
#define LSR_FS
|
||||
#include "inc/hw_types.h"
|
||||
#include "fs.h"
|
||||
#endif
|
||||
#define CYASSL_LWIP
|
||||
#include <errno.h> /* for tcp errno */
|
||||
#define CYASSL_SAFERTOS
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
/* enum uses enum */
|
||||
#pragma diag_suppress=Pa089
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SAFERTOS
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "SafeRTOS/semphr.h"
|
||||
#endif
|
||||
|
||||
#include "SafeRTOS/heap.h"
|
||||
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||
#define XFREE(p, h, type) vPortFree((p))
|
||||
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LOW_MEMORY
|
||||
#undef RSA_LOW_MEM
|
||||
#define RSA_LOW_MEM
|
||||
#undef CYASSL_SMALL_STACK
|
||||
#define CYASSL_SMALL_STACK
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_CYASSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#define STM32F2_RNG
|
||||
#define STM32F2_CRYPTO
|
||||
#define KEIL_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifdef MICRIUM
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "net_cfg.h"
|
||||
#include "ssl_cfg.h"
|
||||
#include "net_secure_os.h"
|
||||
|
||||
#define CYASSL_TYPES
|
||||
|
||||
typedef CPU_INT08U byte;
|
||||
typedef CPU_INT16U word16;
|
||||
typedef CPU_INT32U word32;
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
|
||||
#define SIZEOF_LONG 4
|
||||
#undef SIZEOF_LONG_LONG
|
||||
#else
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#define STRING_USER
|
||||
|
||||
#define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
||||
#define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
||||
((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
||||
(CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
||||
((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
||||
(CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRSTR(pstr, pstr_srch) \
|
||||
((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
||||
(CPU_CHAR *)(pstr_srch)))
|
||||
#define XMEMSET(pmem, data_val, size) \
|
||||
((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
||||
(CPU_SIZE_T)(size)))
|
||||
#define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
||||
(void *)(psrc), (CPU_SIZE_T)(size)))
|
||||
#define XMEMCMP(pmem_1, pmem_2, size) \
|
||||
(((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
||||
(CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
||||
#define XMEMMOVE XMEMCPY
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
|
||||
#define MICRIUM_MALLOC
|
||||
#define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
|
||||
(CPU_SIZE_T)(s), (void *)0))
|
||||
#define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
|
||||
(p), (void *)0))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
|
||||
#undef NO_FILESYSTEM
|
||||
#else
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
|
||||
#define DEBUG_CYASSL
|
||||
#else
|
||||
#undef DEBUG_CYASSL
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
|
||||
#define OPENSSL_EXTRA
|
||||
#else
|
||||
#undef OPENSSL_EXTRA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
|
||||
#undef SINGLE_THREADED
|
||||
#else
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DH_EN == DEF_ENABLED)
|
||||
#undef NO_DH
|
||||
#else
|
||||
#define NO_DH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DSA_EN == DEF_ENABLED)
|
||||
#undef NO_DSA
|
||||
#else
|
||||
#define NO_DSA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_PSK_EN == DEF_ENABLED)
|
||||
#undef NO_PSK
|
||||
#else
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_3DES_EN == DEF_ENABLED)
|
||||
#undef NO_DES
|
||||
#else
|
||||
#define NO_DES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_AES_EN == DEF_ENABLED)
|
||||
#undef NO_AES
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RC4_EN == DEF_ENABLED)
|
||||
#undef NO_RC4
|
||||
#else
|
||||
#define NO_RC4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
|
||||
#undef NO_RABBIT
|
||||
#else
|
||||
#define NO_RABBIT
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_HC128_EN == DEF_ENABLED)
|
||||
#undef NO_HC128
|
||||
#else
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#else
|
||||
#undef BIG_ENDIAN_ORDER
|
||||
#define LITTLE_ENDIAN_ORDER
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MD4_EN == DEF_ENABLED)
|
||||
#undef NO_MD4
|
||||
#else
|
||||
#define NO_MD4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
|
||||
#undef NO_WRITEV
|
||||
#else
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
|
||||
#define NO_DEV_RANDOM
|
||||
#else
|
||||
#undef NO_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
|
||||
#define CYASSL_USER_IO
|
||||
#else
|
||||
#undef CYASSL_USER_IO
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
|
||||
#undef LARGE_STATIC_BUFFERS
|
||||
#undef STATIC_CHUNKS_ONLY
|
||||
#else
|
||||
#define LARGE_STATIC_BUFFERS
|
||||
#define STATIC_CHUNKS_ONLY
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
|
||||
#define CYASSL_DER_LOAD
|
||||
#else
|
||||
#undef CYASSL_DER_LOAD
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DTLS_EN == DEF_ENABLED)
|
||||
#define CYASSL_DTLS
|
||||
#else
|
||||
#undef CYASSL_DTLS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
|
||||
#define CYASSL_CALLBACKS
|
||||
#else
|
||||
#undef CYASSL_CALLBACKS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
|
||||
#define USE_FAST_MATH
|
||||
#else
|
||||
#undef USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#else
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#endif /* MICRIUM */
|
||||
|
||||
|
||||
#ifdef CYASSL_QL
|
||||
#ifndef CYASSL_SEP
|
||||
#define CYASSL_SEP
|
||||
#endif
|
||||
#ifndef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
#endif
|
||||
#ifndef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
#endif
|
||||
#ifndef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#endif
|
||||
#ifndef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
#endif
|
||||
#ifndef CYASSL_DER_LOAD
|
||||
#define CYASSL_DER_LOAD
|
||||
#endif
|
||||
#ifndef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
#ifndef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
#ifndef SESSION_INDEX
|
||||
#define SESSION_INDEX
|
||||
#endif
|
||||
#endif /* CYASSL_QL */
|
||||
|
||||
|
||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
||||
#define USE_CYASSL_MEMORY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
|
||||
|
||||
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
||||
#ifndef XSTREAM_ALIGNMENT
|
||||
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
||||
#define NO_XSTREAM_ALIGNMENT
|
||||
#else
|
||||
#define XSTREAM_ALIGNMENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef CYASSL_GENERAL_ALIGNMENT
|
||||
#ifdef CYASSL_AESNI
|
||||
#define CYASSL_GENERAL_ALIGNMENT 16
|
||||
#elif defined(XSTREAM_ALIGNMENT)
|
||||
#define CYASSL_GENERAL_ALIGNMENT 4
|
||||
#else
|
||||
#define CYASSL_GENERAL_ALIGNMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL
|
||||
/* not widely supported yet */
|
||||
#undef NO_SKID
|
||||
#define NO_SKID
|
||||
#endif
|
||||
|
||||
/* Place any other flags or defines here */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_SETTINGS_H */
|
||||
|
||||
31
IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h
Normal file
31
IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -19,24 +19,32 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/visibility.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
||||
#include "stm32f2xx_hal.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_fs.h"
|
||||
#include "rl_net.h"
|
||||
#include <stdio.h>
|
||||
#include "cyassl_MDK_ARM.h"
|
||||
#include <cyassl/ssl.h>
|
||||
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize a Flash Memory Card
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
#include "rl_fs.h"
|
||||
static void init_filesystem (void) {
|
||||
int32_t retv;
|
||||
|
||||
@@ -54,18 +62,7 @@ static void init_filesystem (void) {
|
||||
printf ("Drive M0 initialization failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* TCP/IP tasks
|
||||
*----------------------------------------------------------------------------*/
|
||||
void tcp_poll (void const *arg)
|
||||
{
|
||||
CYASSL_MSG("TCP polling started.\n") ;
|
||||
while (1) {
|
||||
net_main ();
|
||||
osDelay(1) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
@@ -73,30 +70,31 @@ typedef struct func_args {
|
||||
} func_args;
|
||||
|
||||
extern void echoclient_test(func_args * args) ;
|
||||
extern void init_time(void) ;
|
||||
|
||||
osThreadDef (tcp_poll, osPriorityHigh , 1, 0) ;
|
||||
/*-----------------------------------------------------------------------------
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
int myoptind = 0;
|
||||
char* myoptarg = NULL;
|
||||
|
||||
#include "config-EchoClient.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
func_args args = { 0 } ;
|
||||
func_args args ;
|
||||
args.argc = 1 ;
|
||||
|
||||
SystemClock_Config ();
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
init_filesystem ();
|
||||
net_initialize() ;
|
||||
osThreadCreate (osThread (tcp_poll), NULL);
|
||||
osDelay(30000) ; /* wait for DHCP */
|
||||
#if defined(DEBUG_CYASSL)
|
||||
#endif
|
||||
netInitialize() ;
|
||||
osDelay(300) ;
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
printf("Turning ON Debug message\n") ;
|
||||
CyaSSL_Debugging_ON() ;
|
||||
wolfSSL_Debugging_ON() ;
|
||||
#endif
|
||||
|
||||
printf("Starting EchoClient, Enter messages to EchoServer (\"quit\" to quit the program)\n") ;
|
||||
echoclient_test(&args) ;
|
||||
printf("End of EchoClient\n") ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* time-dummy.c.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
struct tm *Cyassl_MDK_gmtime(const time_t *c)
|
||||
{
|
||||
static struct tm date ;
|
||||
return(&date) ;
|
||||
}
|
||||
|
||||
time_t time(time_t * t) { return 0 ; }
|
||||
@@ -471,6 +471,41 @@
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Network_DS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="0.10.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.01" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0"/>
|
||||
@@ -654,20 +689,20 @@
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoServer" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoServer" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
@@ -838,71 +873,69 @@
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="6.4.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-CyaSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-wolfSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-CyaSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-Licnese.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-wolfSSL.h">
|
||||
<instance index="0">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\wolfcrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.4." condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.4.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
<instance index="0" removed="1">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
</files>
|
||||
</RTE>
|
||||
|
||||
@@ -1,628 +0,0 @@
|
||||
/* settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
/* Place OS specific preprocessor flags, defines, includes here, will be
|
||||
included into every file because types.h includes it */
|
||||
|
||||
|
||||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
/* Uncomment next line if using ThreadX */
|
||||
/* #define THREADX */
|
||||
|
||||
/* Uncomment next line if using Micrium ucOS */
|
||||
/* #define MICRIUM */
|
||||
|
||||
/* Uncomment next line if using Mbed */
|
||||
/* #define MBED */
|
||||
|
||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||
/* #define MICROCHIP_PIC32 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
||||
/* #define MICROCHIP_TCPIP_V5 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
||||
/* #define MICROCHIP_TCPIP */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for a game console */
|
||||
/* #define CYASSL_GAME_BUILD */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for LSR */
|
||||
/* #define CYASSL_LSR */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define CYASSL_STM32F2 */
|
||||
|
||||
/* Uncomment next line if using Comverge settings */
|
||||
/* #define COMVERGE */
|
||||
|
||||
/* Uncomment next line if using QL SEP settings */
|
||||
/* #define CYASSL_QL */
|
||||
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
|
||||
#ifdef IPHONE
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMVERGE
|
||||
#define THREADX
|
||||
#define HAVE_NETX
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_SESSION_CACHE
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef THREADX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETX
|
||||
#include "nx_api.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_PIC32
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP_V5
|
||||
/* include timer functions */
|
||||
#include "TCPIP Stack/TCPIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP
|
||||
/* include timer, NTP functions */
|
||||
#include "system/system_services.h"
|
||||
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||
#include "tcpip/tcpip.h"
|
||||
#else
|
||||
#include "tcpip/sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MBED
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#endif /* MBED */
|
||||
|
||||
#ifdef CYASSL_TYTO
|
||||
#include "rand.h"
|
||||
#define FREERTOS
|
||||
#define NO_FILESYSTEM
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_DEV_RANDOM
|
||||
#define HAVE_ECC
|
||||
#define HAVE_ECC_ENCRYPT
|
||||
#define ECC_SHAMIR
|
||||
#define HAVE_HKDF
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FP_MAX_BITS 512
|
||||
#define NO_OLD_TLS
|
||||
#define NO_MD4
|
||||
#define NO_RABBIT
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_DSA
|
||||
#define NO_PWDBASED
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
||||
#include <stdlib.h>
|
||||
#define XMALLOC(s, h, type) malloc((s))
|
||||
#define XFREE(p, h, type) free((p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
||||
#undef XMALLOC
|
||||
#define XMALLOC yaXMALLOC
|
||||
#undef XFREE
|
||||
#define XFREE yaXFREE
|
||||
#undef XREALLOC
|
||||
#define XREALLOC yaXREALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifndef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
#ifndef NO_SHA512
|
||||
#define NO_SHA512
|
||||
#endif
|
||||
#ifndef NO_DH
|
||||
#define NO_DH
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
#define NO_DSA
|
||||
#endif
|
||||
#ifndef NO_HC128
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
|
||||
/* #define DEBUG_CYASSL */
|
||||
#define NO_CYASSL_DIR /* tbd */
|
||||
|
||||
#if (POLLOS)
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (RTPLATFORM)
|
||||
#if (!RTP_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#else
|
||||
#if (!KS_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (WINMSP3)
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
||||
#define XFREE(p, h, type) (rtp_free(p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
|
||||
#endif /* EBSNET */
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LSR
|
||||
#define HAVE_WEBSERVER
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define CYASSL_LOW_MEMORY
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#ifndef NO_FILESYSTEM
|
||||
#define LSR_FS
|
||||
#include "inc/hw_types.h"
|
||||
#include "fs.h"
|
||||
#endif
|
||||
#define CYASSL_LWIP
|
||||
#include <errno.h> /* for tcp errno */
|
||||
#define CYASSL_SAFERTOS
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
/* enum uses enum */
|
||||
#pragma diag_suppress=Pa089
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SAFERTOS
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "SafeRTOS/semphr.h"
|
||||
#endif
|
||||
|
||||
#include "SafeRTOS/heap.h"
|
||||
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||
#define XFREE(p, h, type) vPortFree((p))
|
||||
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LOW_MEMORY
|
||||
#undef RSA_LOW_MEM
|
||||
#define RSA_LOW_MEM
|
||||
#undef CYASSL_SMALL_STACK
|
||||
#define CYASSL_SMALL_STACK
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_CYASSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#define STM32F2_RNG
|
||||
#define STM32F2_CRYPTO
|
||||
#define KEIL_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifdef MICRIUM
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "net_cfg.h"
|
||||
#include "ssl_cfg.h"
|
||||
#include "net_secure_os.h"
|
||||
|
||||
#define CYASSL_TYPES
|
||||
|
||||
typedef CPU_INT08U byte;
|
||||
typedef CPU_INT16U word16;
|
||||
typedef CPU_INT32U word32;
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
|
||||
#define SIZEOF_LONG 4
|
||||
#undef SIZEOF_LONG_LONG
|
||||
#else
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#define STRING_USER
|
||||
|
||||
#define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
||||
#define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
||||
((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
||||
(CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
||||
((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
||||
(CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRSTR(pstr, pstr_srch) \
|
||||
((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
||||
(CPU_CHAR *)(pstr_srch)))
|
||||
#define XMEMSET(pmem, data_val, size) \
|
||||
((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
||||
(CPU_SIZE_T)(size)))
|
||||
#define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
||||
(void *)(psrc), (CPU_SIZE_T)(size)))
|
||||
#define XMEMCMP(pmem_1, pmem_2, size) \
|
||||
(((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
||||
(CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
||||
#define XMEMMOVE XMEMCPY
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
|
||||
#define MICRIUM_MALLOC
|
||||
#define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
|
||||
(CPU_SIZE_T)(s), (void *)0))
|
||||
#define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
|
||||
(p), (void *)0))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
|
||||
#undef NO_FILESYSTEM
|
||||
#else
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
|
||||
#define DEBUG_CYASSL
|
||||
#else
|
||||
#undef DEBUG_CYASSL
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
|
||||
#define OPENSSL_EXTRA
|
||||
#else
|
||||
#undef OPENSSL_EXTRA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
|
||||
#undef SINGLE_THREADED
|
||||
#else
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DH_EN == DEF_ENABLED)
|
||||
#undef NO_DH
|
||||
#else
|
||||
#define NO_DH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DSA_EN == DEF_ENABLED)
|
||||
#undef NO_DSA
|
||||
#else
|
||||
#define NO_DSA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_PSK_EN == DEF_ENABLED)
|
||||
#undef NO_PSK
|
||||
#else
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_3DES_EN == DEF_ENABLED)
|
||||
#undef NO_DES
|
||||
#else
|
||||
#define NO_DES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_AES_EN == DEF_ENABLED)
|
||||
#undef NO_AES
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RC4_EN == DEF_ENABLED)
|
||||
#undef NO_RC4
|
||||
#else
|
||||
#define NO_RC4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
|
||||
#undef NO_RABBIT
|
||||
#else
|
||||
#define NO_RABBIT
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_HC128_EN == DEF_ENABLED)
|
||||
#undef NO_HC128
|
||||
#else
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#else
|
||||
#undef BIG_ENDIAN_ORDER
|
||||
#define LITTLE_ENDIAN_ORDER
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MD4_EN == DEF_ENABLED)
|
||||
#undef NO_MD4
|
||||
#else
|
||||
#define NO_MD4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
|
||||
#undef NO_WRITEV
|
||||
#else
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
|
||||
#define NO_DEV_RANDOM
|
||||
#else
|
||||
#undef NO_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
|
||||
#define CYASSL_USER_IO
|
||||
#else
|
||||
#undef CYASSL_USER_IO
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
|
||||
#undef LARGE_STATIC_BUFFERS
|
||||
#undef STATIC_CHUNKS_ONLY
|
||||
#else
|
||||
#define LARGE_STATIC_BUFFERS
|
||||
#define STATIC_CHUNKS_ONLY
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
|
||||
#define CYASSL_DER_LOAD
|
||||
#else
|
||||
#undef CYASSL_DER_LOAD
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DTLS_EN == DEF_ENABLED)
|
||||
#define CYASSL_DTLS
|
||||
#else
|
||||
#undef CYASSL_DTLS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
|
||||
#define CYASSL_CALLBACKS
|
||||
#else
|
||||
#undef CYASSL_CALLBACKS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
|
||||
#define USE_FAST_MATH
|
||||
#else
|
||||
#undef USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#else
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#endif /* MICRIUM */
|
||||
|
||||
|
||||
#ifdef CYASSL_QL
|
||||
#ifndef CYASSL_SEP
|
||||
#define CYASSL_SEP
|
||||
#endif
|
||||
#ifndef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
#endif
|
||||
#ifndef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
#endif
|
||||
#ifndef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#endif
|
||||
#ifndef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
#endif
|
||||
#ifndef CYASSL_DER_LOAD
|
||||
#define CYASSL_DER_LOAD
|
||||
#endif
|
||||
#ifndef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
#ifndef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
#ifndef SESSION_INDEX
|
||||
#define SESSION_INDEX
|
||||
#endif
|
||||
#endif /* CYASSL_QL */
|
||||
|
||||
|
||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
||||
#define USE_CYASSL_MEMORY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
|
||||
|
||||
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
||||
#ifndef XSTREAM_ALIGNMENT
|
||||
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
||||
#define NO_XSTREAM_ALIGNMENT
|
||||
#else
|
||||
#define XSTREAM_ALIGNMENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef CYASSL_GENERAL_ALIGNMENT
|
||||
#ifdef CYASSL_AESNI
|
||||
#define CYASSL_GENERAL_ALIGNMENT 16
|
||||
#elif defined(XSTREAM_ALIGNMENT)
|
||||
#define CYASSL_GENERAL_ALIGNMENT 4
|
||||
#else
|
||||
#define CYASSL_GENERAL_ALIGNMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL
|
||||
/* not widely supported yet */
|
||||
#undef NO_SKID
|
||||
#define NO_SKID
|
||||
#endif
|
||||
|
||||
/* Place any other flags or defines here */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_SETTINGS_H */
|
||||
|
||||
31
IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h
Normal file
31
IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -19,24 +19,32 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/visibility.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
||||
#include "stm32f2xx_hal.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_fs.h"
|
||||
#include "rl_net.h"
|
||||
#include <stdio.h>
|
||||
#include "cyassl_MDK_ARM.h"
|
||||
#include <cyassl/ssl.h>
|
||||
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize a Flash Memory Card
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
#include "rl_fs.h"
|
||||
static void init_filesystem (void) {
|
||||
int32_t retv;
|
||||
|
||||
@@ -49,22 +57,17 @@ static void init_filesystem (void) {
|
||||
else {
|
||||
printf ("Drive M0 mount failed!\n");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
printf ("Drive M0 initialization failed!\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* TCP/IP tasks
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
void tcp_poll (void const *arg)
|
||||
{
|
||||
CYASSL_MSG("TCP polling started.\n") ;
|
||||
while (1) {
|
||||
net_main ();
|
||||
osDelay(1) ;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
@@ -72,27 +75,22 @@ typedef struct func_args {
|
||||
} func_args;
|
||||
|
||||
extern void echoserver_test(func_args * args) ;
|
||||
extern void init_time(void) ;
|
||||
|
||||
osThreadDef (tcp_poll, osPriorityHigh, 1, 0) ;
|
||||
/*-----------------------------------------------------------------------------
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
int myoptind = 0;
|
||||
char* myoptarg = NULL;
|
||||
|
||||
int main()
|
||||
{
|
||||
func_args args = { 0 } ;
|
||||
init_filesystem ();
|
||||
net_initialize() ;
|
||||
osThreadCreate (osThread (tcp_poll), NULL);
|
||||
osDelay(10000) ; /* wait for DHCP */
|
||||
#if defined(DEBUG_CYASSL)
|
||||
printf("Turning ON Debug message\n") ;
|
||||
CyaSSL_Debugging_ON() ;
|
||||
#endif
|
||||
func_args args ;
|
||||
args.argc = 1 ;
|
||||
|
||||
SystemClock_Config ();
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
init_filesystem ();
|
||||
#endif
|
||||
netInitialize() ;
|
||||
osDelay(300) ;
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
printf("Turning ON Debug message\n") ;
|
||||
wolfSSL_Debugging_ON() ;
|
||||
#endif
|
||||
printf("echoserver: Started\n") ;
|
||||
echoserver_test(&args) ;
|
||||
printf("echoserver: Terminated\n") ;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* time-dummy.c.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
struct tm *Cyassl_MDK_gmtime(const time_t *c)
|
||||
{
|
||||
static struct tm date ;
|
||||
return(&date) ;
|
||||
}
|
||||
|
||||
time_t time(time_t * t) { return 0 ; }
|
||||
@@ -1,668 +0,0 @@
|
||||
/* settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
/* Place OS specific preprocessor flags, defines, includes here, will be
|
||||
included into every file because types.h includes it */
|
||||
|
||||
|
||||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
/* Uncomment next line if using ThreadX */
|
||||
/* #define THREADX */
|
||||
|
||||
/* Uncomment next line if using Micrium ucOS */
|
||||
/* #define MICRIUM */
|
||||
|
||||
/* Uncomment next line if using Mbed */
|
||||
/* #define MBED */
|
||||
|
||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||
/* #define MICROCHIP_PIC32 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
||||
/* #define MICROCHIP_TCPIP_V5 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
||||
/* #define MICROCHIP_TCPIP */
|
||||
|
||||
/* Uncomment next line if using PIC32MZ Crypto Engine */
|
||||
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for a game console */
|
||||
/* #define CYASSL_GAME_BUILD */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for LSR */
|
||||
/* #define CYASSL_LSR */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define CYASSL_STM32F2 */
|
||||
|
||||
/* Uncomment next line if using Comverge settings */
|
||||
/* #define COMVERGE */
|
||||
|
||||
/* Uncomment next line if using QL SEP settings */
|
||||
/* #define CYASSL_QL */
|
||||
|
||||
/* Uncomment next line if using LwIP native TCP socket settings */
|
||||
/* #define HAVE_LWIP_NATIVE */
|
||||
|
||||
/* Uncomment next line if building for EROAD */
|
||||
/* #define CYASSL_EROAD */
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
|
||||
#ifdef IPHONE
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_USER_SETTINGS
|
||||
#include <user_settings.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMVERGE
|
||||
#define THREADX
|
||||
#define HAVE_NETX
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_SESSION_CACHE
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef THREADX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETX
|
||||
#include "nx_api.h"
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */
|
||||
#define CYASSL_LWIP
|
||||
#define NO_WRITEV
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_PIC32
|
||||
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_MICROCHIP_PIC32MZ
|
||||
#define CYASSL_PIC32MZ_CE
|
||||
#define CYASSL_PIC32MZ_CRYPT
|
||||
#define HAVE_AES_ENGINE
|
||||
#define CYASSL_PIC32MZ_RNG
|
||||
/* #define CYASSL_PIC32MZ_HASH */
|
||||
#define CYASSL_AES_COUNTER
|
||||
#define HAVE_AESGCM
|
||||
#define NO_BIG_INT
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP_V5
|
||||
/* include timer functions */
|
||||
#include "TCPIP Stack/TCPIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP
|
||||
/* include timer, NTP functions */
|
||||
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||
#include "tcpip/tcpip.h"
|
||||
#else
|
||||
#include "system/system_services.h"
|
||||
#include "tcpip/sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MBED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_CERT
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define HAVE_ECC
|
||||
#define NO_SESSION_CACHE
|
||||
#define CYASSL_CMSIS_RTOS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CYASSL_EROAD
|
||||
#define FREESCALE_MQX
|
||||
#define FREESCALE_MMCAU
|
||||
#define SINGLE_THREADED
|
||||
#define NO_STDIO_FILESYSTEM
|
||||
#define CYASSL_LEANPSK
|
||||
#define HAVE_NULL_CIPHER
|
||||
#define NO_OLD_TLS
|
||||
#define NO_ASN
|
||||
#define NO_BIG_INT
|
||||
#define NO_RSA
|
||||
#define NO_DSA
|
||||
#define NO_DH
|
||||
#define NO_CERTS
|
||||
#define NO_PWDBASED
|
||||
#define NO_DES3
|
||||
#define NO_MD4
|
||||
#define NO_RC4
|
||||
#define NO_MD5
|
||||
#define NO_SESSION_CACHE
|
||||
#define NO_MAIN_DRIVER
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET) && !defined(CYASSL_EROAD)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
||||
#include <stdlib.h>
|
||||
#define XMALLOC(s, h, type) malloc((s))
|
||||
#define XFREE(p, h, type) free((p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
||||
#undef XMALLOC
|
||||
#define XMALLOC yaXMALLOC
|
||||
#undef XFREE
|
||||
#define XFREE yaXFREE
|
||||
#undef XREALLOC
|
||||
#define XREALLOC yaXREALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifndef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
#ifndef NO_SHA512
|
||||
#define NO_SHA512
|
||||
#endif
|
||||
#ifndef NO_DH
|
||||
#define NO_DH
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
#define NO_DSA
|
||||
#endif
|
||||
#ifndef NO_HC128
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
|
||||
/* #define DEBUG_CYASSL */
|
||||
#define NO_CYASSL_DIR /* tbd */
|
||||
|
||||
#if (POLLOS)
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (RTPLATFORM)
|
||||
#if (!RTP_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#else
|
||||
#if (!KS_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (WINMSP3)
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
||||
#define XFREE(p, h, type) (rtp_free(p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
|
||||
#endif /* EBSNET */
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LSR
|
||||
#define HAVE_WEBSERVER
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define CYASSL_LOW_MEMORY
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#ifndef NO_FILESYSTEM
|
||||
#define LSR_FS
|
||||
#include "inc/hw_types.h"
|
||||
#include "fs.h"
|
||||
#endif
|
||||
#define CYASSL_LWIP
|
||||
#include <errno.h> /* for tcp errno */
|
||||
#define CYASSL_SAFERTOS
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
/* enum uses enum */
|
||||
#pragma diag_suppress=Pa089
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SAFERTOS
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "SafeRTOS/semphr.h"
|
||||
#endif
|
||||
|
||||
#include "SafeRTOS/heap.h"
|
||||
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||
#define XFREE(p, h, type) vPortFree((p))
|
||||
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LOW_MEMORY
|
||||
#undef RSA_LOW_MEM
|
||||
#define RSA_LOW_MEM
|
||||
#undef CYASSL_SMALL_STACK
|
||||
#define CYASSL_SMALL_STACK
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_CYASSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#define STM32F2_RNG
|
||||
#define STM32F2_CRYPTO
|
||||
#define KEIL_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifdef MICRIUM
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "net_cfg.h"
|
||||
#include "ssl_cfg.h"
|
||||
#include "net_secure_os.h"
|
||||
|
||||
#define CYASSL_TYPES
|
||||
|
||||
typedef CPU_INT08U byte;
|
||||
typedef CPU_INT16U word16;
|
||||
typedef CPU_INT32U word32;
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
|
||||
#define SIZEOF_LONG 4
|
||||
#undef SIZEOF_LONG_LONG
|
||||
#else
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#define STRING_USER
|
||||
|
||||
#define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
||||
#define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
||||
((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
||||
(CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
||||
((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
||||
(CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRSTR(pstr, pstr_srch) \
|
||||
((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
||||
(CPU_CHAR *)(pstr_srch)))
|
||||
#define XMEMSET(pmem, data_val, size) \
|
||||
((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
||||
(CPU_SIZE_T)(size)))
|
||||
#define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
||||
(void *)(psrc), (CPU_SIZE_T)(size)))
|
||||
#define XMEMCMP(pmem_1, pmem_2, size) \
|
||||
(((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
||||
(CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
||||
#define XMEMMOVE XMEMCPY
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
|
||||
#define MICRIUM_MALLOC
|
||||
#define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
|
||||
(CPU_SIZE_T)(s), (void *)0))
|
||||
#define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
|
||||
(p), (void *)0))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
|
||||
#undef NO_FILESYSTEM
|
||||
#else
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
|
||||
#define DEBUG_CYASSL
|
||||
#else
|
||||
#undef DEBUG_CYASSL
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
|
||||
#define OPENSSL_EXTRA
|
||||
#else
|
||||
#undef OPENSSL_EXTRA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
|
||||
#undef SINGLE_THREADED
|
||||
#else
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DH_EN == DEF_ENABLED)
|
||||
#undef NO_DH
|
||||
#else
|
||||
#define NO_DH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DSA_EN == DEF_ENABLED)
|
||||
#undef NO_DSA
|
||||
#else
|
||||
#define NO_DSA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_PSK_EN == DEF_ENABLED)
|
||||
#undef NO_PSK
|
||||
#else
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_3DES_EN == DEF_ENABLED)
|
||||
#undef NO_DES
|
||||
#else
|
||||
#define NO_DES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_AES_EN == DEF_ENABLED)
|
||||
#undef NO_AES
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RC4_EN == DEF_ENABLED)
|
||||
#undef NO_RC4
|
||||
#else
|
||||
#define NO_RC4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
|
||||
#undef NO_RABBIT
|
||||
#else
|
||||
#define NO_RABBIT
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_HC128_EN == DEF_ENABLED)
|
||||
#undef NO_HC128
|
||||
#else
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#else
|
||||
#undef BIG_ENDIAN_ORDER
|
||||
#define LITTLE_ENDIAN_ORDER
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MD4_EN == DEF_ENABLED)
|
||||
#undef NO_MD4
|
||||
#else
|
||||
#define NO_MD4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
|
||||
#undef NO_WRITEV
|
||||
#else
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
|
||||
#define NO_DEV_RANDOM
|
||||
#else
|
||||
#undef NO_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
|
||||
#define CYASSL_USER_IO
|
||||
#else
|
||||
#undef CYASSL_USER_IO
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
|
||||
#undef LARGE_STATIC_BUFFERS
|
||||
#undef STATIC_CHUNKS_ONLY
|
||||
#else
|
||||
#define LARGE_STATIC_BUFFERS
|
||||
#define STATIC_CHUNKS_ONLY
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
|
||||
#define CYASSL_DER_LOAD
|
||||
#else
|
||||
#undef CYASSL_DER_LOAD
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DTLS_EN == DEF_ENABLED)
|
||||
#define CYASSL_DTLS
|
||||
#else
|
||||
#undef CYASSL_DTLS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
|
||||
#define CYASSL_CALLBACKS
|
||||
#else
|
||||
#undef CYASSL_CALLBACKS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
|
||||
#define USE_FAST_MATH
|
||||
#else
|
||||
#undef USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#else
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#endif /* MICRIUM */
|
||||
|
||||
|
||||
#ifdef CYASSL_QL
|
||||
#ifndef CYASSL_SEP
|
||||
#define CYASSL_SEP
|
||||
#endif
|
||||
#ifndef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
#endif
|
||||
#ifndef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
#endif
|
||||
#ifndef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#endif
|
||||
#ifndef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
#endif
|
||||
#ifndef CYASSL_DER_LOAD
|
||||
#define CYASSL_DER_LOAD
|
||||
#endif
|
||||
#ifndef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
#ifndef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
#ifndef SESSION_INDEX
|
||||
#define SESSION_INDEX
|
||||
#endif
|
||||
#endif /* CYASSL_QL */
|
||||
|
||||
|
||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
||||
#define USE_CYASSL_MEMORY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
|
||||
|
||||
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
||||
#ifndef XSTREAM_ALIGNMENT
|
||||
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
||||
#define NO_XSTREAM_ALIGNMENT
|
||||
#else
|
||||
#define XSTREAM_ALIGNMENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef CYASSL_GENERAL_ALIGNMENT
|
||||
#ifdef CYASSL_AESNI
|
||||
#define CYASSL_GENERAL_ALIGNMENT 16
|
||||
#elif defined(XSTREAM_ALIGNMENT)
|
||||
#define CYASSL_GENERAL_ALIGNMENT 4
|
||||
#else
|
||||
#define CYASSL_GENERAL_ALIGNMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL
|
||||
/* not widely supported yet */
|
||||
#undef NO_SKID
|
||||
#define NO_SKID
|
||||
#endif
|
||||
|
||||
/* Place any other flags or defines here */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_SETTINGS_H */
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -19,52 +19,33 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**** CyaSSL for KEIL-RL Configuration ****/
|
||||
|
||||
#define __CORTEX_M3__
|
||||
#define CYASSL_MDK_ARM
|
||||
#define NO_WRITEV
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_MAIN_DRIVER
|
||||
|
||||
|
||||
#define CYASSL_DER_LOAD
|
||||
#define HAVE_NULL_CIPHER
|
||||
|
||||
#define HAVE_KEIL_RTX
|
||||
#define CYASSL_CMSIS_RTOS
|
||||
#define CYASSL_KEIL_TCP_NET
|
||||
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
// <h> Build Target: Simple Client
|
||||
// <s.15>Callee IP Address
|
||||
// <i> Default: "192.168.1.100"
|
||||
#define CYASSL_CALLEE_IP "192.168.11.3"
|
||||
#define WOLFSSL_CALLEE_IP "192.168.10.8"
|
||||
// <s.15>Callee Port Number
|
||||
// <i> Default: "443"
|
||||
#define CYASSL_CALLEE_PORT "443"
|
||||
#define WOLFSSL_CALLEE_PORT "11111"
|
||||
// <o>HTTP GET Option <0=> HTTP Get <1=> SSL/TLS Message
|
||||
#define MDK_CONF_HTTP_GET 0
|
||||
#if MDK_CONF_HTTP_GET == 0
|
||||
#define CYASSL_HTTP_GET "-g"
|
||||
#define CYASSL_HTTP_GET_COUNT 1
|
||||
#define WOLFSSL_HTTP_GET "-g"
|
||||
#define WOLFSSL_HTTP_GET_COUNT 1
|
||||
#elif MDK_CONF_HTTP_GET == 1
|
||||
#define CYASSL_HTTP_GET ""
|
||||
#define CYASSL_HTTP_GET_COUNT 0
|
||||
#define WOLFSSL_HTTP_GET ""
|
||||
#define WOLFSSL_HTTP_GET_COUNT 0
|
||||
#endif
|
||||
// <o>SSL/TLS Version <0=> SSL3 <1=> TLS 1.0 <2=> TLS 1.1 <3=> TLS 1.2
|
||||
#define MDK_CONF_SSL_VERSION 3
|
||||
#if MDK_CONF_SSL_VERSION == 0
|
||||
#define CYASSL_SSL_VER "0"
|
||||
#define WOLFSSL_SSL_VER "0"
|
||||
#elif MDK_CONF_SSL_VERSION == 1
|
||||
#define CYASSL_SSL_VER "1"
|
||||
#define WOLFSSL_SSL_VER "1"
|
||||
#elif MDK_CONF_SSL_VERSION == 2
|
||||
#define CYASSL_SSL_VER "2"
|
||||
#define WOLFSSL_SSL_VER "2"
|
||||
#elif MDK_CONF_SSL_VERSION == 3
|
||||
#define CYASSL_SSL_VER "3"
|
||||
#define WOLFSSL_SSL_VER "3"
|
||||
#endif
|
||||
|
||||
// </h>
|
||||
|
||||
@@ -19,24 +19,32 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/visibility.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
||||
#include "stm32f2xx_hal.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_fs.h"
|
||||
#include "rl_net.h"
|
||||
#include <stdio.h>
|
||||
#include "cyassl_MDK_ARM.h"
|
||||
#include <cyassl/ssl.h>
|
||||
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize a Flash Memory Card
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
#include "rl_fs.h"
|
||||
static void init_filesystem (void) {
|
||||
int32_t retv;
|
||||
|
||||
@@ -49,22 +57,12 @@ static void init_filesystem (void) {
|
||||
else {
|
||||
printf ("Drive M0 mount failed!\n");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
printf ("Drive M0 initialization failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* TCP/IP tasks
|
||||
*----------------------------------------------------------------------------*/
|
||||
void tcp_poll (void const *arg)
|
||||
{
|
||||
CYASSL_MSG("TCP polling started.\n") ;
|
||||
while (1) {
|
||||
net_main ();
|
||||
osDelay(100) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
@@ -73,30 +71,27 @@ typedef struct func_args {
|
||||
|
||||
extern void client_test(func_args * args) ;
|
||||
|
||||
osThreadDef (tcp_poll, osPriorityHigh , 1, 0) ;
|
||||
/*-----------------------------------------------------------------------------
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "config-SimpleClient.h"
|
||||
int myoptind = 0;
|
||||
char* myoptarg = NULL;
|
||||
|
||||
#include "config-SimpleClient.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
static char *argv[] =
|
||||
{ "client", "-h", CYASSL_CALLEE_IP, "-p", CYASSL_CALLEE_PORT,
|
||||
"-v", CYASSL_SSL_VER, CYASSL_HTTP_GET } ;
|
||||
{ "client", "-h", WOLFSSL_CALLEE_IP, "-p", WOLFSSL_CALLEE_PORT,
|
||||
"-v", WOLFSSL_SSL_VER, WOLFSSL_HTTP_GET } ;
|
||||
static func_args args =
|
||||
{ 7 + CYASSL_HTTP_GET_COUNT, argv } ;
|
||||
{ 7 + WOLFSSL_HTTP_GET_COUNT, argv } ;
|
||||
|
||||
SystemClock_Config ();
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
init_filesystem ();
|
||||
net_initialize() ;
|
||||
osThreadCreate (osThread (tcp_poll), NULL);
|
||||
osDelay(50000) ; /* wait for DHCP */
|
||||
#if defined(DEBUG_CYASSL)
|
||||
#endif
|
||||
netInitialize() ;
|
||||
osDelay(300) ;
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
printf("Turning ON Debug message\n") ;
|
||||
CyaSSL_Debugging_ON() ;
|
||||
wolfSSL_Debugging_ON() ;
|
||||
#endif
|
||||
|
||||
if(args.argc == 7)
|
||||
|
||||
@@ -481,6 +481,41 @@
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Network_DS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="0.10.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.01" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0"/>
|
||||
@@ -664,20 +699,20 @@
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleClient" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleClient" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
@@ -848,68 +883,68 @@
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="6.4.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-CyaSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-wolfSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-CyaSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\wolfSSL-Licnese.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-wolfSSL.h">
|
||||
<instance index="0">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\wolfcrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.4." condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.4.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
/* time-STM32F2.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
#define PERIPH_BASE ((uint32_t)0x40000000)
|
||||
/*-----------------------------------------------------------------------------
|
||||
* initialize RTC
|
||||
*----------------------------------------------------------------------------*/
|
||||
#include "stm32f2xx.h"
|
||||
|
||||
#define assert_param(a)
|
||||
|
||||
#if 0
|
||||
#define RTC_RSF_MASK ((uint32_t)0xFFFFFF5F)
|
||||
#define SYNCHRO_TIMEOUT ((uint32_t) 0x00008000)
|
||||
#define Bcd2ToByte(v) \
|
||||
((((uint8_t)(v & (uint8_t)0xF0) >> (uint8_t)0x4) * 10) + (v & (uint8_t)0x0F))
|
||||
#define RTC_TR_RESERVED_MASK ((uint32_t)0x007F7F7F)
|
||||
#define RTC_TR_MNT ((uint32_t)0x00007000)
|
||||
#define RTC_TR_MNU ((uint32_t)0x00000F00)
|
||||
|
||||
#define PWR_OFFSET (PWR_BASE - PERIPH_BASE)
|
||||
#define CR_OFFSET (PWR_OFFSET + 0x00)
|
||||
#define DBP_BitNumber 0x08
|
||||
#define CR_DBP_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (DBP_BitNumber * 4))
|
||||
#define RTC_INIT_MASK ((uint32_t)0xFFFFFFFF)
|
||||
#define INITMODE_TIMEOUT ((uint32_t) 0x00010000)
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* initialize TIM
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define RCC_APB1Periph_TIM2 ((uint32_t)0x00000001)
|
||||
|
||||
void init_time(void)
|
||||
{
|
||||
uint16_t tmpcr1 = 0;
|
||||
|
||||
((uint32_t *)RCC)[0x10] |= RCC_APB1Periph_TIM2 ;
|
||||
|
||||
tmpcr1 = TIM2->CR1 ;
|
||||
tmpcr1 &= (uint16_t) (~(((uint16_t)0x0010) | ((uint16_t)0x0060) ));
|
||||
/* CR1 &= ~(TIM_CR1_DIR | TIM_CR1_CMS) */
|
||||
tmpcr1 |= (uint16_t)0x0000 ; /* CR1 |= TIM_CounterMode_Up */
|
||||
TIM2->CR1= tmpcr1 ;
|
||||
|
||||
TIM2->ARR = 0xffffffff ; /* ARR= TIM_Period */
|
||||
TIM2->PSC = 60 ; /* PSC = TIM_Prescaler */
|
||||
TIM2->EGR = ((uint16_t)0x0001) ; /* EGR = TIM_PSCReloadMode_Immediate */
|
||||
|
||||
*(uint16_t *)(PERIPH_BASE+0x0) |=((uint16_t)0x0001) ;
|
||||
/* TIM_Cmd(TIM2, ENABLE) ; */
|
||||
}
|
||||
|
||||
double current_time()
|
||||
{
|
||||
return ((double)TIM2->CNT/1000000.0) ;
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* time-dummy.c.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
struct tm *Cyassl_MDK_gmtime(const time_t *c)
|
||||
{
|
||||
static struct tm date ;
|
||||
return(&date) ;
|
||||
}
|
||||
|
||||
time_t time(time_t * t) { return 0 ; }
|
||||
@@ -1,628 +0,0 @@
|
||||
/* settings.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
/* Place OS specific preprocessor flags, defines, includes here, will be
|
||||
included into every file because types.h includes it */
|
||||
|
||||
|
||||
#ifndef CTAO_CRYPT_SETTINGS_H
|
||||
#define CTAO_CRYPT_SETTINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Uncomment next line if using IPHONE */
|
||||
/* #define IPHONE */
|
||||
|
||||
/* Uncomment next line if using ThreadX */
|
||||
/* #define THREADX */
|
||||
|
||||
/* Uncomment next line if using Micrium ucOS */
|
||||
/* #define MICRIUM */
|
||||
|
||||
/* Uncomment next line if using Mbed */
|
||||
/* #define MBED */
|
||||
|
||||
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
||||
/* #define MICROCHIP_PIC32 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 5 */
|
||||
/* #define MICROCHIP_TCPIP_V5 */
|
||||
|
||||
/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */
|
||||
/* #define MICROCHIP_TCPIP */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS */
|
||||
/* #define FREERTOS */
|
||||
|
||||
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
||||
/* #define FREERTOS_WINSIM */
|
||||
|
||||
/* Uncomment next line if using RTIP */
|
||||
/* #define EBSNET */
|
||||
|
||||
/* Uncomment next line if using lwip */
|
||||
/* #define CYASSL_LWIP */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for a game console */
|
||||
/* #define CYASSL_GAME_BUILD */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for LSR */
|
||||
/* #define CYASSL_LSR */
|
||||
|
||||
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
||||
/* #define FREESCALE_MQX */
|
||||
|
||||
/* Uncomment next line if using STM32F2 */
|
||||
/* #define CYASSL_STM32F2 */
|
||||
|
||||
/* Uncomment next line if using Comverge settings */
|
||||
/* #define COMVERGE */
|
||||
|
||||
/* Uncomment next line if using QL SEP settings */
|
||||
/* #define CYASSL_QL */
|
||||
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
|
||||
#ifdef IPHONE
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef COMVERGE
|
||||
#define THREADX
|
||||
#define HAVE_NETX
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_SESSION_CACHE
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef THREADX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_NETX
|
||||
#include "nx_api.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_PIC32
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_FILESYSTEM
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP_V5
|
||||
/* include timer functions */
|
||||
#include "TCPIP Stack/TCPIP.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROCHIP_TCPIP
|
||||
/* include timer, NTP functions */
|
||||
#include "system/system_services.h"
|
||||
#ifdef MICROCHIP_MPLAB_HARMONY
|
||||
#include "tcpip/tcpip.h"
|
||||
#else
|
||||
#include "tcpip/sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MBED
|
||||
#define SINGLE_THREADED
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#endif /* MBED */
|
||||
|
||||
#ifdef CYASSL_TYTO
|
||||
#include "rand.h"
|
||||
#define FREERTOS
|
||||
#define NO_FILESYSTEM
|
||||
#define CYASSL_USER_IO
|
||||
#define NO_DEV_RANDOM
|
||||
#define HAVE_ECC
|
||||
#define HAVE_ECC_ENCRYPT
|
||||
#define ECC_SHAMIR
|
||||
#define HAVE_HKDF
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FP_MAX_BITS 512
|
||||
#define NO_OLD_TLS
|
||||
#define NO_MD4
|
||||
#define NO_RABBIT
|
||||
#define NO_HC128
|
||||
#define NO_RSA
|
||||
#define NO_DSA
|
||||
#define NO_PWDBASED
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#ifdef FREERTOS_WINSIM
|
||||
#define FREERTOS
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
||||
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
||||
&& !defined(EBSNET)
|
||||
#define USE_WINDOWS_API
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
||||
#include <stdlib.h>
|
||||
#define XMALLOC(s, h, type) malloc((s))
|
||||
#define XFREE(p, h, type) free((p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
||||
#undef XMALLOC
|
||||
#define XMALLOC yaXMALLOC
|
||||
#undef XFREE
|
||||
#define XFREE yaXFREE
|
||||
#undef XREALLOC
|
||||
#define XREALLOC yaXREALLOC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FREERTOS
|
||||
#ifndef NO_WRITEV
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
#ifndef NO_SHA512
|
||||
#define NO_SHA512
|
||||
#endif
|
||||
#ifndef NO_DH
|
||||
#define NO_DH
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
#define NO_DSA
|
||||
#endif
|
||||
#ifndef NO_HC128
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EBSNET
|
||||
#include "rtip.h"
|
||||
|
||||
/* #define DEBUG_CYASSL */
|
||||
#define NO_CYASSL_DIR /* tbd */
|
||||
|
||||
#if (POLLOS)
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (RTPLATFORM)
|
||||
#if (!RTP_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#else
|
||||
#if (!KS_LITTLE_ENDIAN)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (WINMSP3)
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#else
|
||||
#sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC))
|
||||
#define XFREE(p, h, type) (rtp_free(p))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
|
||||
#endif /* EBSNET */
|
||||
|
||||
#ifdef CYASSL_GAME_BUILD
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#if defined(__PPU) || defined(__XENON)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LSR
|
||||
#define HAVE_WEBSERVER
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define CYASSL_LOW_MEMORY
|
||||
#define NO_WRITEV
|
||||
#define NO_SHA512
|
||||
#define NO_DH
|
||||
#define NO_DSA
|
||||
#define NO_HC128
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#ifndef NO_FILESYSTEM
|
||||
#define LSR_FS
|
||||
#include "inc/hw_types.h"
|
||||
#include "fs.h"
|
||||
#endif
|
||||
#define CYASSL_LWIP
|
||||
#include <errno.h> /* for tcp errno */
|
||||
#define CYASSL_SAFERTOS
|
||||
#if defined(__IAR_SYSTEMS_ICC__)
|
||||
/* enum uses enum */
|
||||
#pragma diag_suppress=Pa089
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SAFERTOS
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "SafeRTOS/semphr.h"
|
||||
#endif
|
||||
|
||||
#include "SafeRTOS/heap.h"
|
||||
#define XMALLOC(s, h, type) pvPortMalloc((s))
|
||||
#define XFREE(p, h, type) vPortFree((p))
|
||||
#define XREALLOC(p, n, h, t) pvPortRealloc((p), (n))
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_LOW_MEMORY
|
||||
#undef RSA_LOW_MEM
|
||||
#define RSA_LOW_MEM
|
||||
#undef CYASSL_SMALL_STACK
|
||||
#define CYASSL_SMALL_STACK
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_MQX
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_RABBIT
|
||||
#define NO_CYASSL_DIR
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define FREESCALE_K70_RNGA
|
||||
/* #define FREESCALE_K53_RNGB */
|
||||
#include "mqx.h"
|
||||
#ifndef NO_FILESYSTEM
|
||||
#include "mfs.h"
|
||||
#include "fio.h"
|
||||
#endif
|
||||
#ifndef SINGLE_THREADED
|
||||
#include "mutex.h"
|
||||
#endif
|
||||
|
||||
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
||||
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
||||
/* Note: MQX has no realloc, using fastmath above */
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_STM32F2
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_CYASSL_DIR
|
||||
#define NO_RABBIT
|
||||
#define STM32F2_RNG
|
||||
#define STM32F2_CRYPTO
|
||||
#define KEIL_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifdef MICRIUM
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "net_cfg.h"
|
||||
#include "ssl_cfg.h"
|
||||
#include "net_secure_os.h"
|
||||
|
||||
#define CYASSL_TYPES
|
||||
|
||||
typedef CPU_INT08U byte;
|
||||
typedef CPU_INT16U word16;
|
||||
typedef CPU_INT32U word32;
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32)
|
||||
#define SIZEOF_LONG 4
|
||||
#undef SIZEOF_LONG_LONG
|
||||
#else
|
||||
#undef SIZEOF_LONG
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
#endif
|
||||
|
||||
#define STRING_USER
|
||||
|
||||
#define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr)))
|
||||
#define XSTRNCPY(pstr_dest, pstr_src, len_max) \
|
||||
((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \
|
||||
(CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRNCMP(pstr_1, pstr_2, len_max) \
|
||||
((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \
|
||||
(CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max)))
|
||||
#define XSTRSTR(pstr, pstr_srch) \
|
||||
((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \
|
||||
(CPU_CHAR *)(pstr_srch)))
|
||||
#define XMEMSET(pmem, data_val, size) \
|
||||
((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \
|
||||
(CPU_SIZE_T)(size)))
|
||||
#define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \
|
||||
(void *)(psrc), (CPU_SIZE_T)(size)))
|
||||
#define XMEMCMP(pmem_1, pmem_2, size) \
|
||||
(((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \
|
||||
(CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES)
|
||||
#define XMEMMOVE XMEMCPY
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
|
||||
#define MICRIUM_MALLOC
|
||||
#define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \
|
||||
(CPU_SIZE_T)(s), (void *)0))
|
||||
#define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \
|
||||
(p), (void *)0))
|
||||
#define XREALLOC(p, n, h, t) realloc((p), (n))
|
||||
#endif
|
||||
|
||||
#if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED)
|
||||
#undef NO_FILESYSTEM
|
||||
#else
|
||||
#define NO_FILESYSTEM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG)
|
||||
#define DEBUG_CYASSL
|
||||
#else
|
||||
#undef DEBUG_CYASSL
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_OPENSSL_EN == DEF_ENABLED)
|
||||
#define OPENSSL_EXTRA
|
||||
#else
|
||||
#undef OPENSSL_EXTRA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED)
|
||||
#undef SINGLE_THREADED
|
||||
#else
|
||||
#define SINGLE_THREADED
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DH_EN == DEF_ENABLED)
|
||||
#undef NO_DH
|
||||
#else
|
||||
#define NO_DH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DSA_EN == DEF_ENABLED)
|
||||
#undef NO_DSA
|
||||
#else
|
||||
#define NO_DSA
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_PSK_EN == DEF_ENABLED)
|
||||
#undef NO_PSK
|
||||
#else
|
||||
#define NO_PSK
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_3DES_EN == DEF_ENABLED)
|
||||
#undef NO_DES
|
||||
#else
|
||||
#define NO_DES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_AES_EN == DEF_ENABLED)
|
||||
#undef NO_AES
|
||||
#else
|
||||
#define NO_AES
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RC4_EN == DEF_ENABLED)
|
||||
#undef NO_RC4
|
||||
#else
|
||||
#define NO_RC4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_RABBIT_EN == DEF_ENABLED)
|
||||
#undef NO_RABBIT
|
||||
#else
|
||||
#define NO_RABBIT
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_HC128_EN == DEF_ENABLED)
|
||||
#undef NO_HC128
|
||||
#else
|
||||
#define NO_HC128
|
||||
#endif
|
||||
|
||||
#if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG)
|
||||
#define BIG_ENDIAN_ORDER
|
||||
#else
|
||||
#undef BIG_ENDIAN_ORDER
|
||||
#define LITTLE_ENDIAN_ORDER
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_MD4_EN == DEF_ENABLED)
|
||||
#undef NO_MD4
|
||||
#else
|
||||
#define NO_MD4
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_WRITEV_EN == DEF_ENABLED)
|
||||
#undef NO_WRITEV
|
||||
#else
|
||||
#define NO_WRITEV
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED)
|
||||
#define NO_DEV_RANDOM
|
||||
#else
|
||||
#undef NO_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_USER_IO_EN == DEF_ENABLED)
|
||||
#define CYASSL_USER_IO
|
||||
#else
|
||||
#undef CYASSL_USER_IO
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED)
|
||||
#undef LARGE_STATIC_BUFFERS
|
||||
#undef STATIC_CHUNKS_ONLY
|
||||
#else
|
||||
#define LARGE_STATIC_BUFFERS
|
||||
#define STATIC_CHUNKS_ONLY
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED)
|
||||
#define CYASSL_DER_LOAD
|
||||
#else
|
||||
#undef CYASSL_DER_LOAD
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_DTLS_EN == DEF_ENABLED)
|
||||
#define CYASSL_DTLS
|
||||
#else
|
||||
#undef CYASSL_DTLS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED)
|
||||
#define CYASSL_CALLBACKS
|
||||
#else
|
||||
#undef CYASSL_CALLBACKS
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED)
|
||||
#define USE_FAST_MATH
|
||||
#else
|
||||
#undef USE_FAST_MATH
|
||||
#endif
|
||||
|
||||
#if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED)
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#else
|
||||
#undef TFM_TIMING_RESISTANT
|
||||
#endif
|
||||
|
||||
#endif /* MICRIUM */
|
||||
|
||||
|
||||
#ifdef CYASSL_QL
|
||||
#ifndef CYASSL_SEP
|
||||
#define CYASSL_SEP
|
||||
#endif
|
||||
#ifndef OPENSSL_EXTRA
|
||||
#define OPENSSL_EXTRA
|
||||
#endif
|
||||
#ifndef SESSION_CERTS
|
||||
#define SESSION_CERTS
|
||||
#endif
|
||||
#ifndef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#endif
|
||||
#ifndef ATOMIC_USER
|
||||
#define ATOMIC_USER
|
||||
#endif
|
||||
#ifndef CYASSL_DER_LOAD
|
||||
#define CYASSL_DER_LOAD
|
||||
#endif
|
||||
#ifndef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
#ifndef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#endif
|
||||
#ifndef SESSION_INDEX
|
||||
#define SESSION_INDEX
|
||||
#endif
|
||||
#endif /* CYASSL_QL */
|
||||
|
||||
|
||||
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
||||
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
||||
#define USE_CYASSL_MEMORY
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
||||
#undef KEEP_PEER_CERT
|
||||
#define KEEP_PEER_CERT
|
||||
#endif
|
||||
|
||||
|
||||
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
||||
#ifndef XSTREAM_ALIGNMENT
|
||||
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
||||
#define NO_XSTREAM_ALIGNMENT
|
||||
#else
|
||||
#define XSTREAM_ALIGNMENT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* if using hardware crypto and have alignment requirements, specify the
|
||||
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
||||
This hint tries to help as much as possible. */
|
||||
#ifndef CYASSL_GENERAL_ALIGNMENT
|
||||
#ifdef CYASSL_AESNI
|
||||
#define CYASSL_GENERAL_ALIGNMENT 16
|
||||
#elif defined(XSTREAM_ALIGNMENT)
|
||||
#define CYASSL_GENERAL_ALIGNMENT 4
|
||||
#else
|
||||
#define CYASSL_GENERAL_ALIGNMENT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL
|
||||
/* not widely supported yet */
|
||||
#undef NO_SKID
|
||||
#define NO_SKID
|
||||
#endif
|
||||
|
||||
/* Place any other flags or defines here */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* CTAO_CRYPT_SETTINGS_H */
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -482,32 +482,32 @@
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash" versionMatchMode="fixed"/>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash" versionMatchMode="fixed"/>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash" versionMatchMode="fixed"/>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Network_DS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="0.10.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash" versionMatchMode="fixed"/>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash" versionMatchMode="fixed"/>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash" versionMatchMode="fixed"/>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
@@ -694,20 +694,20 @@
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleServer" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleServer" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
@@ -878,68 +878,68 @@
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="6.4.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-CyaSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<file attr="config" category="header" name="wolfSSL\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-wolfSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfSSL\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfSSL\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-CyaSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<file attr="config" category="header" name="wolfSSL\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfSSL\IDE\MDK5-ARM\Docs\wolfSSL-Licnese.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-wolfSSL.h">
|
||||
<instance index="0">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfSSL\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\wolfcrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.4." condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.4.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* config-RTX-TCP-FS.h
|
||||
/* SimpleServer.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
@@ -20,13 +20,11 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
// <<< Use Configuration Wizard in Context Menu >>>
|
||||
// <h> Build Target: Simple Server
|
||||
// <s.15>Listen Port Number
|
||||
// <i> Default: "11111"
|
||||
#define CYASSL_LISTEN_PORT "443"
|
||||
#define WOLFSSL_LISTEN_PORT "11111"
|
||||
|
||||
// </h>
|
||||
// <<< end of configuration section >>>
|
||||
|
||||
@@ -19,26 +19,32 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <cyassl/ctaocrypt/visibility.h>
|
||||
#include <cyassl/ctaocrypt/logging.h>
|
||||
#include <wolfssl/wolfcrypt/visibility.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
||||
#include "stm32f2xx_hal.h"
|
||||
#include "cmsis_os.h"
|
||||
#include "rl_fs.h"
|
||||
#include "rl_net.h"
|
||||
#include <stdio.h>
|
||||
#include "cyassl_MDK_ARM.h"
|
||||
#include <cyassl/ssl.h>
|
||||
|
||||
#include "config-SimpleServer.h"
|
||||
#include <wolfssl/ssl.h>
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Initialize a Flash Memory Card
|
||||
*----------------------------------------------------------------------------*/
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
#include "rl_fs.h"
|
||||
static void init_filesystem (void) {
|
||||
int32_t retv;
|
||||
|
||||
@@ -51,22 +57,12 @@ static void init_filesystem (void) {
|
||||
else {
|
||||
printf ("Drive M0 mount failed!\n");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
printf ("Drive M0 initialization failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* TCP/IP tasks
|
||||
*----------------------------------------------------------------------------*/
|
||||
void tcp_poll (void const *arg)
|
||||
{
|
||||
CYASSL_MSG("TCP polling started.\n") ;
|
||||
while (1) {
|
||||
net_main ();
|
||||
osDelay(1) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef struct func_args {
|
||||
int argc;
|
||||
@@ -74,9 +70,9 @@ typedef struct func_args {
|
||||
} func_args;
|
||||
|
||||
extern void server_test(func_args * args) ;
|
||||
extern void init_time(void) ;
|
||||
|
||||
osThreadDef (tcp_poll, osPriorityHigh , 1, 0) ;
|
||||
#include "config-SimpleServer.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
* mian entry
|
||||
*----------------------------------------------------------------------------*/
|
||||
@@ -85,16 +81,18 @@ char* myoptarg = NULL;
|
||||
|
||||
int main()
|
||||
{
|
||||
static char *argv[] = { "server", "-p", CYASSL_LISTEN_PORT, "-d"} ;
|
||||
static char *argv[] = { "server", "-p", WOLFSSL_LISTEN_PORT, "-d"} ;
|
||||
static func_args args = { 4, argv } ;
|
||||
|
||||
SystemClock_Config ();
|
||||
#if !defined(NO_FILESYSTEM)
|
||||
init_filesystem ();
|
||||
net_initialize() ;
|
||||
osThreadCreate (osThread (tcp_poll), NULL);
|
||||
osDelay(10000) ; /* wait for DHCP */
|
||||
#if defined(DEBUG_CYASSL)
|
||||
#endif
|
||||
netInitialize() ;
|
||||
osDelay(300) ;
|
||||
#if defined(DEBUG_WOLFSSL)
|
||||
printf("Turning ON Debug message\n") ;
|
||||
CyaSSL_Debugging_ON() ;
|
||||
wolfSSL_Debugging_ON() ;
|
||||
#endif
|
||||
|
||||
printf("Simple Server: Started\n") ;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* time-dummy.c.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "time.h"
|
||||
|
||||
struct tm *Cyassl_MDK_gmtime(const time_t *c)
|
||||
{
|
||||
static struct tm date ;
|
||||
return(&date) ;
|
||||
}
|
||||
|
||||
time_t time(time_t * t) { return 0 ; }
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -44,29 +43,7 @@
|
||||
* Initialize Clock Configuration
|
||||
*----------------------------------------------------------------------------*/
|
||||
void SystemClock_Config(void) {
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct;
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct;
|
||||
|
||||
/* Enable HSE Oscillator and activate PLL with HSE as source */
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
|
||||
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
|
||||
RCC_OscInitStruct.PLL.PLLM = 25;
|
||||
RCC_OscInitStruct.PLL.PLLN = 240;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 5;
|
||||
HAL_RCC_OscConfig(&RCC_OscInitStruct);
|
||||
|
||||
/* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
|
||||
clocks dividers */
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK |
|
||||
RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
|
||||
#warning "write MPU specific System Clock Set up\n"
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
|
||||
@@ -481,6 +481,41 @@
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="ARM_Compiler" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="1.0.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Network_DS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="0.10.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.01" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0"/>
|
||||
@@ -664,50 +699,50 @@
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Benchmark" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Benchmark" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Test" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="Test" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleClient" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleClient" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleServer" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="SimpleServer" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoClient" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoClient" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoServer" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="echoServer" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
@@ -878,68 +913,68 @@
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="6.4.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-CyaSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-wolfSSL.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="2.7.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="2.7.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-CyaSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-CyaSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="CyaSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-Core"/>
|
||||
<package license="cyassl\IDE\MDK5-ARM\Docs\CyaSSL-Licnese.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-wolfSSL.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-Licnese.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-wolfSSL.h">
|
||||
<instance index="0">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\wolfcrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.4." condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.4.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="STM32F207 Flash"/>
|
||||
</targetInfos>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
/* #define SINGLE_THREADED or define RTOS option */
|
||||
#define WOLFSSL_CMSIS_RTOS
|
||||
|
||||
/* #define NO_FILESYSTEM or define Filesystem option */
|
||||
#define WOLFSSL_KEIL_FS
|
||||
#define NO_WOLFSSL_DIR
|
||||
#define WOLFSSL_NO_CURRDIR
|
||||
|
||||
/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */
|
||||
#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
|
||||
|
||||
#define NO_DEV_RANDOM
|
||||
/* define your Rand gen for the operational use */
|
||||
#define WOLFSSL_GENSEED_FORTEST
|
||||
|
||||
#define USE_WOLFSSL_MEMORY
|
||||
#define WOLFSSL_MALLOC_CHECK
|
||||
|
||||
#define XVALIDATEDATE(d, f,t) (0)
|
||||
#define WOLFSSL_USER_CURRTIME /* for benchmark */
|
||||
|
||||
#define USE_FAST_MATH
|
||||
#define TFM_TIMING_RESISTANT
|
||||
|
||||
#define BENCH_EMBEDDED
|
||||
|
||||
#define NO_WRITEV
|
||||
#define NO_MAIN_DRIVER
|
||||
#define WOLFSSL_MDK_SHELL
|
||||
|
||||
@@ -451,6 +451,36 @@
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<packages>
|
||||
<filter>
|
||||
<targetInfos/>
|
||||
</filter>
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Middleware" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="7.0.0-beta">
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="MDK-Network_DS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="Keil" version="0.10.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package name="STM32F2xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.2.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0">
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</package>
|
||||
</packages>
|
||||
<apis>
|
||||
<api Capiversion="2.01" Cclass="CMSIS Driver" Cgroup="Ethernet MAC" exclusive="0">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.3.0"/>
|
||||
@@ -592,14 +622,14 @@
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo includeInLib="1" name="wolfSSL-Lib" versionMatchMode=""/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="" condition="wolfSSL-Core">
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.2" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo includeInLib="1" name="wolfSSL-Lib" versionMatchMode=""/>
|
||||
</targetInfos>
|
||||
@@ -716,62 +746,62 @@
|
||||
<package name="MDK-Middleware" url="http://www.keil.com/pack/" vendor="Keil" version="5.1.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-Crypt.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-Crypt.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-Crypt.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config-RTX-TCP-FS.h">
|
||||
<instance index="0" removed="1">RTE\Other\config-RTX-TCP-FS.h</instance>
|
||||
<component Cclass="Other" Cgroup="CyaSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="3.0.0" condition="CyaSSL-RTX,TCP,FS"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfSSL" Csub="RTX,TCP,FS" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-RTX,TCP,FS"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\Other\config.h</instance>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cclass="Other" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/keil/pack/" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
|
||||
<instance index="0">RTE\wolfSSL\config-Crypt.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.6" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.6"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-wolfSSL.h">
|
||||
<instance index="0">RTE\wolfSSL\config-wolfSSL.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfSSL-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="header" name="cyassl\IDE\MDK5-ARM\MDK-ARM\CyaSSL\config.h">
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\MDK-ARM\wolfSSL\config.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\config.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package name="CyaSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.0.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" cond9tion="wolfCrypt-Core"/>
|
||||
<package name="wolfSSL" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\cyassl\ctaocrypt\settings.h">
|
||||
<file attr="config" category="header" name="wolfssl\wolfssl\ctaocrypt\settings.h">
|
||||
<instance index="0" removed="1">RTE\wolfSSL\settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.0.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.0"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos/>
|
||||
</file>
|
||||
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
|
||||
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.6.3" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="CyaSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.6.3"/>
|
||||
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
|
||||
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="wolfSSL-Lib"/>
|
||||
</targetInfos>
|
||||
|
||||
44
README
44
README
@@ -35,6 +35,48 @@ before calling wolfSSL_new(); Though it's not recommended.
|
||||
*** end Notes ***
|
||||
|
||||
|
||||
********* wolfSSL (Formerly CyaSSL) Release 3.9.6 (6/14/2016)
|
||||
|
||||
Release 3.9.6 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
- Add staticmemory feature
|
||||
- Add public wc_GetTime API with base64encode feature
|
||||
- Add AES CMAC algorithm
|
||||
- Add DTLS sessionexport feature
|
||||
- Add python wolfCrypt wrapper
|
||||
- Add ECC encrypt/decrypt benchmarks
|
||||
- Add dynamic session tickets
|
||||
- Add eccshamir option
|
||||
- Add Whitewood netRandom support --with-wnr
|
||||
- Add embOS port
|
||||
- Add minimum key size checks for RSA and ECC
|
||||
- Add STARTTLS support to examples
|
||||
- Add uTasker port
|
||||
- Add asynchronous crypto and wolf event support
|
||||
- Add compile check for misc.c with inline
|
||||
- Add RNG benchmark
|
||||
- Add reduction to stack usage with hash-based RNG
|
||||
- Update STM32F2_CRYPTO port with additional algorithms supported
|
||||
- Update MDK5 projects
|
||||
- Update AES-NI
|
||||
- Fix for STM32 with STM32F2_HASH defined
|
||||
- Fix for building with MinGw
|
||||
- Fix ECC math bugs with ALT_ECC_SIZE and key sizes over 256 bit (1)
|
||||
- Fix certificate buffers github issue #422
|
||||
- Fix decrypt max size with RSA OAEP
|
||||
- Fix DTLS sanity check with DTLS timeout notification
|
||||
- Fix free of WOLFSSL_METHOD on failure to create CTX
|
||||
- Fix memory leak in failure case with wc_RsaFunction (2)
|
||||
|
||||
- No high level security fixes that requires an update though we always
|
||||
recommend updating to the latest
|
||||
- (1) Code changes for ECC fix can be found at pull requests #411, #416, and #428
|
||||
- (2) Builds using RSA with using normal math and not RSA_LOW_MEM should update
|
||||
- Tag 3.9.6w is for a Windows example echoserver fix
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at //http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
********* wolfSSL (Formerly CyaSSL) Release 3.9.0 (3/18/2016)
|
||||
|
||||
Release 3.9.0 of wolfSSL has bug fixes and new features including:
|
||||
@@ -173,7 +215,7 @@ Release 3.6.6 of wolfSSL has bug fixes and new features including:
|
||||
recommend updating to the latest
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at //http://wolfssl.com/yaSSL/Docs.html
|
||||
More information can be found on-line at //http://wolfssl.com/yaSSL/Docs.html
|
||||
|
||||
**************** wolfSSL (Formerly CyaSSL) Release 3.6.0 (06/19/2015)
|
||||
|
||||
|
||||
43
README.md
43
README.md
@@ -37,7 +37,48 @@ wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
|
||||
|
||||
before calling wolfSSL_new(); Though it's not recommended.
|
||||
```
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.9.0 (03/18/2015)
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.9.6 (6/14/2016)
|
||||
|
||||
##Release 3.9.6 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
- Add staticmemory feature
|
||||
- Add public wc_GetTime API with base64encode feature
|
||||
- Add AES CMAC algorithm
|
||||
- Add DTLS sessionexport feature
|
||||
- Add python wolfCrypt wrapper
|
||||
- Add ECC encrypt/decrypt benchmarks
|
||||
- Add dynamic session tickets
|
||||
- Add eccshamir option
|
||||
- Add Whitewood netRandom support --with-wnr
|
||||
- Add embOS port
|
||||
- Add minimum key size checks for RSA and ECC
|
||||
- Add STARTTLS support to examples
|
||||
- Add uTasker port
|
||||
- Add asynchronous crypto and wolf event support
|
||||
- Add compile check for misc.c with inline
|
||||
- Add RNG benchmark
|
||||
- Add reduction to stack usage with hash-based RNG
|
||||
- Update STM32F2_CRYPTO port with additional algorithms supported
|
||||
- Update MDK5 projects
|
||||
- Update AES-NI
|
||||
- Fix for STM32 with STM32F2_HASH defined
|
||||
- Fix for building with MinGw
|
||||
- Fix ECC math bugs with ALT_ECC_SIZE and key sizes over 256 bit (1)
|
||||
- Fix certificate buffers github issue #422
|
||||
- Fix decrypt max size with RSA OAEP
|
||||
- Fix DTLS sanity check with DTLS timeout notification
|
||||
- Fix free of WOLFSSL_METHOD on failure to create CTX
|
||||
- Fix memory leak in failure case with wc_RsaFunction (2)
|
||||
|
||||
- No high level security fixes that requires an update though we always
|
||||
recommend updating to the latest
|
||||
- (1) Code changes for ECC fix can be found at pull requests #411, #416, and #428
|
||||
- (2) Builds using RSA with using normal math and not RSA_LOW_MEM should update
|
||||
|
||||
See INSTALL file for build instructions.
|
||||
More info can be found on-line at //http://wolfssl.com/wolfSSL/Docs.html
|
||||
|
||||
# wolfSSL (Formerly CyaSSL) Release 3.9.0 (03/18/2016)
|
||||
|
||||
##Release 3.9.0 of wolfSSL has bug fixes and new features including:
|
||||
|
||||
|
||||
12
Vagrantfile
vendored
12
Vagrantfile
vendored
@@ -8,13 +8,13 @@ apt-get update
|
||||
apt-get install -y git autoconf libtool make valgrind libpq-dev
|
||||
|
||||
|
||||
URL=https://sourceforge.net/projects/levent/files/libevent
|
||||
LIB=libevent-2.0
|
||||
VER=22-stable
|
||||
URL=https://github.com/libevent/libevent/releases/download/release
|
||||
LIB=libevent
|
||||
VER=2.0.22-stable
|
||||
|
||||
wget -q $URL/$LIB/$LIB.$VER.tar.gz && tar -zxf $LIB.$VER.tar.gz
|
||||
cd $LIB.$VER/ && ./autogen.sh && ./configure -q && make -s
|
||||
sudo make install && cd .. && rm -rf $LIB.$VER*
|
||||
wget -q $URL-$VER/$LIB-$VER.tar.gz && tar -zxf $LIB-$VER.tar.gz
|
||||
cd $LIB-$VER/ && ./autogen.sh && ./configure -q && make -s
|
||||
sudo make install && cd .. && rm -rf $LIB-$VER*
|
||||
|
||||
|
||||
DST=wolfssl
|
||||
|
||||
69
configure.ac
69
configure.ac
@@ -6,7 +6,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
AC_INIT([wolfssl],[3.9.1],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com])
|
||||
AC_INIT([wolfssl],[3.9.6],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
@@ -35,7 +35,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
|
||||
|
||||
#shared library versioning
|
||||
WOLFSSL_LIBRARY_VERSION=5:0:2
|
||||
WOLFSSL_LIBRARY_VERSION=6:0:3
|
||||
# | | |
|
||||
# +------+ | +---+
|
||||
# | | |
|
||||
@@ -768,6 +768,18 @@ fi
|
||||
|
||||
AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
|
||||
|
||||
# ECC Custom Curves
|
||||
AC_ARG_ENABLE([ecccustcurves],
|
||||
[AS_HELP_STRING([--enable-ecccustcurves],[Enable ECC custom curves (default: disabled)])],
|
||||
[ ENABLED_ECCCUSTCURVES=$enableval ],
|
||||
[ ENABLED_ECCCUSTCURVES=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_ECCCUSTCURVES" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CUSTOM_CURVES"
|
||||
fi
|
||||
|
||||
|
||||
# for using memory optimization setting on both curve25519 and ed25519
|
||||
ENABLED_CURVED25519_SMALL=no
|
||||
@@ -1147,6 +1159,23 @@ fi
|
||||
AM_CONDITIONAL([BUILD_CODING], [test "x$ENABLED_CODING" = "xyes"])
|
||||
|
||||
|
||||
# Base64 Encode
|
||||
BASE64ENCODE_DEFAULT=no
|
||||
if test "$host_cpu" = "x86_64"
|
||||
then
|
||||
BASE64ENCODE_DEFAULT=yes
|
||||
fi
|
||||
AC_ARG_ENABLE([base64encode],
|
||||
[ --enable-base64encode Enable Base64 encoding (default: enabled on x86_64)],
|
||||
[ ENABLED_BASE64ENCODE=$enableval ],
|
||||
[ ENABLED_BASE64ENCODE=$BASE64ENCODE_DEFAULT ]
|
||||
)
|
||||
if test "$ENABLED_BASE64ENCODE" = "yes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_BASE64_ENCODE"
|
||||
fi
|
||||
|
||||
|
||||
# DES3
|
||||
AC_ARG_ENABLE([des3],
|
||||
[ --enable-des3 Enable DES3 (default: enabled)],
|
||||
@@ -1256,6 +1285,19 @@ fi
|
||||
AM_CONDITIONAL([BUILD_SHA], [test "x$ENABLED_SHA" = "xyes"])
|
||||
|
||||
|
||||
# CMAC
|
||||
AC_ARG_ENABLE([cmac],
|
||||
[AS_HELP_STRING([--enable-cmac],[Enable CMAC (default: disabled)])],
|
||||
[ ENABLED_CMAC=$enableval ],
|
||||
[ ENABLED_CMAC=no ]
|
||||
)
|
||||
|
||||
AS_IF([test "x$ENABLED_CMAC" = "xyes"],
|
||||
[AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CMAC -DWOLFSSL_AES_DIRECT"])
|
||||
|
||||
AM_CONDITIONAL([BUILD_CMAC], [test "x$ENABLED_CMAC" = "xyes"])
|
||||
|
||||
|
||||
# Web Server Build
|
||||
AC_ARG_ENABLE([webserver],
|
||||
[ --enable-webserver Enable Web Server (default: disabled)],
|
||||
@@ -2545,6 +2587,23 @@ AC_SUBST([IPPLINK])
|
||||
AM_CONDITIONAL([BUILD_FAST_RSA], [test "x$ENABLED_FAST_RSA" = "xyes"])
|
||||
|
||||
|
||||
# static memory use
|
||||
AC_ARG_ENABLE([staticmemory],
|
||||
[AS_HELP_STRING([--enable-staticmemory],[Enable static memory use (default: disabled)])],
|
||||
[ ENABLED_STATICMEMORY=$enableval ],
|
||||
[ ENABLED_STATICMEMORY=no ]
|
||||
)
|
||||
|
||||
if test "x$ENABLED_STATICMEMORY" = "xyes"
|
||||
then
|
||||
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_STATIC_MEMORY"
|
||||
if test "x$ENABLED_FASTMATH" = "xno"
|
||||
then
|
||||
AC_MSG_ERROR([please use --enable-fastmath if enabling staticmemory.])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# microchip api
|
||||
AC_ARG_ENABLE([mcapi],
|
||||
[ --enable-mcapi Enable Microchip API (default: disabled)],
|
||||
@@ -2672,6 +2731,11 @@ AS_IF([test "x$ENABLED_SNIFFER" = "xyes" && \
|
||||
test "x$ENABLED_RSA" = "xno"],
|
||||
[AC_MSG_ERROR([please enable rsa if enabling sniffer.])])
|
||||
|
||||
# CMAC currently requires AES.
|
||||
AS_IF([test "x$ENABLED_CMAC" = "xyes" && \
|
||||
test "x$ENABLED_AES" = "xno"],
|
||||
[AC_MSG_ERROR([cannot use CMAC without AES.])])
|
||||
|
||||
################################################################################
|
||||
# Update CFLAGS based on options #
|
||||
################################################################################
|
||||
@@ -2914,6 +2978,7 @@ echo " * RIPEMD: $ENABLED_RIPEMD"
|
||||
echo " * SHA: $ENABLED_SHA"
|
||||
echo " * SHA-512: $ENABLED_SHA512"
|
||||
echo " * BLAKE2: $ENABLED_BLAKE2"
|
||||
echo " * CMAC: $ENABLED_CMAC"
|
||||
echo " * keygen: $ENABLED_KEYGEN"
|
||||
echo " * certgen: $ENABLED_CERTGEN"
|
||||
echo " * certreq: $ENABLED_CERTREQ"
|
||||
|
||||
@@ -608,7 +608,6 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
(void)resumeSz;
|
||||
(void)session;
|
||||
(void)sslResume;
|
||||
(void)trackMemory;
|
||||
(void)atomicUser;
|
||||
(void)pkCallbacks;
|
||||
(void)scr;
|
||||
@@ -980,7 +979,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_WOLFSSL_MEMORY
|
||||
#if defined(USE_WOLFSSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
|
||||
if (trackMemory)
|
||||
InitMemoryTracker();
|
||||
#endif
|
||||
@@ -1615,7 +1614,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
|
||||
((func_args*)args)->return_code = 0;
|
||||
|
||||
#ifdef USE_WOLFSSL_MEMORY
|
||||
#if defined(USE_WOLFSSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
|
||||
if (trackMemory)
|
||||
ShowMemoryTracker();
|
||||
#endif /* USE_WOLFSSL_MEMORY */
|
||||
@@ -1628,6 +1627,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
(void) verifyCert;
|
||||
(void) ourCert;
|
||||
(void) ourKey;
|
||||
(void) trackMemory;
|
||||
|
||||
#if !defined(WOLFSSL_TIRTOS)
|
||||
return 0;
|
||||
@@ -1653,10 +1653,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
|
||||
wolfSSL_Init();
|
||||
#if defined(DEBUG_WOLFSSL) && !defined(WOLFSSL_MDK_SHELL) && !defined(STACK_TRAP)
|
||||
wolfSSL_Debugging_ON();
|
||||
#endif
|
||||
wolfSSL_Init();
|
||||
ChangeToWolfRoot();
|
||||
|
||||
#ifdef HAVE_STACK_SIZE
|
||||
|
||||
@@ -114,11 +114,9 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
|
||||
doPSK = 1;
|
||||
#endif
|
||||
|
||||
#if defined(USE_WINDOWS_API)
|
||||
/* Generate random port for testing */
|
||||
port = GetRandomPort();
|
||||
#elif defined(NO_MAIN_DRIVER) && !defined(CYASSL_SNIFFER) && \
|
||||
!defined(WOLFSSL_MDK_SHELL) && !defined(CYASSL_TIRTOS)
|
||||
#if defined(NO_MAIN_DRIVER) && !defined(CYASSL_SNIFFER) && \
|
||||
!defined(WOLFSSL_MDK_SHELL) && !defined(CYASSL_TIRTOS) && \
|
||||
!defined(USE_WINDOWS_API)
|
||||
/* Let tcp_listen assign port */
|
||||
port = 0;
|
||||
#else
|
||||
|
||||
@@ -252,7 +252,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID;
|
||||
SOCKET_T clientfd = WOLFSSL_SOCKET_INVALID;
|
||||
|
||||
SSL_METHOD* method = 0;
|
||||
wolfSSL_method_func method = NULL;
|
||||
SSL_CTX* ctx = 0;
|
||||
SSL* ssl = 0;
|
||||
|
||||
@@ -319,6 +319,18 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
const char* wnrConfigFile = wnrConfig;
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
#if (defined(HAVE_ECC) && !defined(ALT_ECC_SIZE)) \
|
||||
|| defined(SESSION_CERTS)
|
||||
/* big enough to handle most cases including session certs */
|
||||
byte memory[204000];
|
||||
#else
|
||||
byte memory[80000];
|
||||
#endif
|
||||
byte memoryIO[34500]; /* max of 17k for IO buffer (TLS packet can be 16k) */
|
||||
WOLFSSL_MEM_CONN_STATS ssl_stats;
|
||||
#endif
|
||||
|
||||
((func_args*)args)->return_code = -1; /* error state */
|
||||
|
||||
#ifdef NO_RSA
|
||||
@@ -326,7 +338,6 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
ourCert = (char*)eccCert;
|
||||
ourKey = (char*)eccKey;
|
||||
#endif
|
||||
(void)trackMemory;
|
||||
(void)pkCallbacks;
|
||||
(void)needDH;
|
||||
(void)ourKey;
|
||||
@@ -560,7 +571,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CYASSL_MEMORY
|
||||
#if defined(USE_CYASSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
|
||||
if (trackMemory)
|
||||
InitMemoryTracker();
|
||||
#endif
|
||||
@@ -574,18 +585,18 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
#ifndef NO_OLD_TLS
|
||||
#ifdef WOLFSSL_ALLOW_SSLV3
|
||||
case 0:
|
||||
method = SSLv3_server_method();
|
||||
method = wolfSSLv3_server_method_ex;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifndef NO_TLS
|
||||
case 1:
|
||||
method = TLSv1_server_method();
|
||||
method = wolfTLSv1_server_method_ex;
|
||||
break;
|
||||
|
||||
|
||||
case 2:
|
||||
method = TLSv1_1_server_method();
|
||||
method = wolfTLSv1_1_server_method_ex;
|
||||
break;
|
||||
|
||||
#endif
|
||||
@@ -593,19 +604,19 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
|
||||
#ifndef NO_TLS
|
||||
case 3:
|
||||
method = TLSv1_2_server_method();
|
||||
method = wolfTLSv1_2_server_method_ex;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_DTLS
|
||||
#ifndef NO_OLD_TLS
|
||||
case -1:
|
||||
method = DTLSv1_server_method();
|
||||
method = wolfDTLSv1_server_method_ex;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case -2:
|
||||
method = DTLSv1_2_server_method();
|
||||
method = wolfDTLSv1_2_server_method_ex;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -616,7 +627,19 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
if (method == NULL)
|
||||
err_sys("unable to get method");
|
||||
|
||||
ctx = SSL_CTX_new(method);
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
if (wolfSSL_CTX_load_static_memory(&ctx, method, memory, sizeof(memory),0,1)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("unable to load static memory and create ctx");
|
||||
|
||||
/* load in a buffer for IO */
|
||||
if (wolfSSL_CTX_load_static_memory(&ctx, NULL, memoryIO, sizeof(memoryIO),
|
||||
WOLFMEM_IO_POOL_FIXED | WOLFMEM_TRACK_STATS, 1)
|
||||
!= SSL_SUCCESS)
|
||||
err_sys("unable to load static memory and create ctx");
|
||||
#else
|
||||
ctx = SSL_CTX_new(method(NULL));
|
||||
#endif
|
||||
if (ctx == NULL)
|
||||
err_sys("unable to get ctx");
|
||||
|
||||
@@ -783,11 +806,32 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
err_sys("tcp accept failed");
|
||||
}
|
||||
}
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
|
||||
{
|
||||
WOLFSSL_MEM_STATS mem_stats;
|
||||
fprintf(stderr, "Before creating SSL\n");
|
||||
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
|
||||
err_sys("ctx not using static memory");
|
||||
if (wolfSSL_PrintStats(&mem_stats) != 1) /* function in test.h */
|
||||
err_sys("error printing out memory stats");
|
||||
}
|
||||
#endif
|
||||
|
||||
ssl = SSL_new(ctx);
|
||||
if (ssl == NULL)
|
||||
err_sys("unable to get SSL");
|
||||
|
||||
#if defined(WOLFSSL_STATIC_MEMORY) && defined(DEBUG_WOLFSSL)
|
||||
{
|
||||
WOLFSSL_MEM_STATS mem_stats;
|
||||
fprintf(stderr, "After creating SSL\n");
|
||||
if (wolfSSL_CTX_is_static_memory(ctx, &mem_stats) != 1)
|
||||
err_sys("ctx not using static memory");
|
||||
if (wolfSSL_PrintStats(&mem_stats) != 1) /* function in test.h */
|
||||
err_sys("error printing out memory stats");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_HANDSHAKE_DONE_CB
|
||||
wolfSSL_SetHsDoneCb(ssl, myHsDoneCb, NULL);
|
||||
#endif
|
||||
@@ -972,6 +1016,21 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE)
|
||||
SSL_shutdown(ssl); /* bidirectional shutdown */
|
||||
}
|
||||
/* display collected statistics */
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
if (wolfSSL_is_static_memory(ssl, &ssl_stats) != 1)
|
||||
err_sys("static memory was not used with ssl");
|
||||
|
||||
fprintf(stderr, "\nprint off SSL memory stats\n");
|
||||
fprintf(stderr, "*** This is memory state before wolfSSL_free is called\n");
|
||||
fprintf(stderr, "peak connection memory = %d\n", ssl_stats.peakMem);
|
||||
fprintf(stderr, "current memory in use = %d\n", ssl_stats.curMem);
|
||||
fprintf(stderr, "peak connection allocs = %d\n", ssl_stats.peakAlloc);
|
||||
fprintf(stderr, "current connection allocs = %d\n",ssl_stats.curAlloc);
|
||||
fprintf(stderr, "total connection allocs = %d\n",ssl_stats.totalAlloc);
|
||||
fprintf(stderr, "total connection frees = %d\n\n", ssl_stats.totalFr);
|
||||
|
||||
#endif
|
||||
SSL_free(ssl);
|
||||
|
||||
CloseSocket(clientfd);
|
||||
@@ -987,6 +1046,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
}
|
||||
} /* while(1) */
|
||||
|
||||
|
||||
CloseSocket(sockfd);
|
||||
SSL_CTX_free(ctx);
|
||||
|
||||
@@ -998,7 +1058,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
ecc_fp_free(); /* free per thread cache */
|
||||
#endif
|
||||
|
||||
#ifdef USE_WOLFSSL_MEMORY
|
||||
#if defined(USE_WOLFSSL_MEMORY) && !defined(WOLFSSL_STATIC_MEMORY)
|
||||
if (trackMemory)
|
||||
ShowMemoryTracker();
|
||||
#endif
|
||||
@@ -1021,6 +1081,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
(void) useNtruKey;
|
||||
(void) ourDhParam;
|
||||
(void) ourCert;
|
||||
(void) trackMemory;
|
||||
#ifndef CYASSL_TIRTOS
|
||||
return 0;
|
||||
#endif
|
||||
@@ -1048,10 +1109,10 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
|
||||
args.signal = &ready;
|
||||
InitTcpReady(&ready);
|
||||
|
||||
CyaSSL_Init();
|
||||
#if defined(DEBUG_CYASSL) && !defined(WOLFSSL_MDK_SHELL)
|
||||
CyaSSL_Debugging_ON();
|
||||
#endif
|
||||
CyaSSL_Init();
|
||||
ChangeToWolfRoot();
|
||||
|
||||
#ifdef HAVE_STACK_SIZE
|
||||
|
||||
@@ -164,7 +164,7 @@ enum {
|
||||
|
||||
/* AES */
|
||||
typedef struct CRYPT_AES_CTX {
|
||||
int holder[74]; /* big enough to hold internal, but check on init */
|
||||
int holder[76]; /* big enough to hold internal, but check on init */
|
||||
} CRYPT_AES_CTX;
|
||||
|
||||
/* key */
|
||||
|
||||
@@ -69,7 +69,7 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_libdir}/libwolfssl.la
|
||||
%{_libdir}/libwolfssl.so
|
||||
%{_libdir}/libwolfssl.so.3
|
||||
%{_libdir}/libwolfssl.so.3.2.0
|
||||
%{_libdir}/libwolfssl.so.3.3.0
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
@@ -169,6 +169,7 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_includedir}/wolfssl/certs_test.h
|
||||
%{_includedir}/wolfssl/crl.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/aes.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/cmac.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/arc4.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/asn.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/asn_public.h
|
||||
@@ -221,9 +222,9 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_includedir}/wolfssl/wolfcrypt/types.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/visibility.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/wc_encrypt.h
|
||||
%{_includedir}/wolfssl/wolfcrypt/mem_track.h
|
||||
%{_includedir}/wolfssl/error-ssl.h
|
||||
%{_includedir}/wolfssl/ocsp.h
|
||||
%{_includedir}/wolfssl/mem_track.h
|
||||
%{_includedir}/wolfssl/openssl/asn1.h
|
||||
%{_includedir}/wolfssl/openssl/bio.h
|
||||
%{_includedir}/wolfssl/openssl/bn.h
|
||||
@@ -268,6 +269,9 @@ mkdir -p $RPM_BUILD_ROOT/
|
||||
%{_libdir}/pkgconfig/wolfssl.pc
|
||||
|
||||
%changelog
|
||||
* Mon Jun 14 2016 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
- Change location for mem_track.h header
|
||||
- Added header for cmac.h
|
||||
* Thu Mar 17 2016 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
- Added header for mem_track.h
|
||||
* Wed Dec 30 2015 Jacob Barthelmeh <jacob@wolfssl.com>
|
||||
|
||||
@@ -52,7 +52,7 @@ trap do_trap INT TERM
|
||||
echo "\nStarting example server for benchmark test"
|
||||
remove_ready_file
|
||||
# benchmark connections
|
||||
if [ $1 == 1 ]
|
||||
if [ $1 -eq 1 ]
|
||||
then
|
||||
# start server in loop mode with port
|
||||
./examples/server/server -i -p $bench_port $4 &
|
||||
@@ -60,7 +60,7 @@ then
|
||||
fi
|
||||
|
||||
# benchmark throughput
|
||||
if [ $1 == 2 ]
|
||||
if [ $1 -eq 2 ]
|
||||
then
|
||||
# start server in loop mode, non-blocking, benchmark throughput with port
|
||||
./examples/server/server -i -N -B $2 -p $bench_port $4 &
|
||||
@@ -75,7 +75,7 @@ while [ ! -s /tmp/wolfssl_server_ready -a "$counter" -lt 20 ]; do
|
||||
done
|
||||
|
||||
# benchmark connections
|
||||
if [ $1 == 1 ]
|
||||
if [ $1 -eq 1 ]
|
||||
then
|
||||
echo "Starting example client to benchmark connection average time"
|
||||
# start client to benchmark average time for each connection using port
|
||||
@@ -84,7 +84,7 @@ then
|
||||
fi
|
||||
|
||||
# benchmark throughput
|
||||
if [ $1 == 2 ]
|
||||
if [ $1 -eq 2 ]
|
||||
then
|
||||
echo "Starting example client to benchmark throughput"
|
||||
# start client in non-blocking mode, benchmark throughput using port
|
||||
|
||||
@@ -53,7 +53,7 @@ if BUILD_EXAMPLE_CLIENTS
|
||||
if !BUILD_IPV6
|
||||
dist_noinst_SCRIPTS+= scripts/external.test
|
||||
dist_noinst_SCRIPTS+= scripts/google.test
|
||||
#dist_noinst_SCRIPTS+= scripts/openssl.test
|
||||
dist_noinst_SCRIPTS+= scripts/openssl.test
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -3,7 +3,15 @@
|
||||
#openssl.test
|
||||
|
||||
# need a unique port since may run the same time as testsuite
|
||||
openssl_port=11114
|
||||
generate_port() {
|
||||
openssl_port=`LC_CTYPE=C tr -cd 0-9 </dev/urandom | head -c 7`
|
||||
openssl_port=$((`LC_CTYPE=C tr -cd 1-9 </dev/urandom | head -c 1`$openssl_port))
|
||||
openssl_port=$(($openssl_port % (65535-49512)))
|
||||
openssl_port=$(($openssl_port + 49512))
|
||||
}
|
||||
|
||||
|
||||
generate_port
|
||||
no_pid=-1
|
||||
server_pid=$no_pid
|
||||
wolf_suites_tested=0
|
||||
@@ -44,7 +52,7 @@ do_cleanup() {
|
||||
do_trap() {
|
||||
echo "got trap"
|
||||
do_cleanup
|
||||
exit -1
|
||||
exit 1
|
||||
}
|
||||
|
||||
trap do_trap INT TERM
|
||||
@@ -68,12 +76,35 @@ then
|
||||
cd ..
|
||||
fi
|
||||
|
||||
echo -e "\nStarting openssl server...\n"
|
||||
|
||||
openssl s_server -accept $openssl_port -cert ./certs/server-cert.pem -key ./certs/server-key.pem -quiet -CAfile ./certs/client-cert.pem -www -dhparam ./certs/dh2048.pem -dcert ./certs/server-ecc.pem -dkey ./certs/ecc-key.pem -Verify 10 -verify_return_error &
|
||||
server_pid=$!
|
||||
|
||||
|
||||
found_free_port=0
|
||||
while [ "$counter" -lt 20 ]; do
|
||||
echo -e "\nTrying to start openssl server on port $openssl_port...\n"
|
||||
|
||||
openssl s_server -accept $openssl_port -cert ./certs/server-cert.pem -key ./certs/server-key.pem -quiet -CAfile ./certs/client-cert.pem -www -dhparam ./certs/dh2048.pem -dcert ./certs/server-ecc.pem -dkey ./certs/ecc-key.pem -Verify 10 -verify_return_error -cipher "ALL:eNULL" &
|
||||
server_pid=$!
|
||||
# wait to see if s_server successfully starts before continuing
|
||||
sleep 0.1
|
||||
|
||||
if ps -p $server_pid > /dev/null
|
||||
then
|
||||
echo "s_server started successfully on port $openssl_port"
|
||||
found_free_port=1
|
||||
break
|
||||
else
|
||||
#port already started, try a different port
|
||||
counter=$((counter+ 1))
|
||||
generate_port
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $found_free_port = 0 ]
|
||||
then
|
||||
echo -e "Couldn't find free port for server"
|
||||
do_cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get wolfssl ciphers
|
||||
wolf_ciphers=`./examples/client/client -e`
|
||||
@@ -99,7 +130,7 @@ if [ $server_ready = 0 ]
|
||||
then
|
||||
echo -e "Couldn't verify openssl server is running, timeout error"
|
||||
do_cleanup
|
||||
exit -1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OIFS=$IFS # store old seperator to reset
|
||||
|
||||
29
src/crl.c
29
src/crl.c
@@ -51,6 +51,7 @@ int InitCRL(WOLFSSL_CRL* crl, WOLFSSL_CERT_MANAGER* cm)
|
||||
{
|
||||
WOLFSSL_ENTER("InitCRL");
|
||||
|
||||
crl->heap = cm->heap;
|
||||
crl->cm = cm;
|
||||
crl->crlList = NULL;
|
||||
crl->monitors[0].path = NULL;
|
||||
@@ -95,7 +96,7 @@ static int InitCRL_Entry(CRL_Entry* crle, DecodedCRL* dcrl)
|
||||
|
||||
|
||||
/* Free all CRL Entry resources */
|
||||
static void FreeCRL_Entry(CRL_Entry* crle)
|
||||
static void FreeCRL_Entry(CRL_Entry* crle, void* heap)
|
||||
{
|
||||
RevokedCert* tmp = crle->certs;
|
||||
|
||||
@@ -103,9 +104,11 @@ static void FreeCRL_Entry(CRL_Entry* crle)
|
||||
|
||||
while(tmp) {
|
||||
RevokedCert* next = tmp->next;
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_REVOKED);
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_REVOKED);
|
||||
tmp = next;
|
||||
}
|
||||
|
||||
(void)heap;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,15 +121,15 @@ void FreeCRL(WOLFSSL_CRL* crl, int dynamic)
|
||||
WOLFSSL_ENTER("FreeCRL");
|
||||
|
||||
if (crl->monitors[0].path)
|
||||
XFREE(crl->monitors[0].path, NULL, DYNAMIC_TYPE_CRL_MONITOR);
|
||||
XFREE(crl->monitors[0].path, crl->heap, DYNAMIC_TYPE_CRL_MONITOR);
|
||||
|
||||
if (crl->monitors[1].path)
|
||||
XFREE(crl->monitors[1].path, NULL, DYNAMIC_TYPE_CRL_MONITOR);
|
||||
XFREE(crl->monitors[1].path, crl->heap, DYNAMIC_TYPE_CRL_MONITOR);
|
||||
|
||||
while(tmp) {
|
||||
CRL_Entry* next = tmp->next;
|
||||
FreeCRL_Entry(tmp);
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
FreeCRL_Entry(tmp, crl->heap);
|
||||
XFREE(tmp, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
tmp = next;
|
||||
}
|
||||
|
||||
@@ -143,7 +146,7 @@ void FreeCRL(WOLFSSL_CRL* crl, int dynamic)
|
||||
#endif
|
||||
FreeMutex(&crl->crlLock);
|
||||
if (dynamic) /* free self */
|
||||
XFREE(crl, NULL, DYNAMIC_TYPE_CRL);
|
||||
XFREE(crl, crl->heap, DYNAMIC_TYPE_CRL);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +236,7 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
|
||||
|
||||
WOLFSSL_ENTER("AddCRL");
|
||||
|
||||
crle = (CRL_Entry*)XMALLOC(sizeof(CRL_Entry), NULL, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
crle = (CRL_Entry*)XMALLOC(sizeof(CRL_Entry), crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
if (crle == NULL) {
|
||||
WOLFSSL_MSG("alloc CRL Entry failed");
|
||||
return -1;
|
||||
@@ -241,14 +244,14 @@ static int AddCRL(WOLFSSL_CRL* crl, DecodedCRL* dcrl)
|
||||
|
||||
if (InitCRL_Entry(crle, dcrl) < 0) {
|
||||
WOLFSSL_MSG("Init CRL Entry failed");
|
||||
XFREE(crle, NULL, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (LockMutex(&crl->crlLock) != 0) {
|
||||
WOLFSSL_MSG("LockMutex failed");
|
||||
FreeCRL_Entry(crle);
|
||||
XFREE(crle, NULL, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
FreeCRL_Entry(crle, crl->heap);
|
||||
XFREE(crle, crl->heap, DYNAMIC_TYPE_CRL_ENTRY);
|
||||
return BAD_MUTEX_E;
|
||||
}
|
||||
crle->next = crl->crlList;
|
||||
@@ -301,7 +304,7 @@ int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type)
|
||||
}
|
||||
#endif
|
||||
|
||||
InitDecodedCRL(dcrl);
|
||||
InitDecodedCRL(dcrl, crl->heap);
|
||||
ret = ParseCRL(dcrl, myBuffer, (word32)sz, crl->cm);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("ParseCRL error");
|
||||
@@ -865,7 +868,7 @@ int LoadCRL(WOLFSSL_CRL* crl, const char* path, int type, int monitor)
|
||||
WOLFSSL_MSG("monitor path requested");
|
||||
|
||||
pathLen = (word32)XSTRLEN(path);
|
||||
pathBuf = (char*)XMALLOC(pathLen+1, NULL, DYNAMIC_TYPE_CRL_MONITOR);
|
||||
pathBuf = (char*)XMALLOC(pathLen+1, crl->heap,DYNAMIC_TYPE_CRL_MONITOR);
|
||||
if (pathBuf) {
|
||||
XSTRNCPY(pathBuf, path, pathLen);
|
||||
pathBuf[pathLen] = '\0'; /* Null Terminate */
|
||||
|
||||
@@ -81,6 +81,10 @@ if BUILD_AES
|
||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/aes.c
|
||||
endif
|
||||
|
||||
if BUILD_CMAC
|
||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/cmac.c
|
||||
endif
|
||||
|
||||
if BUILD_DES3
|
||||
src_libwolfssl_la_SOURCES += wolfcrypt/src/des3.c
|
||||
endif
|
||||
|
||||
703
src/internal.c
703
src/internal.c
File diff suppressed because it is too large
Load Diff
170
src/io.c
170
src/io.c
@@ -550,6 +550,142 @@ int EmbedGenerateCookie(WOLFSSL* ssl, byte *buf, int sz, void *ctx)
|
||||
return sz;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SESSION_EXPORT
|
||||
#ifndef XINET_NTOP
|
||||
#define XINET_NTOP(a,b,c,d) inet_ntop((a),(b),(c),(d))
|
||||
#endif
|
||||
#ifndef XINET_PTON
|
||||
#define XINET_PTON(a,b,c) inet_pton((a),(b),(c))
|
||||
#endif
|
||||
#ifndef XHTONS
|
||||
#define XHTONS(a) htons((a))
|
||||
#endif
|
||||
#ifndef XNTOHS
|
||||
#define XNTOHS(a) ntohs((a))
|
||||
#endif
|
||||
|
||||
#ifndef WOLFSSL_IP4
|
||||
#define WOLFSSL_IP4 AF_INET
|
||||
#endif
|
||||
#ifndef WOLFSSL_IP6
|
||||
#define WOLFSSL_IP6 AF_INET6
|
||||
#endif
|
||||
|
||||
typedef struct sockaddr_storage SOCKADDR_S;
|
||||
typedef struct sockaddr_in SOCKADDR_IN;
|
||||
typedef struct sockaddr_in6 SOCKADDR_IN6;
|
||||
|
||||
/* get the peer information in human readable form (ip, port, family)
|
||||
* default function assumes BSD sockets
|
||||
* can be overriden with wolfSSL_CTX_SetIOGetPeer
|
||||
*/
|
||||
int EmbedGetPeer(WOLFSSL* ssl, char* ip, int* ipSz,
|
||||
unsigned short* port, int* fam)
|
||||
{
|
||||
SOCKADDR_S peer;
|
||||
word32 peerSz;
|
||||
int ret;
|
||||
|
||||
if (ssl == NULL || ip == NULL || ipSz == NULL ||
|
||||
port == NULL || fam == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* get peer information stored in ssl struct */
|
||||
peerSz = sizeof(SOCKADDR_S);
|
||||
if ((ret = wolfSSL_dtls_get_peer(ssl, (void*)&peer, &peerSz))
|
||||
!= SSL_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* extract family, ip, and port */
|
||||
*fam = ((SOCKADDR_S*)&peer)->ss_family;
|
||||
switch (*fam) {
|
||||
case WOLFSSL_IP4:
|
||||
if (XINET_NTOP(*fam, &(((SOCKADDR_IN*)&peer)->sin_addr),
|
||||
ip, *ipSz) == NULL) {
|
||||
WOLFSSL_MSG("XINET_NTOP error");
|
||||
return SOCKET_ERROR_E;
|
||||
}
|
||||
*port = XNTOHS(((SOCKADDR_IN*)&peer)->sin_port);
|
||||
break;
|
||||
|
||||
case WOLFSSL_IP6:
|
||||
if (XINET_NTOP(*fam, &(((SOCKADDR_IN6*)&peer)->sin6_addr),
|
||||
ip, *ipSz) == NULL) {
|
||||
WOLFSSL_MSG("XINET_NTOP error");
|
||||
return SOCKET_ERROR_E;
|
||||
}
|
||||
*port = XNTOHS(((SOCKADDR_IN6*)&peer)->sin6_port);
|
||||
break;
|
||||
|
||||
default:
|
||||
WOLFSSL_MSG("Unknown family type");
|
||||
return SOCKET_ERROR_E;
|
||||
}
|
||||
ip[*ipSz - 1] = '\0'; /* make sure has terminator */
|
||||
*ipSz = (word16)XSTRLEN(ip);
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
/* set the peer information in human readable form (ip, port, family)
|
||||
* default function assumes BSD sockets
|
||||
* can be overriden with wolfSSL_CTX_SetIOSetPeer
|
||||
*/
|
||||
int EmbedSetPeer(WOLFSSL* ssl, char* ip, int ipSz,
|
||||
unsigned short port, int fam)
|
||||
{
|
||||
int ret;
|
||||
SOCKADDR_S addr;
|
||||
|
||||
/* sanity checks on arguments */
|
||||
if (ssl == NULL || ip == NULL || ipSz < 0 || ipSz > DTLS_EXPORT_IP) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
addr.ss_family = fam;
|
||||
switch (addr.ss_family) {
|
||||
case WOLFSSL_IP4:
|
||||
if (XINET_PTON(addr.ss_family, ip,
|
||||
&(((SOCKADDR_IN*)&addr)->sin_addr)) <= 0) {
|
||||
WOLFSSL_MSG("XINET_PTON error");
|
||||
return SOCKET_ERROR_E;
|
||||
}
|
||||
((SOCKADDR_IN*)&addr)->sin_port = XHTONS(port);
|
||||
|
||||
/* peer sa is free'd in SSL_ResourceFree */
|
||||
if ((ret = wolfSSL_dtls_set_peer(ssl, (SOCKADDR_IN*)&addr,
|
||||
sizeof(SOCKADDR_IN)))!= SSL_SUCCESS) {
|
||||
WOLFSSL_MSG("Import DTLS peer info error");
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
case WOLFSSL_IP6:
|
||||
if (XINET_PTON(addr.ss_family, ip,
|
||||
&(((SOCKADDR_IN6*)&addr)->sin6_addr)) <= 0) {
|
||||
WOLFSSL_MSG("XINET_PTON error");
|
||||
return SOCKET_ERROR_E;
|
||||
}
|
||||
((SOCKADDR_IN6*)&addr)->sin6_port = XHTONS(port);
|
||||
|
||||
/* peer sa is free'd in SSL_ResourceFree */
|
||||
if ((ret = wolfSSL_dtls_set_peer(ssl, (SOCKADDR_IN6*)&addr,
|
||||
sizeof(SOCKADDR_IN6)))!= SSL_SUCCESS) {
|
||||
WOLFSSL_MSG("Import DTLS peer info error");
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
WOLFSSL_MSG("Unknown address family");
|
||||
return BUFFER_E;
|
||||
}
|
||||
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
#endif /* WOLFSSL_SESSION_EXPORT */
|
||||
#endif /* WOLFSSL_DTLS */
|
||||
|
||||
#ifdef HAVE_OCSP
|
||||
@@ -779,7 +915,7 @@ static int decode_url(const char* url, int urlSz,
|
||||
/* return: >0 OCSP Response Size
|
||||
* -1 error */
|
||||
static int process_http_response(int sfd, byte** respBuf,
|
||||
byte* httpBuf, int httpBufSz)
|
||||
byte* httpBuf, int httpBufSz, void* heap)
|
||||
{
|
||||
int result;
|
||||
int len = 0;
|
||||
@@ -868,7 +1004,7 @@ static int process_http_response(int sfd, byte** respBuf,
|
||||
}
|
||||
} while (state != phr_http_end);
|
||||
|
||||
recvBuf = (byte*)XMALLOC(recvBufSz, NULL, DYNAMIC_TYPE_OCSP);
|
||||
recvBuf = (byte*)XMALLOC(recvBufSz, heap, DYNAMIC_TYPE_OCSP);
|
||||
if (recvBuf == NULL) {
|
||||
WOLFSSL_MSG("process_http_response couldn't create response buffer");
|
||||
return -1;
|
||||
@@ -896,6 +1032,7 @@ static int process_http_response(int sfd, byte** respBuf,
|
||||
|
||||
#define SCRATCH_BUFFER_SIZE 512
|
||||
|
||||
/* in default wolfSSL callback ctx is the heap pointer */
|
||||
int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
||||
byte* ocspReqBuf, int ocspReqSz, byte** ocspRespBuf)
|
||||
{
|
||||
@@ -922,8 +1059,6 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)ctx;
|
||||
|
||||
if (ocspReqBuf == NULL || ocspReqSz == 0) {
|
||||
WOLFSSL_MSG("OCSP request is required for lookup");
|
||||
}
|
||||
@@ -937,7 +1072,7 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
||||
/* Note, the library uses the EmbedOcspRespFree() callback to
|
||||
* free this buffer. */
|
||||
int httpBufSz = SCRATCH_BUFFER_SIZE;
|
||||
byte* httpBuf = (byte*)XMALLOC(httpBufSz, NULL,
|
||||
byte* httpBuf = (byte*)XMALLOC(httpBufSz, ctx,
|
||||
DYNAMIC_TYPE_OCSP);
|
||||
|
||||
if (httpBuf == NULL) {
|
||||
@@ -960,11 +1095,11 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
||||
}
|
||||
else {
|
||||
ret = process_http_response(sfd, ocspRespBuf, httpBuf,
|
||||
SCRATCH_BUFFER_SIZE);
|
||||
SCRATCH_BUFFER_SIZE, ctx);
|
||||
}
|
||||
|
||||
close(sfd);
|
||||
XFREE(httpBuf, NULL, DYNAMIC_TYPE_OCSP);
|
||||
XFREE(httpBuf, ctx, DYNAMIC_TYPE_OCSP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,12 +1112,13 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
||||
}
|
||||
|
||||
|
||||
/* in default callback ctx is heap hint */
|
||||
void EmbedOcspRespFree(void* ctx, byte *resp)
|
||||
{
|
||||
(void)ctx;
|
||||
|
||||
if (resp)
|
||||
XFREE(resp, NULL, DYNAMIC_TYPE_OCSP);
|
||||
XFREE(resp, ctx, DYNAMIC_TYPE_OCSP);
|
||||
|
||||
(void)ctx;
|
||||
}
|
||||
|
||||
|
||||
@@ -1066,6 +1202,20 @@ WOLFSSL_API void* wolfSSL_GetCookieCtx(WOLFSSL* ssl)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_SESSION_EXPORT
|
||||
|
||||
WOLFSSL_API void wolfSSL_CTX_SetIOGetPeer(WOLFSSL_CTX* ctx, CallbackGetPeer cb)
|
||||
{
|
||||
ctx->CBGetPeer = cb;
|
||||
}
|
||||
|
||||
|
||||
WOLFSSL_API void wolfSSL_CTX_SetIOSetPeer(WOLFSSL_CTX* ctx, CallbackSetPeer cb)
|
||||
{
|
||||
ctx->CBSetPeer = cb;
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_SESSION_EXPORT */
|
||||
#endif /* WOLFSSL_DTLS */
|
||||
|
||||
|
||||
|
||||
33
src/ocsp.c
33
src/ocsp.c
@@ -71,7 +71,7 @@ static int InitOcspEntry(OcspEntry* entry, OcspRequest* request)
|
||||
}
|
||||
|
||||
|
||||
static void FreeOcspEntry(OcspEntry* entry)
|
||||
static void FreeOcspEntry(OcspEntry* entry, void* heap)
|
||||
{
|
||||
CertStatus *status, *next;
|
||||
|
||||
@@ -81,10 +81,12 @@ static void FreeOcspEntry(OcspEntry* entry)
|
||||
next = status->next;
|
||||
|
||||
if (status->rawOcspResponse)
|
||||
XFREE(status->rawOcspResponse, NULL, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
XFREE(status->rawOcspResponse, heap, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
|
||||
XFREE(status, NULL, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
XFREE(status, heap, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
}
|
||||
|
||||
(void)heap;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,14 +98,15 @@ void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
|
||||
|
||||
for (entry = ocsp->ocspList; entry; entry = next) {
|
||||
next = entry->next;
|
||||
FreeOcspEntry(entry);
|
||||
XFREE(entry, NULL, DYNAMIC_TYPE_OCSP_ENTRY);
|
||||
FreeOcspEntry(entry, ocsp->cm->heap);
|
||||
XFREE(entry, ocsp->cm->heap, DYNAMIC_TYPE_OCSP_ENTRY);
|
||||
}
|
||||
|
||||
FreeMutex(&ocsp->ocspLock);
|
||||
|
||||
if (dynamic)
|
||||
XFREE(ocsp, NULL, DYNAMIC_TYPE_OCSP);
|
||||
XFREE(ocsp, ocsp->cm->heap, DYNAMIC_TYPE_OCSP);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +145,8 @@ int CheckCertOCSP(WOLFSSL_OCSP* ocsp, DecodedCert* cert, buffer* responseBuffer)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (InitOcspRequest(ocspRequest, cert, ocsp->cm->ocspSendNonce) == 0) {
|
||||
if (InitOcspRequest(ocspRequest, cert, ocsp->cm->ocspSendNonce,
|
||||
ocsp->cm->heap) == 0) {
|
||||
ret = CheckOcspRequest(ocsp, ocspRequest, responseBuffer);
|
||||
|
||||
FreeOcspRequest(ocspRequest);
|
||||
@@ -177,7 +181,7 @@ static int GetOcspEntry(WOLFSSL_OCSP* ocsp, OcspRequest* request,
|
||||
|
||||
if (*entry == NULL) {
|
||||
*entry = (OcspEntry*)XMALLOC(sizeof(OcspEntry),
|
||||
NULL, DYNAMIC_TYPE_OCSP_ENTRY);
|
||||
ocsp->cm->heap, DYNAMIC_TYPE_OCSP_ENTRY);
|
||||
if (*entry) {
|
||||
InitOcspEntry(*entry, request);
|
||||
(*entry)->next = ocsp->ocspList;
|
||||
@@ -291,7 +295,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
return 0;
|
||||
}
|
||||
|
||||
request = (byte*)XMALLOC(requestSz, NULL, DYNAMIC_TYPE_OCSP);
|
||||
request = (byte*)XMALLOC(requestSz, ocsp->cm->heap, DYNAMIC_TYPE_OCSP);
|
||||
if (request == NULL) {
|
||||
WOLFSSL_LEAVE("CheckCertOCSP", MEMORY_ERROR);
|
||||
return MEMORY_ERROR;
|
||||
@@ -324,14 +328,14 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
XMEMSET(newStatus, 0, sizeof(CertStatus));
|
||||
|
||||
InitOcspResponse(ocspResponse, newStatus, response, ret);
|
||||
OcspResponseDecode(ocspResponse, ocsp->cm);
|
||||
OcspResponseDecode(ocspResponse, ocsp->cm, ocsp->cm->heap);
|
||||
|
||||
if (ocspResponse->responseStatus != OCSP_SUCCESSFUL)
|
||||
ret = OCSP_LOOKUP_FAIL;
|
||||
else {
|
||||
if (CompareOcspReqResp(ocspRequest, ocspResponse) == 0) {
|
||||
if (responseBuffer) {
|
||||
responseBuffer->buffer = (byte*)XMALLOC(ret, NULL,
|
||||
responseBuffer->buffer = (byte*)XMALLOC(ret, ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
if (responseBuffer->buffer) {
|
||||
@@ -347,7 +351,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
else {
|
||||
if (status != NULL) {
|
||||
if (status->rawOcspResponse)
|
||||
XFREE(status->rawOcspResponse, NULL,
|
||||
XFREE(status->rawOcspResponse, ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_OCSP_STATUS);
|
||||
|
||||
/* Replace existing certificate entry with updated */
|
||||
@@ -356,7 +360,7 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
else {
|
||||
/* Save new certificate entry */
|
||||
status = (CertStatus*)XMALLOC(sizeof(CertStatus),
|
||||
NULL, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
ocsp->cm->heap, DYNAMIC_TYPE_OCSP_STATUS);
|
||||
if (status != NULL) {
|
||||
XMEMCPY(status, newStatus, sizeof(CertStatus));
|
||||
status->next = entry->status;
|
||||
@@ -367,7 +371,8 @@ int CheckOcspRequest(WOLFSSL_OCSP* ocsp, OcspRequest* ocspRequest,
|
||||
|
||||
if (status && responseBuffer && responseBuffer->buffer) {
|
||||
status->rawOcspResponse = (byte*)XMALLOC(
|
||||
responseBuffer->length, NULL,
|
||||
responseBuffer->length,
|
||||
ocsp->cm->heap,
|
||||
DYNAMIC_TYPE_OCSP_STATUS);
|
||||
|
||||
if (status->rawOcspResponse) {
|
||||
|
||||
@@ -1560,7 +1560,7 @@ static int ProcessServerHello(const byte* input, int* sslBytes,
|
||||
if (doResume ) {
|
||||
int ret = 0;
|
||||
SSL_SESSION* resume = GetSession(session->sslServer,
|
||||
session->sslServer->arrays->masterSecret);
|
||||
session->sslServer->arrays->masterSecret, 0);
|
||||
if (resume == NULL) {
|
||||
SetError(BAD_SESSION_RESUME_STR, error, session, FATAL_ERROR_STATE);
|
||||
return -1;
|
||||
@@ -1825,7 +1825,7 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes,
|
||||
|
||||
if (ret == 0 && session->flags.cached == 0) {
|
||||
if (session->sslServer->options.haveSessionId) {
|
||||
WOLFSSL_SESSION* sess = GetSession(session->sslServer, NULL);
|
||||
WOLFSSL_SESSION* sess = GetSession(session->sslServer, NULL, 0);
|
||||
if (sess == NULL)
|
||||
AddSession(session->sslServer); /* don't re add */
|
||||
session->flags.cached = 1;
|
||||
|
||||
@@ -5,6 +5,6 @@ includedir=${prefix}/include
|
||||
|
||||
Name: wolfssl
|
||||
Description: wolfssl C library.
|
||||
Version: 3.9.1
|
||||
Version: 3.9.6
|
||||
Libs: -L${libdir} -lwolfssl
|
||||
Cflags: -I${includedir}
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#if defined(WOLFSSL_STATIC_MEMORY)
|
||||
#include <wolfssl/wolfcrypt/memory.h>
|
||||
#endif /* WOLFSSL_STATIC_MEMORY */
|
||||
#ifdef HAVE_ECC
|
||||
#include <wolfssl/wolfcrypt/ecc.h> /* wc_ecc_fp_free */
|
||||
#endif
|
||||
@@ -2404,7 +2407,7 @@ static void verify_ALPN_client_list(WOLFSSL* ssl)
|
||||
AssertIntEQ(1, sizeof(alpn_list) == clistSz);
|
||||
AssertIntEQ(0, XMEMCMP(alpn_list, clist, clistSz));
|
||||
|
||||
XFREE(clist, 0, DYNAMIC_TYPE_TLSX);
|
||||
AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_FreePeerProtocol(ssl, &clist));
|
||||
}
|
||||
|
||||
static void test_wolfSSL_UseALPN_connection(void)
|
||||
|
||||
@@ -469,6 +469,10 @@ int SuiteTest(void)
|
||||
args.argv = myArgv;
|
||||
strcpy(argv0[0], "SuiteTest");
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
byte memory[200000];
|
||||
#endif
|
||||
|
||||
(void)test_harness;
|
||||
|
||||
cipherSuiteCtx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
|
||||
@@ -477,6 +481,16 @@ int SuiteTest(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* load in static memory buffer if enabled */
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
if (wolfSSL_CTX_load_static_memory(&cipherSuiteCtx, NULL,
|
||||
memory, sizeof(memory), 0, 1)
|
||||
!= SSL_SUCCESS) {
|
||||
printf("unable to load static memory and create ctx");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* default case */
|
||||
args.argc = 1;
|
||||
printf("starting default cipher suite tests\n");
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include <wolfssl/wolfcrypt/rsa.h>
|
||||
#include <wolfssl/wolfcrypt/asn.h>
|
||||
#include <wolfssl/wolfcrypt/ripemd.h>
|
||||
#include <wolfssl/wolfcrypt/cmac.h>
|
||||
#ifdef HAVE_ECC
|
||||
#include <wolfssl/wolfcrypt/ecc.h>
|
||||
#endif
|
||||
@@ -157,6 +158,7 @@ void bench_sha256(void);
|
||||
void bench_sha384(void);
|
||||
void bench_sha512(void);
|
||||
void bench_ripemd(void);
|
||||
void bench_cmac(void);
|
||||
|
||||
void bench_rsa(void);
|
||||
void bench_rsaKeyGen(void);
|
||||
@@ -374,6 +376,9 @@ int benchmark_test(void *args)
|
||||
#ifdef HAVE_BLAKE2
|
||||
bench_blake2();
|
||||
#endif
|
||||
#ifdef WOLFSSL_CMAC
|
||||
bench_cmac();
|
||||
#endif
|
||||
|
||||
printf("\n");
|
||||
|
||||
@@ -1318,6 +1323,55 @@ void bench_blake2(void)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WOLFSSL_CMAC
|
||||
|
||||
void bench_cmac(void)
|
||||
{
|
||||
Cmac cmac;
|
||||
byte digest[AES_BLOCK_SIZE];
|
||||
word32 digestSz = sizeof(digest);
|
||||
double start, total, persec;
|
||||
int i, ret;
|
||||
|
||||
ret = wc_InitCmac(&cmac, key, 16, WC_CMAC_AES, NULL);
|
||||
if (ret != 0) {
|
||||
printf("InitCmac failed, ret = %d\n", ret);
|
||||
return;
|
||||
}
|
||||
start = current_time(1);
|
||||
BEGIN_INTEL_CYCLES
|
||||
|
||||
for(i = 0; i < numBlocks; i++) {
|
||||
ret = wc_CmacUpdate(&cmac, plain, sizeof(plain));
|
||||
if (ret != 0) {
|
||||
printf("CmacUpdate failed, ret = %d\n", ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ret = wc_CmacFinal(&cmac, digest, &digestSz);
|
||||
if (ret != 0) {
|
||||
printf("CmacFinal failed, ret = %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
END_INTEL_CYCLES
|
||||
total = current_time(0) - start;
|
||||
persec = 1 / total * numBlocks;
|
||||
#ifdef BENCH_EMBEDDED
|
||||
/* since using kB, convert to MB/s */
|
||||
persec = persec / 1024;
|
||||
#endif
|
||||
|
||||
printf("AES-CMAC %d %s took %5.3f seconds, %8.3f MB/s", numBlocks,
|
||||
blockType, total, persec);
|
||||
SHOW_INTEL_CYCLES
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_CMAC */
|
||||
|
||||
|
||||
#ifndef NO_RSA
|
||||
|
||||
|
||||
|
||||
@@ -1231,7 +1231,7 @@ static void wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
||||
/* check alignment, decrypt doesn't need alignment */
|
||||
if ((wolfssl_word)inBlock % 16) {
|
||||
#ifndef NO_WOLFSSL_ALLOC_ALIGN
|
||||
byte* tmp = (byte*)XMALLOC(AES_BLOCK_SIZE, NULL,
|
||||
byte* tmp = (byte*)XMALLOC(AES_BLOCK_SIZE, aes->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (tmp == NULL) return;
|
||||
|
||||
@@ -1239,7 +1239,7 @@ static void wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
|
||||
AES_ECB_encrypt(tmp, tmp, AES_BLOCK_SIZE, (byte*)aes->key,
|
||||
aes->rounds);
|
||||
XMEMCPY(outBlock, tmp, AES_BLOCK_SIZE);
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, aes->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return;
|
||||
#else
|
||||
WOLFSSL_MSG("AES-ECB encrypt with bad alignment");
|
||||
@@ -1924,6 +1924,18 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
}
|
||||
|
||||
|
||||
/* set the heap hint for aes struct */
|
||||
int wc_InitAes_h(Aes* aes, void* h)
|
||||
{
|
||||
if (aes == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
aes->heap = h;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* AES-DIRECT */
|
||||
@@ -2498,7 +2510,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
/* check alignment, decrypt doesn't need alignment */
|
||||
if ((wolfssl_word)in % 16) {
|
||||
#ifndef NO_WOLFSSL_ALLOC_ALIGN
|
||||
byte* tmp = (byte*)XMALLOC(sz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
byte* tmp = (byte*)XMALLOC(sz, aes->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
WOLFSSL_MSG("AES-CBC encrypt with bad alignment");
|
||||
if (tmp == NULL) return MEMORY_E;
|
||||
|
||||
@@ -2509,7 +2521,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
XMEMCPY(aes->reg, tmp + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
|
||||
XMEMCPY(out, tmp, sz);
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, aes->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return 0;
|
||||
#else
|
||||
return BAD_ALIGN_E;
|
||||
|
||||
@@ -136,7 +136,7 @@ __asm__( \
|
||||
"adcl $0,%%edx \n\t" \
|
||||
"movl %%edx,%1 \n\t" \
|
||||
:"=g"(_c[LO]), "=r"(cy) \
|
||||
:"0"(_c[LO]), "1"(cy), "g"(mu), "g"(*tmpm++) \
|
||||
:"0"(_c[LO]), "1"(cy), "r"(mu), "r"(*tmpm++) \
|
||||
: "%eax", "%edx", "cc")
|
||||
|
||||
#define PROPCARRY \
|
||||
@@ -536,22 +536,18 @@ __asm__( \
|
||||
__asm__( \
|
||||
" mullw 16,%3,%4 \n\t" \
|
||||
" mulhwu 17,%3,%4 \n\t" \
|
||||
" addc 16,16,%0 \n\t" \
|
||||
" addc 16,16,%2 \n\t" \
|
||||
" addze 17,17 \n\t" \
|
||||
" lwz 18,%1 \n\t" \
|
||||
" addc 16,16,18 \n\t" \
|
||||
" addc %1,16,%5 \n\t" \
|
||||
" addze %0,17 \n\t" \
|
||||
" stw 16,%1 \n\t" \
|
||||
:"=r"(cy),"=m"(_c[0]):"0"(cy),"r"(mu),"r"(tmpm[0]),"1"(_c[0]):"16", "17", "18","cc"); ++tmpm;
|
||||
:"=r"(cy),"=r"(_c[0]):"0"(cy),"r"(mu),"r"(tmpm[0]),"1"(_c[0]):"16", "17", "cc"); ++tmpm;
|
||||
|
||||
#define PROPCARRY \
|
||||
__asm__( \
|
||||
" lwz 16,%1 \n\t" \
|
||||
" addc 16,16,%0 \n\t" \
|
||||
" stw 16,%1 \n\t" \
|
||||
" xor %0,%0,%0 \n\t" \
|
||||
" addze %0,%0 \n\t" \
|
||||
:"=r"(cy),"=m"(_c[0]):"0"(cy),"1"(_c[0]):"16","cc");
|
||||
" addc %1,%3,%2 \n\t" \
|
||||
" xor %0,%2,%2 \n\t" \
|
||||
" addze %0,%2 \n\t" \
|
||||
:"=r"(cy),"=r"(_c[0]):"0"(cy),"1"(_c[0]):"cc");
|
||||
|
||||
#elif defined(TFM_PPC64)
|
||||
|
||||
@@ -740,7 +736,7 @@ __asm__( \
|
||||
"addq %%rax,%0 \n\t" \
|
||||
"adcq %%rdx,%1 \n\t" \
|
||||
"adcq $0,%2 \n\t" \
|
||||
:"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "g"(i) :"%rax","%rdx","cc");
|
||||
:"=r"(c0), "=r"(c1), "=r"(c2): "0"(c0), "1"(c1), "2"(c2), "x"(i) :"%rax","%rdx","cc");
|
||||
|
||||
#define SQRADD2(i, j) \
|
||||
__asm__( \
|
||||
|
||||
@@ -1949,12 +1949,14 @@ static mp_int* GetDsaInt(DsaKey* key, int idx)
|
||||
}
|
||||
|
||||
/* Release Tmp DSA resources */
|
||||
static INLINE void FreeTmpDsas(byte** tmps)
|
||||
static INLINE void FreeTmpDsas(byte** tmps, void* heap)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < DSA_INTS; i++)
|
||||
XFREE(tmps[i], NULL, DYNAMIC_TYPE_DSA);
|
||||
XFREE(tmps[i], heap, DYNAMIC_TYPE_DSA);
|
||||
|
||||
(void)heap;
|
||||
}
|
||||
|
||||
/* Convert DsaKey key to DER format, write to output (inLen), return bytes
|
||||
@@ -1986,7 +1988,8 @@ int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen)
|
||||
lbit = mp_leading_bit(keyInt);
|
||||
rawLen = mp_unsigned_bin_size(keyInt) + lbit;
|
||||
|
||||
tmps[i] = (byte*)XMALLOC(rawLen + MAX_SEQ_SZ, NULL, DYNAMIC_TYPE_DSA);
|
||||
tmps[i] = (byte*)XMALLOC(rawLen + MAX_SEQ_SZ, key->heap,
|
||||
DYNAMIC_TYPE_DSA);
|
||||
if (tmps[i] == NULL) {
|
||||
ret = MEMORY_E;
|
||||
break;
|
||||
@@ -2019,7 +2022,7 @@ int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen)
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
FreeTmpDsas(tmps);
|
||||
FreeTmpDsas(tmps, key->heap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2041,7 +2044,7 @@ int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen)
|
||||
XMEMCPY(output + j, tmps[i], sizes[i]);
|
||||
j += sizes[i];
|
||||
}
|
||||
FreeTmpDsas(tmps);
|
||||
FreeTmpDsas(tmps, key->heap);
|
||||
|
||||
return outLen;
|
||||
}
|
||||
@@ -2220,9 +2223,9 @@ void FreeDecodedCert(DecodedCert* cert)
|
||||
#endif /* WOLFSSL_SEP */
|
||||
#ifdef OPENSSL_EXTRA
|
||||
if (cert->issuerName.fullName != NULL)
|
||||
XFREE(cert->issuerName.fullName, NULL, DYNAMIC_TYPE_X509);
|
||||
XFREE(cert->issuerName.fullName, cert->heap, DYNAMIC_TYPE_X509);
|
||||
if (cert->subjectName.fullName != NULL)
|
||||
XFREE(cert->subjectName.fullName, NULL, DYNAMIC_TYPE_X509);
|
||||
XFREE(cert->subjectName.fullName, cert->heap, DYNAMIC_TYPE_X509);
|
||||
#endif /* OPENSSL_EXTRA */
|
||||
}
|
||||
|
||||
@@ -2858,7 +2861,8 @@ static int GetName(DecodedCert* cert, int nameType)
|
||||
if (dName->serialLen != 0)
|
||||
totalLen += dName->serialLen + 14;
|
||||
|
||||
dName->fullName = (char*)XMALLOC(totalLen + 1, NULL, DYNAMIC_TYPE_X509);
|
||||
dName->fullName = (char*)XMALLOC(totalLen + 1, cert->heap,
|
||||
DYNAMIC_TYPE_X509);
|
||||
if (dName->fullName != NULL) {
|
||||
idx = 0;
|
||||
|
||||
@@ -3086,6 +3090,22 @@ int ValidateDate(const byte* date, byte format, int dateType)
|
||||
}
|
||||
#endif /* !NO_TIME_H && USE_WOLF_VALIDDATE */
|
||||
|
||||
int wc_GetTime(void* timePtr, word32 timeSize)
|
||||
{
|
||||
time_t* ltime = (time_t*)timePtr;
|
||||
|
||||
if (timePtr == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if ((word32)sizeof(time_t) > timeSize) {
|
||||
return BUFFER_E;
|
||||
}
|
||||
|
||||
*ltime = XTIME(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int GetDate(DecodedCert* cert, int dateType)
|
||||
{
|
||||
@@ -5825,6 +5845,11 @@ void wc_InitCert(Cert* cert)
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
cert->challengePw[0] ='\0';
|
||||
#endif
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
cert->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
#else
|
||||
cert->heap = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -6447,7 +6472,8 @@ static int SetSKID(byte* output, word32 outSz, byte *input, word32 length)
|
||||
|
||||
/* encode Authority Key Identifier, return total bytes written
|
||||
* RFC5280 : non-critical */
|
||||
static int SetAKID(byte* output, word32 outSz, byte *input, word32 length)
|
||||
static int SetAKID(byte* output, word32 outSz,
|
||||
byte *input, word32 length, void* heap)
|
||||
{
|
||||
byte *enc_val;
|
||||
int ret, enc_valSz;
|
||||
@@ -6457,7 +6483,7 @@ static int SetAKID(byte* output, word32 outSz, byte *input, word32 length)
|
||||
if (output == NULL || input == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
enc_val = (byte *)XMALLOC(length+3+sizeof(akid_cs), NULL,
|
||||
enc_val = (byte *)XMALLOC(length+3+sizeof(akid_cs), heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (enc_val == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -6466,14 +6492,14 @@ static int SetAKID(byte* output, word32 outSz, byte *input, word32 length)
|
||||
enc_valSz = SetOidValue(enc_val, length+3+sizeof(akid_cs),
|
||||
akid_cs, sizeof(akid_cs), input, length);
|
||||
if (enc_valSz == 0) {
|
||||
XFREE(enc_val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(enc_val, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = SetOidValue(output, outSz, akid_oid,
|
||||
sizeof(akid_oid), enc_val, enc_valSz);
|
||||
|
||||
XFREE(enc_val, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(enc_val, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -6521,7 +6547,7 @@ static int SetKeyUsage(byte* output, word32 outSz, word16 input)
|
||||
}
|
||||
|
||||
/* Encode OID string representation to ITU-T X.690 format */
|
||||
static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
static int EncodePolicyOID(byte *out, word32 *outSz, const char *in, void* heap)
|
||||
{
|
||||
word32 val, idx = 0, nb_val;
|
||||
char *token, *str, *ptr;
|
||||
@@ -6532,7 +6558,7 @@ static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
|
||||
len = (word32)XSTRLEN(in);
|
||||
|
||||
str = (char *)XMALLOC(len+1, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
str = (char *)XMALLOC(len+1, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (str == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
@@ -6549,7 +6575,7 @@ static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
|
||||
if (nb_val == 0) {
|
||||
if (val > 2) {
|
||||
XFREE(str, NUL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(str, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ASN_OBJECT_ID_E;
|
||||
}
|
||||
|
||||
@@ -6557,12 +6583,12 @@ static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
}
|
||||
else if (nb_val == 1) {
|
||||
if (val > 127) {
|
||||
XFREE(str, NUL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(str, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ASN_OBJECT_ID_E;
|
||||
}
|
||||
|
||||
if (idx > *outSz) {
|
||||
XFREE(str, NUL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(str, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return BUFFER_E;
|
||||
}
|
||||
|
||||
@@ -6580,7 +6606,7 @@ static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
}
|
||||
|
||||
if ((idx+(word32)i) > *outSz) {
|
||||
XFREE(str, NUL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(str, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return BUFFER_E;
|
||||
}
|
||||
|
||||
@@ -6597,7 +6623,7 @@ static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
|
||||
*outSz = idx;
|
||||
|
||||
XFREE(str, NUL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(str, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6608,7 +6634,8 @@ static int EncodePolicyOID(byte *out, word32 *outSz, const char *in)
|
||||
static int SetCertificatePolicies(byte *output,
|
||||
word32 outputSz,
|
||||
char input[MAX_CERTPOL_NB][MAX_CERTPOL_SZ],
|
||||
word16 nb_certpol)
|
||||
word16 nb_certpol,
|
||||
void* heap)
|
||||
{
|
||||
byte oid[MAX_OID_SZ],
|
||||
der_oid[MAX_CERTPOL_NB][MAX_OID_SZ],
|
||||
@@ -6627,7 +6654,7 @@ static int SetCertificatePolicies(byte *output,
|
||||
oidSz = sizeof(oid);
|
||||
XMEMSET(oid, 0, oidSz);
|
||||
|
||||
ret = EncodePolicyOID(oid, &oidSz, input[i]);
|
||||
ret = EncodePolicyOID(oid, &oidSz, input[i], heap);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
@@ -6982,7 +7009,7 @@ static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, ecc_key* eccKey,
|
||||
return AKID_E;
|
||||
|
||||
der->akidSz = SetAKID(der->akid, sizeof(der->akid),
|
||||
cert->akid, cert->akidSz);
|
||||
cert->akid, cert->akidSz, cert->heap);
|
||||
if (der->akidSz <= 0)
|
||||
return AKID_E;
|
||||
|
||||
@@ -7008,7 +7035,8 @@ static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, ecc_key* eccKey,
|
||||
der->certPoliciesSz = SetCertificatePolicies(der->certPolicies,
|
||||
sizeof(der->certPolicies),
|
||||
cert->certPolicies,
|
||||
cert->certPoliciesNb);
|
||||
cert->certPoliciesNb,
|
||||
cert->heap);
|
||||
if (der->certPoliciesSz <= 0)
|
||||
return CERTPOLICIES_E;
|
||||
|
||||
@@ -7679,7 +7707,8 @@ static int SetKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey,
|
||||
(kid_type != SKID_TYPE && kid_type != AKID_TYPE))
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
buffer = (byte *)XMALLOC(MAX_PUBLIC_KEY_SZ, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
buffer = (byte *)XMALLOC(MAX_PUBLIC_KEY_SZ, cert->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (buffer == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
@@ -7705,7 +7734,7 @@ static int SetKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey,
|
||||
bufferSz = -1;
|
||||
|
||||
if (bufferSz <= 0) {
|
||||
XFREE(buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buffer, cert->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return PUBLIC_KEY_E;
|
||||
}
|
||||
|
||||
@@ -7734,7 +7763,7 @@ static int SetKeyIdFromPublicKey(Cert *cert, RsaKey *rsakey, ecc_key *eckey,
|
||||
ret = BAD_FUNC_ARG;
|
||||
#endif /* NO_SHA */
|
||||
|
||||
XFREE(buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buffer, cert->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -7774,7 +7803,7 @@ int wc_SetSubjectKeyId(Cert *cert, const char* file)
|
||||
if (cert == NULL || file == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
der = (byte*)XMALLOC(MAX_PUBLIC_KEY_SZ, NULL, DYNAMIC_TYPE_CERT);
|
||||
der = (byte*)XMALLOC(MAX_PUBLIC_KEY_SZ, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
if (der == NULL) {
|
||||
WOLFSSL_MSG("wc_SetSubjectKeyId memory Problem");
|
||||
return MEMORY_E;
|
||||
@@ -7783,21 +7812,21 @@ int wc_SetSubjectKeyId(Cert *cert, const char* file)
|
||||
derSz = wolfSSL_PemPubKeyToDer(file, der, MAX_PUBLIC_KEY_SZ);
|
||||
if (derSz <= 0)
|
||||
{
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return derSz;
|
||||
}
|
||||
|
||||
/* Load PubKey in internal structure */
|
||||
rsakey = (RsaKey*) XMALLOC(sizeof(RsaKey), NULL, DYNAMIC_TYPE_RSA);
|
||||
rsakey = (RsaKey*) XMALLOC(sizeof(RsaKey), cert->heap, DYNAMIC_TYPE_RSA);
|
||||
if (rsakey == NULL) {
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
if (wc_InitRsaKey(rsakey, NULL) != 0) {
|
||||
if (wc_InitRsaKey(rsakey, cert->heap) != 0) {
|
||||
WOLFSSL_MSG("wc_InitRsaKey failure");
|
||||
XFREE(rsakey, NULL, DYNAMIC_TYPE_RSA);
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(rsakey, cert->heap, DYNAMIC_TYPE_RSA);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
@@ -7806,21 +7835,22 @@ int wc_SetSubjectKeyId(Cert *cert, const char* file)
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("wc_RsaPublicKeyDecode failed");
|
||||
wc_FreeRsaKey(rsakey);
|
||||
XFREE(rsakey, NULL, DYNAMIC_TYPE_RSA);
|
||||
XFREE(rsakey, cert->heap, DYNAMIC_TYPE_RSA);
|
||||
rsakey = NULL;
|
||||
#ifdef HAVE_ECC
|
||||
/* Check to load ecc public key */
|
||||
eckey = (ecc_key*) XMALLOC(sizeof(ecc_key), NULL, DYNAMIC_TYPE_ECC);
|
||||
eckey = (ecc_key*) XMALLOC(sizeof(ecc_key), cert->heap,
|
||||
DYNAMIC_TYPE_ECC);
|
||||
if (eckey == NULL) {
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
if (wc_ecc_init(eckey) != 0) {
|
||||
WOLFSSL_MSG("wc_ecc_init failure");
|
||||
wc_ecc_free(eckey);
|
||||
XFREE(eckey, NULL, DYNAMIC_TYPE_ECC);
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(eckey, cert->heap, DYNAMIC_TYPE_ECC);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
@@ -7828,25 +7858,25 @@ int wc_SetSubjectKeyId(Cert *cert, const char* file)
|
||||
ret = wc_EccPublicKeyDecode(der, &idx, eckey, derSz);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("wc_EccPublicKeyDecode failed");
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
wc_ecc_free(eckey);
|
||||
return PUBLIC_KEY_E;
|
||||
}
|
||||
#else
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return PUBLIC_KEY_E;
|
||||
#endif /* HAVE_ECC */
|
||||
}
|
||||
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
ret = wc_SetSubjectKeyIdFromPublicKey(cert, rsakey, eckey);
|
||||
|
||||
wc_FreeRsaKey(rsakey);
|
||||
XFREE(rsakey, NULL, DYNAMIC_TYPE_RSA);
|
||||
XFREE(rsakey, cert->heap, DYNAMIC_TYPE_RSA);
|
||||
#ifdef HAVE_ECC
|
||||
wc_ecc_free(eckey);
|
||||
XFREE(eckey, NULL, DYNAMIC_TYPE_ECC);
|
||||
XFREE(eckey, cert->heap, DYNAMIC_TYPE_ECC);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
@@ -7915,7 +7945,7 @@ int wc_SetAuthKeyId(Cert *cert, const char* file)
|
||||
if (cert == NULL || file == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
der = (byte*)XMALLOC(EIGHTK_BUF, NULL, DYNAMIC_TYPE_CERT);
|
||||
der = (byte*)XMALLOC(EIGHTK_BUF, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
if (der == NULL) {
|
||||
WOLFSSL_MSG("wc_SetAuthKeyId OOF Problem");
|
||||
return MEMORY_E;
|
||||
@@ -7924,12 +7954,12 @@ int wc_SetAuthKeyId(Cert *cert, const char* file)
|
||||
derSz = wolfSSL_PemCertToDer(file, der, EIGHTK_BUF);
|
||||
if (derSz <= 0)
|
||||
{
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
return derSz;
|
||||
}
|
||||
|
||||
ret = wc_SetAuthKeyIdFromCert(cert, der, derSz);
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -7947,7 +7977,8 @@ int wc_SetKeyUsage(Cert *cert, const char *value)
|
||||
|
||||
cert->keyUsage = 0;
|
||||
|
||||
str = (char *)XMALLOC(XSTRLEN(value)+1, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
str = (char *)XMALLOC(XSTRLEN(value)+1, cert->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (str == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
@@ -7985,7 +8016,7 @@ int wc_SetKeyUsage(Cert *cert, const char *value)
|
||||
token = XSTRTOK(NULL, ",", &ptr);
|
||||
}
|
||||
|
||||
XFREE(str, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(str, cert->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return 0;
|
||||
}
|
||||
#endif /* WOLFSSL_CERT_EXT */
|
||||
@@ -8246,7 +8277,7 @@ int wc_SetIssuer(Cert* cert, const char* issuerFile)
|
||||
{
|
||||
int ret;
|
||||
int derSz;
|
||||
byte* der = (byte*)XMALLOC(EIGHTK_BUF, NULL, DYNAMIC_TYPE_CERT);
|
||||
byte* der = (byte*)XMALLOC(EIGHTK_BUF, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
if (der == NULL) {
|
||||
WOLFSSL_MSG("wc_SetIssuer OOF Problem");
|
||||
@@ -8255,7 +8286,7 @@ int wc_SetIssuer(Cert* cert, const char* issuerFile)
|
||||
derSz = wolfSSL_PemCertToDer(issuerFile, der, EIGHTK_BUF);
|
||||
cert->selfSigned = 0;
|
||||
ret = SetNameFromCert(&cert->issuer, der, derSz);
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -8266,7 +8297,7 @@ int wc_SetSubject(Cert* cert, const char* subjectFile)
|
||||
{
|
||||
int ret;
|
||||
int derSz;
|
||||
byte* der = (byte*)XMALLOC(EIGHTK_BUF, NULL, DYNAMIC_TYPE_CERT);
|
||||
byte* der = (byte*)XMALLOC(EIGHTK_BUF, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
if (der == NULL) {
|
||||
WOLFSSL_MSG("wc_SetSubject OOF Problem");
|
||||
@@ -8274,7 +8305,7 @@ int wc_SetSubject(Cert* cert, const char* subjectFile)
|
||||
}
|
||||
derSz = wolfSSL_PemCertToDer(subjectFile, der, EIGHTK_BUF);
|
||||
ret = SetNameFromCert(&cert->subject, der, derSz);
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -8287,7 +8318,7 @@ int wc_SetAltNames(Cert* cert, const char* file)
|
||||
{
|
||||
int ret;
|
||||
int derSz;
|
||||
byte* der = (byte*)XMALLOC(EIGHTK_BUF, NULL, DYNAMIC_TYPE_CERT);
|
||||
byte* der = (byte*)XMALLOC(EIGHTK_BUF, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
if (der == NULL) {
|
||||
WOLFSSL_MSG("wc_SetAltNames OOF Problem");
|
||||
@@ -8295,7 +8326,7 @@ int wc_SetAltNames(Cert* cert, const char* file)
|
||||
}
|
||||
derSz = wolfSSL_PemCertToDer(file, der, EIGHTK_BUF);
|
||||
ret = SetAltNamesFromCert(cert, der, derSz);
|
||||
XFREE(der, NULL, DYNAMIC_TYPE_CERT);
|
||||
XFREE(der, cert->heap, DYNAMIC_TYPE_CERT);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -8646,7 +8677,7 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
/* private */
|
||||
privSz = key->dp->size;
|
||||
prv = (byte*)XMALLOC(privSz + privHdrSz + MAX_SEQ_SZ,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (prv == NULL) {
|
||||
return MEMORY_E;
|
||||
}
|
||||
@@ -8654,7 +8685,7 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
prv[prvidx++] = (byte)key->dp->size;
|
||||
ret = wc_ecc_export_private_only(key, prv + prvidx, &privSz);
|
||||
if (ret < 0) {
|
||||
XFREE(prv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
prvidx += privSz;
|
||||
@@ -8662,14 +8693,14 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
/* public */
|
||||
ret = wc_ecc_export_x963(key, NULL, &pubSz);
|
||||
if (ret != LENGTH_ONLY_E) {
|
||||
XFREE(prv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
|
||||
pub = (byte*)XMALLOC(pubSz + pubHdrSz + MAX_SEQ_SZ,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (pub == NULL) {
|
||||
XFREE(prv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
@@ -8683,8 +8714,8 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
pub[pubidx++] = (byte)0; /* leading zero */
|
||||
ret = wc_ecc_export_x963(key, pub + pubidx, &pubSz);
|
||||
if (ret != 0) {
|
||||
XFREE(prv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
pubidx += pubSz;
|
||||
@@ -8695,8 +8726,8 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
|
||||
totalSz = prvidx + pubidx + curveidx + verSz + seqSz;
|
||||
if (totalSz > (int)inLen) {
|
||||
XFREE(prv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
@@ -8712,7 +8743,7 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
/* private */
|
||||
XMEMCPY(output + idx, prv, prvidx);
|
||||
idx += prvidx;
|
||||
XFREE(prv, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(prv, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
/* curve */
|
||||
XMEMCPY(output + idx, curve, curveidx);
|
||||
@@ -8721,7 +8752,7 @@ int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
|
||||
/* public */
|
||||
XMEMCPY(output + idx, pub, pubidx);
|
||||
/* idx += pubidx; not used after write, if more data remove comment */
|
||||
XFREE(pub, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(pub, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
return totalSz;
|
||||
}
|
||||
@@ -9070,7 +9101,7 @@ static int DecodeCerts(byte* source,
|
||||
}
|
||||
|
||||
static int DecodeBasicOcspResponse(byte* source, word32* ioIndex,
|
||||
OcspResponse* resp, word32 size, void* cm)
|
||||
OcspResponse* resp, word32 size, void* cm, void* heap)
|
||||
{
|
||||
int length;
|
||||
word32 idx = *ioIndex;
|
||||
@@ -9115,7 +9146,7 @@ static int DecodeBasicOcspResponse(byte* source, word32* ioIndex,
|
||||
if (DecodeCerts(source, &idx, resp, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
InitDecodedCert(&cert, resp->cert, resp->certSz, 0);
|
||||
InitDecodedCert(&cert, resp->cert, resp->certSz, heap);
|
||||
ret = ParseCertRelative(&cert, CERT_TYPE, VERIFY, cm);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
@@ -9162,7 +9193,7 @@ void InitOcspResponse(OcspResponse* resp, CertStatus* status,
|
||||
}
|
||||
|
||||
|
||||
int OcspResponseDecode(OcspResponse* resp, void* cm)
|
||||
int OcspResponseDecode(OcspResponse* resp, void* cm, void* heap)
|
||||
{
|
||||
int length = 0;
|
||||
word32 idx = 0;
|
||||
@@ -9206,7 +9237,7 @@ int OcspResponseDecode(OcspResponse* resp, void* cm)
|
||||
if (GetLength(source, &idx, &length, size) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
if (DecodeBasicOcspResponse(source, &idx, resp, size, cm) < 0)
|
||||
if (DecodeBasicOcspResponse(source, &idx, resp, size, cm, heap) < 0)
|
||||
return ASN_PARSE_E;
|
||||
|
||||
return 0;
|
||||
@@ -9332,7 +9363,8 @@ int EncodeOcspRequest(OcspRequest* req, byte* output, word32 size)
|
||||
}
|
||||
|
||||
|
||||
int InitOcspRequest(OcspRequest* req, DecodedCert* cert, byte useNonce)
|
||||
int InitOcspRequest(OcspRequest* req, DecodedCert* cert, byte useNonce,
|
||||
void* heap)
|
||||
{
|
||||
WOLFSSL_ENTER("InitOcspRequest");
|
||||
|
||||
@@ -9340,12 +9372,13 @@ int InitOcspRequest(OcspRequest* req, DecodedCert* cert, byte useNonce)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
ForceZero(req, sizeof(OcspRequest));
|
||||
req->heap = heap;
|
||||
|
||||
if (cert) {
|
||||
XMEMCPY(req->issuerHash, cert->issuerHash, KEYID_SIZE);
|
||||
XMEMCPY(req->issuerKeyHash, cert->issuerKeyHash, KEYID_SIZE);
|
||||
|
||||
req->serial = (byte*)XMALLOC(cert->serialSz, NULL,
|
||||
req->serial = (byte*)XMALLOC(cert->serialSz, req->heap,
|
||||
DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
if (req->serial == NULL)
|
||||
return MEMORY_E;
|
||||
@@ -9354,10 +9387,10 @@ int InitOcspRequest(OcspRequest* req, DecodedCert* cert, byte useNonce)
|
||||
req->serialSz = cert->serialSz;
|
||||
|
||||
if (cert->extAuthInfoSz != 0 && cert->extAuthInfo != NULL) {
|
||||
req->url = (byte*)XMALLOC(cert->extAuthInfoSz, NULL,
|
||||
req->url = (byte*)XMALLOC(cert->extAuthInfoSz, req->heap,
|
||||
DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
if (req->url == NULL) {
|
||||
XFREE(req->serial, NULL, DYNAMIC_TYPE_OCSP);
|
||||
XFREE(req->serial, req->heap, DYNAMIC_TYPE_OCSP);
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
@@ -9370,7 +9403,11 @@ int InitOcspRequest(OcspRequest* req, DecodedCert* cert, byte useNonce)
|
||||
if (useNonce) {
|
||||
WC_RNG rng;
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
if (wc_InitRng_ex(&rng, req->heap) != 0) {
|
||||
#else
|
||||
if (wc_InitRng(&rng) != 0) {
|
||||
#endif
|
||||
WOLFSSL_MSG("\tCannot initialize RNG. Skipping the OSCP Nonce.");
|
||||
} else {
|
||||
if (wc_RNG_GenerateBlock(&rng, req->nonce, MAX_OCSP_NONCE_SZ) != 0)
|
||||
@@ -9391,10 +9428,10 @@ void FreeOcspRequest(OcspRequest* req)
|
||||
|
||||
if (req) {
|
||||
if (req->serial)
|
||||
XFREE(req->serial, NULL, DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
XFREE(req->serial, req->heap, DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
|
||||
if (req->url)
|
||||
XFREE(req->url, NULL, DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
XFREE(req->url, req->heap, DYNAMIC_TYPE_OCSP_REQUEST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9511,7 +9548,7 @@ WOLFSSL_LOCAL int GetNameHash(const byte* source, word32* idx, byte* hash,
|
||||
#ifdef HAVE_CRL
|
||||
|
||||
/* initialize decoded CRL */
|
||||
void InitDecodedCRL(DecodedCRL* dcrl)
|
||||
void InitDecodedCRL(DecodedCRL* dcrl, void* heap)
|
||||
{
|
||||
WOLFSSL_MSG("InitDecodedCRL");
|
||||
|
||||
@@ -9521,6 +9558,10 @@ void InitDecodedCRL(DecodedCRL* dcrl)
|
||||
dcrl->signatureOID = 0;
|
||||
dcrl->certs = NULL;
|
||||
dcrl->totalCerts = 0;
|
||||
dcrl->heap = heap;
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
dcrl->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -9533,7 +9574,7 @@ void FreeDecodedCRL(DecodedCRL* dcrl)
|
||||
|
||||
while(tmp) {
|
||||
RevokedCert* next = tmp->next;
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_REVOKED);
|
||||
XFREE(tmp, dcrl->heap, DYNAMIC_TYPE_REVOKED);
|
||||
tmp = next;
|
||||
}
|
||||
}
|
||||
@@ -9572,7 +9613,8 @@ static int GetRevoked(const byte* buff, word32* idx, DecodedCRL* dcrl,
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
|
||||
rc = (RevokedCert*)XMALLOC(sizeof(RevokedCert), NULL, DYNAMIC_TYPE_CRL);
|
||||
rc = (RevokedCert*)XMALLOC(sizeof(RevokedCert), dcrl->heap,
|
||||
DYNAMIC_TYPE_CRL);
|
||||
if (rc == NULL) {
|
||||
WOLFSSL_MSG("Alloc Revoked Cert failed");
|
||||
return MEMORY_E;
|
||||
|
||||
197
wolfcrypt/src/cmac.c
Normal file
197
wolfcrypt/src/cmac.c
Normal file
@@ -0,0 +1,197 @@
|
||||
/* cmac.c
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#if defined(WOLFSSL_CMAC) && !defined(NO_AES) && defined(WOLFSSL_AES_DIRECT)
|
||||
|
||||
#ifdef NO_INLINE
|
||||
#include <wolfssl/wolfcrypt/misc.h>
|
||||
#else
|
||||
#define WOLFSSL_MISC_INCLUDED
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/aes.h>
|
||||
#include <wolfssl/wolfcrypt/cmac.h>
|
||||
|
||||
|
||||
#ifndef WOLFSSL_HAVE_MIN
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
|
||||
static INLINE word32 min(word32 a, word32 b)
|
||||
{
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_MIN */
|
||||
|
||||
|
||||
static void ShiftAndXorRb(byte* out, byte* in)
|
||||
{
|
||||
int i, j, xorRb;
|
||||
int mask = 0, last = 0;
|
||||
byte Rb = 0x87;
|
||||
|
||||
xorRb = (in[0] & 0x80) != 0;
|
||||
|
||||
for (i = 1, j = AES_BLOCK_SIZE - 1; i <= AES_BLOCK_SIZE; i++, j--) {
|
||||
last = (in[j] & 0x80) ? 1 : 0;
|
||||
out[j] = (in[j] << 1) | mask;
|
||||
mask = last;
|
||||
if (xorRb) {
|
||||
out[j] ^= Rb;
|
||||
Rb = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int wc_InitCmac(Cmac* cmac, const byte* key, word32 keySz,
|
||||
int type, void* unused)
|
||||
{
|
||||
int ret;
|
||||
|
||||
(void)unused;
|
||||
|
||||
if (cmac == NULL || key == NULL || keySz == 0 || type != WC_CMAC_AES)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
XMEMSET(cmac, 0, sizeof(Cmac));
|
||||
ret = wc_AesSetKey(&cmac->aes, key, keySz, NULL, AES_ENCRYPTION);
|
||||
if (ret == 0) {
|
||||
byte l[AES_BLOCK_SIZE];
|
||||
|
||||
XMEMSET(l, 0, AES_BLOCK_SIZE);
|
||||
wc_AesEncryptDirect(&cmac->aes, l, l);
|
||||
ShiftAndXorRb(cmac->k1, l);
|
||||
ShiftAndXorRb(cmac->k2, cmac->k1);
|
||||
ForceZero(l, AES_BLOCK_SIZE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int wc_CmacUpdate(Cmac* cmac, const byte* in, word32 inSz)
|
||||
{
|
||||
if ((cmac == NULL) || (in == NULL && inSz != 0))
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
while (inSz != 0) {
|
||||
word32 add = min(inSz, AES_BLOCK_SIZE - cmac->bufferSz);
|
||||
XMEMCPY(&cmac->buffer[cmac->bufferSz], in, add);
|
||||
|
||||
cmac->bufferSz += add;
|
||||
in += add;
|
||||
inSz -= add;
|
||||
|
||||
if (cmac->bufferSz == AES_BLOCK_SIZE && inSz != 0) {
|
||||
if (cmac->totalSz != 0)
|
||||
xorbuf(cmac->buffer, cmac->digest, AES_BLOCK_SIZE);
|
||||
wc_AesEncryptDirect(&cmac->aes,
|
||||
cmac->digest,
|
||||
cmac->buffer);
|
||||
cmac->totalSz += AES_BLOCK_SIZE;
|
||||
cmac->bufferSz = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wc_CmacFinal(Cmac* cmac, byte* out, word32* outSz)
|
||||
{
|
||||
const byte* subKey;
|
||||
|
||||
if (cmac == NULL || out == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (outSz != NULL && *outSz < AES_BLOCK_SIZE)
|
||||
return BUFFER_E;
|
||||
|
||||
if (cmac->bufferSz == AES_BLOCK_SIZE) {
|
||||
subKey = cmac->k1;
|
||||
}
|
||||
else {
|
||||
word32 remainder = AES_BLOCK_SIZE - cmac->bufferSz;
|
||||
|
||||
if (remainder == 0)
|
||||
remainder = AES_BLOCK_SIZE;
|
||||
|
||||
if (remainder > 1)
|
||||
XMEMSET(cmac->buffer + AES_BLOCK_SIZE - remainder, 0, remainder);
|
||||
cmac->buffer[AES_BLOCK_SIZE - remainder] = 0x80;
|
||||
subKey = cmac->k2;
|
||||
}
|
||||
xorbuf(cmac->buffer, cmac->digest, AES_BLOCK_SIZE);
|
||||
xorbuf(cmac->buffer, subKey, AES_BLOCK_SIZE);
|
||||
wc_AesEncryptDirect(&cmac->aes, out, cmac->buffer);
|
||||
|
||||
if (outSz != NULL)
|
||||
*outSz = AES_BLOCK_SIZE;
|
||||
ForceZero(cmac, sizeof(Cmac));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wc_AesCmacGenerate(byte* out, word32* outSz,
|
||||
const byte* in, word32 inSz,
|
||||
const byte* key, word32 keySz)
|
||||
{
|
||||
Cmac cmac;
|
||||
|
||||
wc_InitCmac(&cmac, key, keySz, WC_CMAC_AES, NULL);
|
||||
wc_CmacUpdate(&cmac, in, inSz);
|
||||
wc_CmacFinal(&cmac, out, outSz);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int wc_AesCmacVerify(const byte* check, word32 checkSz,
|
||||
const byte* in, word32 inSz,
|
||||
const byte* key, word32 keySz)
|
||||
{
|
||||
byte a[AES_BLOCK_SIZE];
|
||||
word32 aSz = sizeof(a);
|
||||
int result;
|
||||
int compareRet;
|
||||
|
||||
XMEMSET(a, 0, aSz);
|
||||
result = wc_AesCmacGenerate(a, &aSz, in, inSz, key, keySz);
|
||||
compareRet = ConstantCompare(check, a, min(checkSz, aSz));
|
||||
|
||||
if (result == 0)
|
||||
result = compareRet ? 1 : 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#endif /* WOLFSSL_CMAC && NO_AES && WOLFSSL_AES_DIRECT */
|
||||
@@ -56,6 +56,7 @@ enum {
|
||||
void wc_InitDsaKey(DsaKey* key)
|
||||
{
|
||||
key->type = -1; /* haven't decided yet */
|
||||
key->heap = NULL;
|
||||
|
||||
/* TomsFastMath doesn't use memory allocation */
|
||||
#ifndef USE_FAST_MATH
|
||||
@@ -69,6 +70,15 @@ void wc_InitDsaKey(DsaKey* key)
|
||||
}
|
||||
|
||||
|
||||
int wc_InitDsaKey_h(DsaKey* key, void* h)
|
||||
{
|
||||
wc_InitDsaKey(key);
|
||||
key->heap = h;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void wc_FreeDsaKey(DsaKey* key)
|
||||
{
|
||||
(void)key;
|
||||
@@ -98,13 +108,13 @@ int wc_MakeDsaKey(WC_RNG *rng, DsaKey *dsa)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
/* allocate ram */
|
||||
buf = (unsigned char *)XMALLOC(qsize, NULL,
|
||||
buf = (unsigned char *)XMALLOC(qsize, dsa->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (buf == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
if (mp_init(&dsa->x) != MP_OKAY) {
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return MP_INIT_E;
|
||||
}
|
||||
|
||||
@@ -113,19 +123,19 @@ int wc_MakeDsaKey(WC_RNG *rng, DsaKey *dsa)
|
||||
err = wc_RNG_GenerateBlock(rng, buf, qsize);
|
||||
if (err != MP_OKAY) {
|
||||
mp_clear(&dsa->x);
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = mp_read_unsigned_bin(&dsa->x, buf, qsize);
|
||||
if (err != MP_OKAY) {
|
||||
mp_clear(&dsa->x);
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return err;
|
||||
}
|
||||
} while (mp_cmp_d(&dsa->x, 1) != MP_GT);
|
||||
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
if (mp_init(&dsa->y) != MP_OKAY) {
|
||||
mp_clear(&dsa->x);
|
||||
@@ -178,7 +188,7 @@ int wc_MakeDsaParameters(WC_RNG *rng, int modulus_size, DsaKey *dsa)
|
||||
|
||||
/* allocate ram */
|
||||
buf = (unsigned char *)XMALLOC(msize - qsize,
|
||||
NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (buf == NULL) {
|
||||
return MEMORY_E;
|
||||
}
|
||||
@@ -186,7 +196,7 @@ int wc_MakeDsaParameters(WC_RNG *rng, int modulus_size, DsaKey *dsa)
|
||||
/* make a random string that will be multplied against q */
|
||||
err = wc_RNG_GenerateBlock(rng, buf, msize - qsize);
|
||||
if (err != MP_OKAY) {
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -198,7 +208,7 @@ int wc_MakeDsaParameters(WC_RNG *rng, int modulus_size, DsaKey *dsa)
|
||||
|
||||
if (mp_init_multi(&tmp2, &dsa->p, &dsa->q, 0, 0, 0) != MP_OKAY) {
|
||||
mp_clear(&dsa->q);
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return MP_INIT_E;
|
||||
}
|
||||
|
||||
@@ -207,10 +217,10 @@ int wc_MakeDsaParameters(WC_RNG *rng, int modulus_size, DsaKey *dsa)
|
||||
mp_clear(&dsa->q);
|
||||
mp_clear(&dsa->p);
|
||||
mp_clear(&tmp2);
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return err;
|
||||
}
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(buf, dsa->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
/* make our prime q */
|
||||
err = mp_rand_prime(&dsa->q, qsize, rng, NULL);
|
||||
|
||||
1352
wolfcrypt/src/ecc.c
1352
wolfcrypt/src/ecc.c
File diff suppressed because it is too large
Load Diff
@@ -101,6 +101,9 @@ const char* wc_GetErrorString(int error)
|
||||
case MEMORY_E :
|
||||
return "out of memory error";
|
||||
|
||||
case VAR_STATE_CHANGE_E :
|
||||
return "Variable state modified by different thread";
|
||||
|
||||
case RSA_WRONG_TYPE_E :
|
||||
return "RSA wrong block type for RSA function";
|
||||
|
||||
|
||||
@@ -288,10 +288,31 @@ static INLINE int DoKey(HC128* ctx, const byte* key, const byte* iv)
|
||||
}
|
||||
|
||||
|
||||
int wc_Hc128_SetHeap(HC128* ctx, void* heap)
|
||||
{
|
||||
if (ctx == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#ifdef XSTREAM_ALIGN
|
||||
ctx->heap = heap;
|
||||
#endif
|
||||
|
||||
(void)heap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Key setup */
|
||||
int wc_Hc128_SetKey(HC128* ctx, const byte* key, const byte* iv)
|
||||
{
|
||||
#ifdef XSTREAM_ALIGN
|
||||
/* default heap to NULL or heap test value */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
ctx->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
#else
|
||||
ctx->heap = NULL;
|
||||
#endif /* WOLFSSL_HEAP_TEST */
|
||||
|
||||
if ((wolfssl_word)key % 4) {
|
||||
int alignKey[4];
|
||||
|
||||
@@ -369,14 +390,14 @@ int wc_Hc128_Process(HC128* ctx, byte* output, const byte* input, word32 msglen)
|
||||
byte* tmp;
|
||||
WOLFSSL_MSG("Hc128Process unaligned");
|
||||
|
||||
tmp = (byte*)XMALLOC(msglen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
tmp = (byte*)XMALLOC(msglen, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (tmp == NULL) return MEMORY_E;
|
||||
|
||||
XMEMCPY(tmp, input, msglen);
|
||||
DoProcess(ctx, tmp, tmp, msglen);
|
||||
XMEMCPY(output, tmp, msglen);
|
||||
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
||||
@@ -626,6 +626,13 @@ int wc_HmacInitCavium(Hmac* hmac, int devId)
|
||||
|
||||
hmac->innerHashKeyed = 0;
|
||||
|
||||
/* default to NULL heap hint or test value */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
hmac->heap = (void)WOLFSSL_HEAP_TEST;
|
||||
#else
|
||||
hmac->heap = NULL;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -681,7 +688,7 @@ static int HmacCaviumUpdate(Hmac* hmac, const byte* msg, word32 length)
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = XMALLOC(hmac->dataLen + add, NULL,DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
tmp = XMALLOC(hmac->dataLen + add, hmac->heap ,DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
if (tmp == NULL) {
|
||||
WOLFSSL_MSG("Out of memory for cavium update");
|
||||
return -1;
|
||||
@@ -691,7 +698,7 @@ static int HmacCaviumUpdate(Hmac* hmac, const byte* msg, word32 length)
|
||||
XMEMCPY(tmp + hmac->dataLen, msg, add);
|
||||
|
||||
hmac->dataLen += add;
|
||||
XFREE(hmac->data, NULL, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
XFREE(hmac->data, hmac->heap, DYNAMIC_TYPE_CAVIUM_TMP);
|
||||
hmac->data = tmp;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -252,7 +252,7 @@ int mp_leading_bit (mp_int * a)
|
||||
if (mp_init_copy(&t, a) != MP_OKAY)
|
||||
return 0;
|
||||
|
||||
while (mp_iszero(&t) == 0) {
|
||||
while (mp_iszero(&t) == MP_NO) {
|
||||
#ifndef MP_8BIT
|
||||
bit = (t.dp[0] & 0x80) != 0;
|
||||
#else
|
||||
@@ -277,7 +277,7 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b)
|
||||
}
|
||||
|
||||
x = 0;
|
||||
while (mp_iszero (&t) == 0) {
|
||||
while (mp_iszero (&t) == MP_NO) {
|
||||
#ifndef MP_8BIT
|
||||
b[x++] = (unsigned char) (t.dp[0] & 255);
|
||||
#else
|
||||
@@ -329,7 +329,7 @@ int mp_copy (mp_int * a, mp_int * b)
|
||||
|
||||
/* zero b and copy the parameters over */
|
||||
{
|
||||
register mp_digit *tmpa, *tmpb;
|
||||
mp_digit *tmpa, *tmpb;
|
||||
|
||||
/* pointer aliases */
|
||||
|
||||
@@ -507,7 +507,7 @@ void mp_exch (mp_int * a, mp_int * b)
|
||||
/* shift right a certain number of bits */
|
||||
void mp_rshb (mp_int *c, int x)
|
||||
{
|
||||
register mp_digit *tmpc, mask, shift;
|
||||
mp_digit *tmpc, mask, shift;
|
||||
mp_digit r, rr;
|
||||
mp_digit D = x;
|
||||
|
||||
@@ -553,7 +553,7 @@ void mp_rshd (mp_int * a, int b)
|
||||
}
|
||||
|
||||
{
|
||||
register mp_digit *bottom, *top;
|
||||
mp_digit *bottom, *top;
|
||||
|
||||
/* shift the digits down */
|
||||
|
||||
@@ -686,8 +686,8 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c)
|
||||
/* shift any bit count < DIGIT_BIT */
|
||||
d = (mp_digit) (b % DIGIT_BIT);
|
||||
if (d != 0) {
|
||||
register mp_digit *tmpc, shift, mask, r, rr;
|
||||
register int x;
|
||||
mp_digit *tmpc, shift, mask, r, rr;
|
||||
int x;
|
||||
|
||||
/* bitmask for carries */
|
||||
mask = (((mp_digit)1) << d) - 1;
|
||||
@@ -740,7 +740,7 @@ int mp_lshd (mp_int * a, int b)
|
||||
}
|
||||
|
||||
{
|
||||
register mp_digit *top, *bottom;
|
||||
mp_digit *top, *bottom;
|
||||
|
||||
/* increment the used by the shift amount then copy upwards */
|
||||
a->used += b;
|
||||
@@ -845,7 +845,7 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y)
|
||||
|
||||
/* if the modulus is odd or dr != 0 use the montgomery method */
|
||||
#ifdef BN_MP_EXPTMOD_FAST_C
|
||||
if (mp_isodd (P) == 1 || dr != 0) {
|
||||
if (mp_isodd (P) == MP_YES || dr != 0) {
|
||||
return mp_exptmod_fast (G, X, P, Y, dr);
|
||||
} else {
|
||||
#endif
|
||||
@@ -888,13 +888,13 @@ int mp_abs (mp_int * a, mp_int * b)
|
||||
int mp_invmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
/* b cannot be negative */
|
||||
if (b->sign == MP_NEG || mp_iszero(b) == 1) {
|
||||
if (b->sign == MP_NEG || mp_iszero(b) == MP_YES) {
|
||||
return MP_VAL;
|
||||
}
|
||||
|
||||
#ifdef BN_FAST_MP_INVMOD_C
|
||||
/* if the modulus is odd we can use a faster routine instead */
|
||||
if (mp_isodd (b) == 1) {
|
||||
if (mp_isodd (b) == MP_YES) {
|
||||
return fast_mp_invmod (a, b, c);
|
||||
}
|
||||
#endif
|
||||
@@ -917,7 +917,7 @@ int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
int res, neg, loop_check = 0;
|
||||
|
||||
/* 2. [modified] b must be odd */
|
||||
if (mp_iseven (b) == 1) {
|
||||
if (mp_iseven (b) == MP_YES) {
|
||||
return MP_VAL;
|
||||
}
|
||||
|
||||
@@ -947,13 +947,13 @@ int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
top:
|
||||
/* 4. while u is even do */
|
||||
while (mp_iseven (&u) == 1) {
|
||||
while (mp_iseven (&u) == MP_YES) {
|
||||
/* 4.1 u = u/2 */
|
||||
if ((res = mp_div_2 (&u, &u)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
/* 4.2 if B is odd then */
|
||||
if (mp_isodd (&B) == 1) {
|
||||
if (mp_isodd (&B) == MP_YES) {
|
||||
if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
@@ -965,13 +965,13 @@ top:
|
||||
}
|
||||
|
||||
/* 5. while v is even do */
|
||||
while (mp_iseven (&v) == 1) {
|
||||
while (mp_iseven (&v) == MP_YES) {
|
||||
/* 5.1 v = v/2 */
|
||||
if ((res = mp_div_2 (&v, &v)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
/* 5.2 if D is odd then */
|
||||
if (mp_isodd (&D) == 1) {
|
||||
if (mp_isodd (&D) == MP_YES) {
|
||||
/* D = (D-x)/2 */
|
||||
if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
@@ -1005,7 +1005,7 @@ top:
|
||||
}
|
||||
|
||||
/* if not zero goto step 4 */
|
||||
if (mp_iszero (&u) == 0) {
|
||||
if (mp_iszero (&u) == MP_NO) {
|
||||
if (++loop_check > 4096) {
|
||||
res = MP_VAL;
|
||||
goto LBL_ERR;
|
||||
@@ -1055,7 +1055,7 @@ int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c)
|
||||
int res;
|
||||
|
||||
/* b cannot be negative */
|
||||
if (b->sign == MP_NEG || mp_iszero(b) == 1) {
|
||||
if (b->sign == MP_NEG || mp_iszero(b) == MP_YES) {
|
||||
return MP_VAL;
|
||||
}
|
||||
|
||||
@@ -1079,7 +1079,7 @@ int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c)
|
||||
}
|
||||
|
||||
/* 2. [modified] if x,y are both even then return an error! */
|
||||
if (mp_iseven (&x) == 1 && mp_iseven (&y) == 1) {
|
||||
if (mp_iseven (&x) == MP_YES && mp_iseven (&y) == MP_YES) {
|
||||
res = MP_VAL;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
@@ -1096,13 +1096,13 @@ int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c)
|
||||
|
||||
top:
|
||||
/* 4. while u is even do */
|
||||
while (mp_iseven (&u) == 1) {
|
||||
while (mp_iseven (&u) == MP_YES) {
|
||||
/* 4.1 u = u/2 */
|
||||
if ((res = mp_div_2 (&u, &u)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
/* 4.2 if A or B is odd then */
|
||||
if (mp_isodd (&A) == 1 || mp_isodd (&B) == 1) {
|
||||
if (mp_isodd (&A) == MP_YES || mp_isodd (&B) == MP_YES) {
|
||||
/* A = (A+y)/2, B = (B-x)/2 */
|
||||
if ((res = mp_add (&A, &y, &A)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
@@ -1121,13 +1121,13 @@ top:
|
||||
}
|
||||
|
||||
/* 5. while v is even do */
|
||||
while (mp_iseven (&v) == 1) {
|
||||
while (mp_iseven (&v) == MP_YES) {
|
||||
/* 5.1 v = v/2 */
|
||||
if ((res = mp_div_2 (&v, &v)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
/* 5.2 if C or D is odd then */
|
||||
if (mp_isodd (&C) == 1 || mp_isodd (&D) == 1) {
|
||||
if (mp_isodd (&C) == MP_YES || mp_isodd (&D) == MP_YES) {
|
||||
/* C = (C+y)/2, D = (D-x)/2 */
|
||||
if ((res = mp_add (&C, &y, &C)) != MP_OKAY) {
|
||||
goto LBL_ERR;
|
||||
@@ -1175,7 +1175,7 @@ top:
|
||||
}
|
||||
|
||||
/* if not zero goto step 4 */
|
||||
if (mp_iszero (&u) == 0)
|
||||
if (mp_iszero (&u) == MP_NO)
|
||||
goto top;
|
||||
|
||||
/* now a = C, b = D, gcd == g*v */
|
||||
@@ -1347,7 +1347,7 @@ int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
int res, n, n2;
|
||||
|
||||
/* is divisor zero ? */
|
||||
if (mp_iszero (b) == 1) {
|
||||
if (mp_iszero (b) == MP_YES) {
|
||||
return MP_VAL;
|
||||
}
|
||||
|
||||
@@ -1427,7 +1427,7 @@ int mp_div_2(mp_int * a, mp_int * b)
|
||||
oldused = b->used;
|
||||
b->used = a->used;
|
||||
{
|
||||
register mp_digit r, rr, *tmpa, *tmpb;
|
||||
mp_digit r, rr, *tmpa, *tmpb;
|
||||
|
||||
/* source alias */
|
||||
tmpa = a->dp + b->used - 1;
|
||||
@@ -1523,8 +1523,8 @@ int s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
c->used = max + 1;
|
||||
|
||||
{
|
||||
register mp_digit u, *tmpa, *tmpb, *tmpc;
|
||||
register int i;
|
||||
mp_digit u, *tmpa, *tmpb, *tmpc;
|
||||
int i;
|
||||
|
||||
/* alias for digit pointers */
|
||||
|
||||
@@ -1599,8 +1599,8 @@ int s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
c->used = max;
|
||||
|
||||
{
|
||||
register mp_digit u, *tmpa, *tmpb, *tmpc;
|
||||
register int i;
|
||||
mp_digit u, *tmpa, *tmpb, *tmpc;
|
||||
int i;
|
||||
|
||||
/* alias for digit pointers */
|
||||
tmpa = a->dp;
|
||||
@@ -2165,8 +2165,8 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
* an array of double precision words W[...]
|
||||
*/
|
||||
{
|
||||
register mp_word *_W;
|
||||
register mp_digit *tmpx;
|
||||
mp_word *_W;
|
||||
mp_digit *tmpx;
|
||||
|
||||
/* alias for the W[] array */
|
||||
_W = W;
|
||||
@@ -2195,7 +2195,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
* by casting the value down to a mp_digit. Note this requires
|
||||
* that W[ix-1] have the carry cleared (see after the inner loop)
|
||||
*/
|
||||
register mp_digit mu;
|
||||
mp_digit mu;
|
||||
mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK);
|
||||
|
||||
/* a = a + mu * m * b**i
|
||||
@@ -2213,9 +2213,9 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
* first m->used words of W[] have the carries fixed
|
||||
*/
|
||||
{
|
||||
register int iy;
|
||||
register mp_digit *tmpn;
|
||||
register mp_word *_W;
|
||||
int iy;
|
||||
mp_digit *tmpn;
|
||||
mp_word *_W;
|
||||
|
||||
/* alias for the digits of the modulus */
|
||||
tmpn = n->dp;
|
||||
@@ -2238,8 +2238,8 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
* significant digits we zeroed].
|
||||
*/
|
||||
{
|
||||
register mp_digit *tmpx;
|
||||
register mp_word *_W, *_W1;
|
||||
mp_digit *tmpx;
|
||||
mp_word *_W, *_W1;
|
||||
|
||||
/* nox fix rest of carries */
|
||||
|
||||
@@ -2334,9 +2334,9 @@ int mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
|
||||
/* a = a + mu * m * b**i */
|
||||
{
|
||||
register int iy;
|
||||
register mp_digit *tmpn, *tmpx, u;
|
||||
register mp_word r;
|
||||
int iy;
|
||||
mp_digit *tmpn, *tmpx, u;
|
||||
mp_word r;
|
||||
|
||||
/* alias for digits of the modulus */
|
||||
tmpn = n->dp;
|
||||
@@ -2643,16 +2643,56 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
return res;
|
||||
}
|
||||
|
||||
if ((res = mp_mul (a, b, &t)) != MP_OKAY) {
|
||||
mp_clear (&t);
|
||||
return res;
|
||||
}
|
||||
res = mp_mul (a, b, &t);
|
||||
if (res == MP_OKAY) {
|
||||
res = mp_mod (&t, c, d);
|
||||
}
|
||||
|
||||
mp_clear (&t);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/* d = a - b (mod c) */
|
||||
int mp_submod(mp_int* a, mp_int* b, mp_int* c, mp_int* d)
|
||||
{
|
||||
int res;
|
||||
mp_int t;
|
||||
|
||||
if ((res = mp_init (&t)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = mp_sub (a, b, &t);
|
||||
if (res == MP_OKAY) {
|
||||
res = mp_mod (&t, c, d);
|
||||
}
|
||||
|
||||
mp_clear (&t);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* d = a + b (mod c) */
|
||||
int mp_addmod(mp_int* a, mp_int* b, mp_int* c, mp_int* d)
|
||||
{
|
||||
int res;
|
||||
mp_int t;
|
||||
|
||||
if ((res = mp_init (&t)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
|
||||
res = mp_add (a, b, &t);
|
||||
if (res == MP_OKAY) {
|
||||
res = mp_mod (&t, c, d);
|
||||
}
|
||||
|
||||
mp_clear (&t);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* computes b = a*a */
|
||||
int mp_sqr (mp_int * a, mp_int * b)
|
||||
{
|
||||
@@ -2728,7 +2768,7 @@ int mp_mul_2(mp_int * a, mp_int * b)
|
||||
b->used = a->used;
|
||||
|
||||
{
|
||||
register mp_digit r, rr, *tmpa, *tmpb;
|
||||
mp_digit r, rr, *tmpa, *tmpb;
|
||||
|
||||
/* alias for source */
|
||||
tmpa = a->dp;
|
||||
@@ -2997,7 +3037,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
#else
|
||||
mp_digit W[MP_WARRAY];
|
||||
#endif
|
||||
register mp_word _W;
|
||||
mp_word _W;
|
||||
|
||||
/* grow the destination as required */
|
||||
if (c->alloc < digs) {
|
||||
@@ -3055,7 +3095,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
c->used = pa;
|
||||
|
||||
{
|
||||
register mp_digit *tmpc;
|
||||
mp_digit *tmpc;
|
||||
tmpc = c->dp;
|
||||
for (ix = 0; ix < pa+1; ix++) {
|
||||
/* now extract the previous digit [below the carry] */
|
||||
@@ -3234,7 +3274,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b)
|
||||
bits = 1;
|
||||
}
|
||||
|
||||
|
||||
/* now compute C = A * B mod b */
|
||||
for (x = bits - 1; x < (int)DIGIT_BIT; x++) {
|
||||
if ((res = mp_mul_2 (a, a)) != MP_OKAY) {
|
||||
@@ -3777,7 +3816,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
c->used = pa;
|
||||
|
||||
{
|
||||
register mp_digit *tmpc;
|
||||
mp_digit *tmpc;
|
||||
|
||||
tmpc = c->dp + digs;
|
||||
for (ix = digs; ix < pa; ix++) { /* TAO, <= could potentially overwrite */
|
||||
@@ -4034,12 +4073,12 @@ int mp_cnt_lsb(mp_int *a)
|
||||
mp_digit q, qq;
|
||||
|
||||
/* easy out */
|
||||
if (mp_iszero(a) == 1) {
|
||||
if (mp_iszero(a) == MP_YES) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* scan lower digits until non-zero */
|
||||
for (x = 0; x < a->used && a->dp[x] == 0; x++);
|
||||
for (x = 0; x < a->used && a->dp[x] == 0; x++) {}
|
||||
q = a->dp[x];
|
||||
x *= DIGIT_BIT;
|
||||
|
||||
@@ -4089,7 +4128,7 @@ static int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d)
|
||||
}
|
||||
|
||||
/* quick outs */
|
||||
if (b == 1 || mp_iszero(a) == 1) {
|
||||
if (b == 1 || mp_iszero(a) == MP_YES) {
|
||||
if (d != NULL) {
|
||||
*d = 0;
|
||||
}
|
||||
@@ -4539,7 +4578,7 @@ int mp_gcd (mp_int * a, mp_int * b, mp_int * c)
|
||||
}
|
||||
}
|
||||
|
||||
while (mp_iszero(&v) == 0) {
|
||||
while (mp_iszero(&v) == MP_NO) {
|
||||
/* make sure v is the largest */
|
||||
if (mp_cmp_mag(&u, &v) == MP_GT) {
|
||||
/* swap u and v to make sure v is >= u */
|
||||
@@ -4608,11 +4647,11 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
|
||||
|
||||
/* process each digit of the string */
|
||||
while (*str) {
|
||||
/* if the radix < 36 the conversion is case insensitive
|
||||
/* if the radix <= 36 the conversion is case insensitive
|
||||
* this allows numbers like 1AB and 1ab to represent the same value
|
||||
* [e.g. in hex]
|
||||
*/
|
||||
ch = (char) ((radix < 36) ? XTOUPPER((unsigned char)*str) : *str);
|
||||
ch = (radix <= 36) ? (char)XTOUPPER((unsigned char)*str) : *str;
|
||||
for (y = 0; y < 64; y++) {
|
||||
if (ch == mp_s_rmap[y]) {
|
||||
break;
|
||||
@@ -4637,7 +4676,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
|
||||
}
|
||||
|
||||
/* set the sign only if a != 0 */
|
||||
if (mp_iszero(a) != 1) {
|
||||
if (mp_iszero(a) != MP_YES) {
|
||||
a->sign = neg;
|
||||
}
|
||||
return MP_OKAY;
|
||||
@@ -4717,7 +4756,7 @@ int mp_toradix (mp_int *a, char *str, int radix)
|
||||
}
|
||||
|
||||
/* quick out if its zero */
|
||||
if (mp_iszero(a) == 1) {
|
||||
if (mp_iszero(a) == MP_YES) {
|
||||
*str++ = '0';
|
||||
*str = '\0';
|
||||
return MP_OKAY;
|
||||
@@ -4735,7 +4774,7 @@ int mp_toradix (mp_int *a, char *str, int radix)
|
||||
}
|
||||
|
||||
digs = 0;
|
||||
while (mp_iszero (&t) == 0) {
|
||||
while (mp_iszero (&t) == MP_NO) {
|
||||
if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) {
|
||||
mp_clear (&t);
|
||||
return res;
|
||||
|
||||
@@ -38,8 +38,9 @@
|
||||
|
||||
#include <wolfssl/wolfcrypt/memory.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/wolfcrypt/logging.h>
|
||||
|
||||
#ifdef WOLFSSL_MALLOC_CHECK
|
||||
#if defined(WOLFSSL_MALLOC_CHECK) || defined(WOLFSSL_TRACK_MEMORY_FULL)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
@@ -73,6 +74,7 @@ int wolfSSL_SetAllocators(wolfSSL_Malloc_cb mf,
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifndef WOLFSSL_STATIC_MEMORY
|
||||
#ifdef WOLFSSL_DEBUG_MEMORY
|
||||
void* wolfSSL_Malloc(size_t size, const char* func, unsigned int line)
|
||||
#else
|
||||
@@ -139,6 +141,511 @@ void* wolfSSL_Realloc(void *ptr, size_t size)
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif /* WOLFSSL_STATIC_MEMORY */
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
|
||||
struct wc_Memory {
|
||||
byte* buffer;
|
||||
struct wc_Memory* next;
|
||||
word32 sz;
|
||||
};
|
||||
|
||||
|
||||
/* returns amount of memory used on success. On error returns negative value
|
||||
wc_Memory** list is the list that new buckets are prepended to
|
||||
*/
|
||||
static int create_memory_buckets(byte* buffer, word32 bufSz,
|
||||
word32 buckSz, word32 buckNum, wc_Memory** list) {
|
||||
word32 i;
|
||||
byte* pt = buffer;
|
||||
int ret = 0;
|
||||
word32 memSz = (word32)sizeof(wc_Memory);
|
||||
word32 padSz = -(int)memSz & (WOLFSSL_STATIC_ALIGN - 1);
|
||||
|
||||
/* if not enough space available for bucket size then do not try */
|
||||
if (buckSz + memSz + padSz > bufSz) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
for (i = 0; i < buckNum; i++) {
|
||||
if ((buckSz + memSz + padSz) <= (bufSz - ret)) {
|
||||
/* create a new struct and set its values */
|
||||
wc_Memory* mem = (struct wc_Memory*)(pt);
|
||||
mem->sz = buckSz;
|
||||
mem->buffer = (byte*)pt + padSz + memSz;
|
||||
mem->next = NULL;
|
||||
|
||||
/* add the newly created struct to front of list */
|
||||
if (*list == NULL) {
|
||||
*list = mem;
|
||||
} else {
|
||||
mem->next = *list;
|
||||
*list = mem;
|
||||
}
|
||||
|
||||
/* advance pointer and keep track of memory used */
|
||||
ret += buckSz + padSz + memSz;
|
||||
pt += buckSz + padSz + memSz;
|
||||
}
|
||||
else {
|
||||
break; /* not enough space left for more buckets of this size */
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int wolfSSL_load_static_memory(byte* buffer, word32 sz, int flag,
|
||||
WOLFSSL_HEAP* heap)
|
||||
{
|
||||
word32 ava = sz;
|
||||
byte* pt = buffer;
|
||||
int ret = 0;
|
||||
word32 memSz = (word32)sizeof(wc_Memory);
|
||||
word32 padSz = -(int)memSz & (WOLFSSL_STATIC_ALIGN - 1);
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_load_static_memory");
|
||||
|
||||
if (buffer == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* align pt */
|
||||
while ((wolfssl_word)pt % WOLFSSL_STATIC_ALIGN && pt < (buffer + sz)) {
|
||||
*pt = 0x00;
|
||||
pt++;
|
||||
ava--;
|
||||
}
|
||||
|
||||
/* devide into chunks of memory and add them to available list */
|
||||
while (ava >= (heap->sizeList[0] + padSz + memSz)) {
|
||||
int i;
|
||||
/* creating only IO buffers from memory passed in, max TLS is 16k */
|
||||
if (flag & WOLFMEM_IO_POOL || flag & WOLFMEM_IO_POOL_FIXED) {
|
||||
if ((ret = create_memory_buckets(pt, ava,
|
||||
WOLFMEM_IO_SZ, 1, &(heap->io))) < 0) {
|
||||
WOLFSSL_LEAVE("wolfSSL_load_static_memory", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* check if no more room left for creating IO buffers */
|
||||
if (ret == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* advance pointer in buffer for next buckets and keep track
|
||||
of how much memory is left available */
|
||||
pt += ret;
|
||||
ava -= ret;
|
||||
}
|
||||
else {
|
||||
/* start at largest and move to smaller buckets */
|
||||
for (i = (WOLFMEM_MAX_BUCKETS - 1); i >= 0; i--) {
|
||||
if ((heap->sizeList[i] + padSz + memSz) <= ava) {
|
||||
if ((ret = create_memory_buckets(pt, ava, heap->sizeList[i],
|
||||
heap->distList[i], &(heap->ava[i]))) < 0) {
|
||||
WOLFSSL_LEAVE("wolfSSL_load_static_memory", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* advance pointer in buffer for next buckets and keep track
|
||||
of how much memory is left available */
|
||||
pt += ret;
|
||||
ava -= ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int FreeFixedIO(WOLFSSL_HEAP* heap, wc_Memory** io)
|
||||
{
|
||||
WOLFSSL_MSG("Freeing fixed IO buffer");
|
||||
|
||||
/* check if fixed buffer was set */
|
||||
if (*io == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (heap == NULL) {
|
||||
WOLFSSL_MSG("No heap to return fixed IO too");
|
||||
}
|
||||
else {
|
||||
/* put IO buffer back into IO pool */
|
||||
(*io)->next = heap->io;
|
||||
heap->io = *io;
|
||||
*io = NULL;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int SetFixedIO(WOLFSSL_HEAP* heap, wc_Memory** io)
|
||||
{
|
||||
WOLFSSL_MSG("Setting fixed IO for SSL");
|
||||
if (heap == NULL) {
|
||||
return MEMORY_E;
|
||||
}
|
||||
|
||||
*io = heap->io;
|
||||
|
||||
if (*io != NULL) {
|
||||
heap->io = (*io)->next;
|
||||
(*io)->next = NULL;
|
||||
}
|
||||
else { /* failed to grab an IO buffer */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int wolfSSL_GetMemStats(WOLFSSL_HEAP* heap, WOLFSSL_MEM_STATS* stats)
|
||||
{
|
||||
word32 i;
|
||||
wc_Memory* pt;
|
||||
|
||||
XMEMSET(stats, 0, sizeof(WOLFSSL_MEM_STATS));
|
||||
|
||||
stats->totalAlloc = heap->alloc;
|
||||
stats->totalFr = heap->frAlc;
|
||||
stats->curAlloc = stats->totalAlloc - stats->totalFr;
|
||||
stats->maxHa = heap->maxHa;
|
||||
stats->maxIO = heap->maxIO;
|
||||
for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) {
|
||||
stats->blockSz[i] = heap->sizeList[i];
|
||||
for (pt = heap->ava[i]; pt != NULL; pt = pt->next) {
|
||||
stats->avaBlock[i] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (pt = heap->io; pt != NULL; pt = pt->next) {
|
||||
stats->avaIO++;
|
||||
}
|
||||
|
||||
stats->flag = heap->flag; /* flag used */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void* wolfSSL_Malloc(size_t size, void* heap, int type)
|
||||
{
|
||||
void* res = 0;
|
||||
wc_Memory* pt = NULL;
|
||||
int i;
|
||||
|
||||
/* check for testing heap hint was set */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
if (heap == (void*)WOLFSSL_HEAP_TEST) {
|
||||
return malloc(size);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* if no heap hint then use dynamic memory*/
|
||||
if (heap == NULL) {
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
/* allow using malloc for creating ctx and method */
|
||||
if (type == DYNAMIC_TYPE_CTX || type == DYNAMIC_TYPE_METHOD ||
|
||||
type == DYNAMIC_TYPE_CERT_MANAGER) {
|
||||
WOLFSSL_MSG("ERROR allowing null heap hint for ctx/method\n");
|
||||
res = malloc(size);
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("ERROR null heap hint passed into XMALLOC\n");
|
||||
res = NULL;
|
||||
}
|
||||
#else
|
||||
#ifndef WOLFSSL_NO_MALLOC
|
||||
res = malloc(size);
|
||||
#else
|
||||
WOLFSSL_MSG("No heap hint found to use and no malloc");
|
||||
#endif /* WOLFSSL_NO_MALLOC */
|
||||
#endif /* WOLFSSL_HEAP_TEST */
|
||||
}
|
||||
else {
|
||||
WOLFSSL_HEAP_HINT* hint = (WOLFSSL_HEAP_HINT*)heap;
|
||||
WOLFSSL_HEAP* mem = hint->memory;
|
||||
|
||||
if (LockMutex(&(mem->memory_mutex)) != 0) {
|
||||
WOLFSSL_MSG("Bad memory_mutex lock");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* case of using fixed IO buffers */
|
||||
if (mem->flag & WOLFMEM_IO_POOL_FIXED) {
|
||||
if (type == DYNAMIC_TYPE_OUT_BUFFER) {
|
||||
pt = hint->outBuf;
|
||||
}
|
||||
if (type == DYNAMIC_TYPE_IN_BUFFER) {
|
||||
pt = hint->inBuf;
|
||||
}
|
||||
}
|
||||
|
||||
/* check if using IO pool flag */
|
||||
if (mem->flag & WOLFMEM_IO_POOL && pt == NULL &&
|
||||
(type == DYNAMIC_TYPE_OUT_BUFFER ||
|
||||
type == DYNAMIC_TYPE_IN_BUFFER)) {
|
||||
if (mem->io != NULL) {
|
||||
pt = mem->io;
|
||||
mem->io = pt->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* general static memory */
|
||||
if (pt == NULL) {
|
||||
for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) {
|
||||
if ((word32)size < mem->sizeList[i]) {
|
||||
if (mem->ava[i] != NULL) {
|
||||
pt = mem->ava[i];
|
||||
mem->ava[i] = pt->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pt != NULL) {
|
||||
mem->inUse += pt->sz;
|
||||
mem->alloc += 1;
|
||||
res = pt->buffer;
|
||||
|
||||
/* keep track of connection statistics if flag is set */
|
||||
if (mem->flag & WOLFMEM_TRACK_STATS) {
|
||||
WOLFSSL_MEM_CONN_STATS* stats = hint->stats;
|
||||
if (stats != NULL) {
|
||||
stats->curMem += pt->sz;
|
||||
if (stats->peakMem < stats->curMem) {
|
||||
stats->peakMem = stats->curMem;
|
||||
}
|
||||
stats->curAlloc++;
|
||||
if (stats->peakAlloc < stats->curAlloc) {
|
||||
stats->peakAlloc = stats->curAlloc;
|
||||
}
|
||||
stats->totalAlloc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("ERROR ran out of static memory");
|
||||
}
|
||||
|
||||
UnLockMutex(&(mem->memory_mutex));
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_MALLOC_CHECK
|
||||
if ((wolfssl_word)res % WOLFSSL_STATIC_ALIGN) {
|
||||
WOLFSSL_MSG("ERROR memory is not alligned");
|
||||
res = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
(void)i;
|
||||
(void)pt;
|
||||
(void)type;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void wolfSSL_Free(void *ptr, void* heap, int type)
|
||||
{
|
||||
int i;
|
||||
wc_Memory* pt;
|
||||
|
||||
if (ptr) {
|
||||
/* check for testing heap hint was set */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
if (heap == (void*)WOLFSSL_HEAP_TEST) {
|
||||
return free(ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (heap == NULL) {
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
/* allow using malloc for creating ctx and method */
|
||||
if (type == DYNAMIC_TYPE_CTX || type == DYNAMIC_TYPE_METHOD ||
|
||||
type == DYNAMIC_TYPE_CERT_MANAGER) {
|
||||
WOLFSSL_MSG("ERROR allowing null heap hint for ctx/method\n");
|
||||
}
|
||||
else {
|
||||
WOLFSSL_MSG("ERROR null heap hint passed into XFREE\n");
|
||||
}
|
||||
#endif
|
||||
#ifndef WOLFSSL_NO_MALLOC
|
||||
free(ptr);
|
||||
#else
|
||||
WOLFSSL_MSG("Error trying to call free when turned off");
|
||||
#endif /* WOLFSSL_NO_MALLOC */
|
||||
}
|
||||
else {
|
||||
WOLFSSL_HEAP_HINT* hint = (WOLFSSL_HEAP_HINT*)heap;
|
||||
WOLFSSL_HEAP* mem = hint->memory;
|
||||
word32 padSz = -(int)sizeof(wc_Memory) & (WOLFSSL_STATIC_ALIGN - 1);
|
||||
|
||||
/* get memory struct and add it to available list */
|
||||
pt = (wc_Memory*)((byte*)ptr - sizeof(wc_Memory) - padSz);
|
||||
if (LockMutex(&(mem->memory_mutex)) != 0) {
|
||||
WOLFSSL_MSG("Bad memory_mutex lock");
|
||||
return;
|
||||
}
|
||||
|
||||
/* case of using fixed IO buffers */
|
||||
if (mem->flag & WOLFMEM_IO_POOL_FIXED &&
|
||||
(type == DYNAMIC_TYPE_OUT_BUFFER ||
|
||||
type == DYNAMIC_TYPE_IN_BUFFER)) {
|
||||
/* fixed IO pools are free'd at the end of SSL lifetime
|
||||
using FreeFixedIO(WOLFSSL_HEAP* heap, wc_Memory** io) */
|
||||
}
|
||||
else if (mem->flag & WOLFMEM_IO_POOL &&
|
||||
(type == DYNAMIC_TYPE_OUT_BUFFER ||
|
||||
type == DYNAMIC_TYPE_IN_BUFFER)) {
|
||||
pt->next = mem->io;
|
||||
mem->io = pt;
|
||||
}
|
||||
else { /* general memory free */
|
||||
for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) {
|
||||
if (pt->sz == mem->sizeList[i]) {
|
||||
pt->next = mem->ava[i];
|
||||
mem->ava[i] = pt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
mem->inUse -= pt->sz;
|
||||
mem->frAlc += 1;
|
||||
|
||||
/* keep track of connection statistics if flag is set */
|
||||
if (mem->flag & WOLFMEM_TRACK_STATS) {
|
||||
WOLFSSL_MEM_CONN_STATS* stats = hint->stats;
|
||||
if (stats != NULL) {
|
||||
/* avoid under flow */
|
||||
if (stats->curMem > pt->sz) {
|
||||
stats->curMem -= pt->sz;
|
||||
}
|
||||
else {
|
||||
stats->curMem = 0;
|
||||
}
|
||||
|
||||
if (stats->curAlloc > 0) {
|
||||
stats->curAlloc--;
|
||||
}
|
||||
stats->totalFr++;
|
||||
}
|
||||
}
|
||||
UnLockMutex(&(mem->memory_mutex));
|
||||
}
|
||||
}
|
||||
|
||||
(void)i;
|
||||
(void)pt;
|
||||
(void)type;
|
||||
}
|
||||
|
||||
|
||||
void* wolfSSL_Realloc(void *ptr, size_t size, void* heap, int type)
|
||||
{
|
||||
void* res = 0;
|
||||
wc_Memory* pt = NULL;
|
||||
word32 prvSz;
|
||||
int i;
|
||||
|
||||
/* check for testing heap hint was set */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
if (heap == (void*)WOLFSSL_HEAP_TEST) {
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (heap == NULL) {
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
WOLFSSL_MSG("ERROR null heap hint passed in to XREALLOC\n");
|
||||
#endif
|
||||
#ifndef WOLFSSL_NO_MALLOC
|
||||
res = realloc(ptr, size);
|
||||
#else
|
||||
WOLFSSL_MSG("NO heap found to use for realloc");
|
||||
#endif /* WOLFSSL_NO_MALLOC */
|
||||
}
|
||||
else {
|
||||
WOLFSSL_HEAP_HINT* hint = (WOLFSSL_HEAP_HINT*)heap;
|
||||
WOLFSSL_HEAP* mem = hint->memory;
|
||||
word32 padSz = -(int)sizeof(wc_Memory) & (WOLFSSL_STATIC_ALIGN - 1);
|
||||
|
||||
if (LockMutex(&(mem->memory_mutex)) != 0) {
|
||||
WOLFSSL_MSG("Bad memory_mutex lock");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* case of using fixed IO buffers or IO pool */
|
||||
if (((mem->flag & WOLFMEM_IO_POOL)||(mem->flag & WOLFMEM_IO_POOL_FIXED))
|
||||
&& (type == DYNAMIC_TYPE_OUT_BUFFER ||
|
||||
type == DYNAMIC_TYPE_IN_BUFFER)) {
|
||||
/* no realloc, is fixed size */
|
||||
pt = (wc_Memory*)((byte*)ptr - padSz - sizeof(wc_Memory));
|
||||
if (pt->sz < size) {
|
||||
WOLFSSL_MSG("Error IO memory was not large enough");
|
||||
res = NULL; /* return NULL in error case */
|
||||
}
|
||||
res = pt->buffer;
|
||||
}
|
||||
else {
|
||||
/* general memory */
|
||||
for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) {
|
||||
if ((word32)size < mem->sizeList[i]) {
|
||||
if (mem->ava[i] != NULL) {
|
||||
pt = mem->ava[i];
|
||||
mem->ava[i] = pt->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pt != NULL && res == NULL) {
|
||||
res = pt->buffer;
|
||||
|
||||
/* copy over original information and free ptr */
|
||||
prvSz = ((wc_Memory*)((byte*)ptr - padSz -
|
||||
sizeof(wc_Memory)))->sz;
|
||||
prvSz = (prvSz > pt->sz)? pt->sz: prvSz;
|
||||
XMEMCPY(pt->buffer, ptr, prvSz);
|
||||
mem->inUse += pt->sz;
|
||||
mem->alloc += 1;
|
||||
|
||||
/* free memory that was previously being used */
|
||||
UnLockMutex(&(mem->memory_mutex));
|
||||
wolfSSL_Free(ptr, heap, type);
|
||||
if (LockMutex(&(mem->memory_mutex)) != 0) {
|
||||
WOLFSSL_MSG("Bad memory_mutex lock");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
UnLockMutex(&(mem->memory_mutex));
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_MALLOC_CHECK
|
||||
if ((wolfssl_word)res % WOLFSSL_STATIC_ALIGN) {
|
||||
WOLFSSL_MSG("ERROR memory is not alligned");
|
||||
res = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)i;
|
||||
(void)pt;
|
||||
(void)type;
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif /* WOLFSSL_STATIC_MEMORY */
|
||||
|
||||
#endif /* USE_WOLFSSL_MEMORY */
|
||||
|
||||
|
||||
@@ -139,12 +139,31 @@ int wc_GetContentType(const byte* input, word32* inOutIdx, word32* oid,
|
||||
}
|
||||
|
||||
|
||||
int wc_PKCS7_SetHeap(PKCS7* pkcs7, void* heap)
|
||||
{
|
||||
if (pkcs7 == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
pkcs7->heap = heap;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* init PKCS7 struct with recipient cert, decode into DecodedCert */
|
||||
int wc_PKCS7_InitWithCert(PKCS7* pkcs7, byte* cert, word32 certSz)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
XMEMSET(pkcs7, 0, sizeof(PKCS7));
|
||||
|
||||
/* default heap hint is null or test value */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
pkcs7->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
#else
|
||||
pkcs7->heap = NULL;
|
||||
#endif
|
||||
|
||||
if (cert != NULL && certSz > 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
DecodedCert* dCert;
|
||||
@@ -160,7 +179,7 @@ int wc_PKCS7_InitWithCert(PKCS7* pkcs7, byte* cert, word32 certSz)
|
||||
|
||||
pkcs7->singleCert = cert;
|
||||
pkcs7->singleCertSz = certSz;
|
||||
InitDecodedCert(dCert, cert, certSz, 0);
|
||||
InitDecodedCert(dCert, cert, certSz, pkcs7->heap);
|
||||
|
||||
ret = ParseCert(dCert, CA_TYPE, NO_VERIFY, 0);
|
||||
if (ret < 0) {
|
||||
@@ -435,7 +454,8 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
esd->signedAttribsSz += EncodeAttributes(&esd->signedAttribs[2], 4,
|
||||
pkcs7->signedAttribs, pkcs7->signedAttribsSz);
|
||||
|
||||
flatSignedAttribs = (byte*)XMALLOC(esd->signedAttribsSz, 0, NULL);
|
||||
flatSignedAttribs = (byte*)XMALLOC(esd->signedAttribsSz, pkcs7->heap,
|
||||
DYNAMIC_TYPE_PKCS);
|
||||
flatSignedAttribsSz = esd->signedAttribsSz;
|
||||
if (flatSignedAttribs == NULL) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
@@ -475,7 +495,7 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
|
||||
ret = wc_InitSha(&esd->sha);
|
||||
if (ret < 0) {
|
||||
XFREE(flatSignedAttribs, 0, NULL);
|
||||
XFREE(flatSignedAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(esd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -526,13 +546,13 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
}
|
||||
#endif
|
||||
|
||||
result = wc_InitRsaKey(privKey, NULL);
|
||||
result = wc_InitRsaKey(privKey, pkcs7->heap);
|
||||
if (result == 0)
|
||||
result = wc_RsaPrivateKeyDecode(pkcs7->privateKey, &scratch, privKey,
|
||||
pkcs7->privateKeySz);
|
||||
if (result < 0) {
|
||||
if (pkcs7->signedAttribsSz != 0)
|
||||
XFREE(flatSignedAttribs, 0, NULL);
|
||||
XFREE(flatSignedAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(privKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(digestInfo, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -555,7 +575,7 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
|
||||
if (result < 0) {
|
||||
if (pkcs7->signedAttribsSz != 0)
|
||||
XFREE(flatSignedAttribs, 0, NULL);
|
||||
XFREE(flatSignedAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(esd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -598,7 +618,7 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
|
||||
if (outputSz < totalSz) {
|
||||
if (pkcs7->signedAttribsSz != 0)
|
||||
XFREE(flatSignedAttribs, 0, NULL);
|
||||
XFREE(flatSignedAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(esd, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -657,7 +677,7 @@ int wc_PKCS7_EncodeSignedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
idx += esd->signedAttribSetSz;
|
||||
XMEMCPY(output + idx, flatSignedAttribs, flatSignedAttribsSz);
|
||||
idx += flatSignedAttribsSz;
|
||||
XFREE(flatSignedAttribs, 0, NULL);
|
||||
XFREE(flatSignedAttribs, pkcs7->heap, DYNAMIC_TYPE_PKCS);
|
||||
}
|
||||
|
||||
XMEMCPY(output + idx, esd->digEncAlgoId, esd->digEncAlgoIdSz);
|
||||
@@ -896,7 +916,7 @@ int wc_PKCS7_VerifySignedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz)
|
||||
|
||||
XMEMSET(digest, 0, MAX_PKCS7_DIGEST_SZ);
|
||||
|
||||
ret = wc_InitRsaKey(key, NULL);
|
||||
ret = wc_InitRsaKey(key, pkcs7->heap);
|
||||
if (ret != 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(digest, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -936,8 +956,8 @@ int wc_PKCS7_VerifySignedData(PKCS7* pkcs7, byte* pkiMsg, word32 pkiMsgSz)
|
||||
WOLFSSL_LOCAL int wc_CreateRecipientInfo(const byte* cert, word32 certSz,
|
||||
int keyEncAlgo, int blockKeySz,
|
||||
WC_RNG* rng, byte* contentKeyPlain,
|
||||
byte* contentKeyEnc,
|
||||
int* keyEncSz, byte* out, word32 outSz)
|
||||
byte* contentKeyEnc, int* keyEncSz,
|
||||
byte* out, word32 outSz, void* heap)
|
||||
{
|
||||
word32 idx = 0;
|
||||
int ret = 0, totalSz = 0;
|
||||
@@ -980,7 +1000,7 @@ WOLFSSL_LOCAL int wc_CreateRecipientInfo(const byte* cert, word32 certSz,
|
||||
DecodedCert* decoded = &stack_decoded;
|
||||
#endif
|
||||
|
||||
InitDecodedCert(decoded, (byte*)cert, certSz, 0);
|
||||
InitDecodedCert(decoded, (byte*)cert, certSz, heap);
|
||||
ret = ParseCert(decoded, CA_TYPE, NO_VERIFY, 0);
|
||||
if (ret < 0) {
|
||||
FreeDecodedCert(decoded);
|
||||
@@ -1252,7 +1272,7 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
recipSz = wc_CreateRecipientInfo(pkcs7->singleCert, pkcs7->singleCertSz, RSAk,
|
||||
blockKeySz, &rng, contentKeyPlain,
|
||||
contentKeyEnc, &contentKeyEncSz, recip,
|
||||
MAX_RECIP_SZ);
|
||||
MAX_RECIP_SZ, pkcs7->heap);
|
||||
|
||||
ForceZero(contentKeyEnc, MAX_ENCRYPTED_KEY_SZ);
|
||||
|
||||
@@ -1293,7 +1313,7 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
padSz = DES_BLOCK_SIZE - (pkcs7->contentSz % DES_BLOCK_SIZE);
|
||||
desOutSz = pkcs7->contentSz + padSz;
|
||||
|
||||
plain = (byte*)XMALLOC(desOutSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
plain = (byte*)XMALLOC(desOutSz, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (plain == NULL) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
@@ -1306,9 +1326,10 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
plain[pkcs7->contentSz + i] = (byte)padSz;
|
||||
}
|
||||
|
||||
encryptedContent = (byte*)XMALLOC(desOutSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
encryptedContent = (byte*)XMALLOC(desOutSz, pkcs7->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (encryptedContent == NULL) {
|
||||
XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1324,8 +1345,8 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
oidBlkType, ivOctetStringSz + DES_BLOCK_SIZE);
|
||||
|
||||
if (contentEncAlgoSz == 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1342,8 +1363,8 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
wc_Des_CbcEncrypt(&des, encryptedContent, plain, desOutSz);
|
||||
|
||||
if (ret != 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1359,8 +1380,8 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
ret = wc_Des3_CbcEncrypt(&des3, encryptedContent, plain, desOutSz);
|
||||
|
||||
if (ret != 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1395,8 +1416,8 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
|
||||
if (totalSz > (int)outputSz) {
|
||||
WOLFSSL_MSG("Pkcs7_encrypt output buffer too small");
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1434,8 +1455,8 @@ int wc_PKCS7_EncodeEnvelopedData(PKCS7* pkcs7, byte* output, word32 outputSz)
|
||||
|
||||
ForceZero(contentKeyPlain, MAX_CONTENT_KEY_LEN);
|
||||
|
||||
XFREE(plain, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(plain, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(recip, NULL, DYNAMMIC_TYPE_TMP_BUFFER);
|
||||
@@ -1703,7 +1724,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
|
||||
encryptedContent = (byte*)XMALLOC(encryptedContentSz, NULL,
|
||||
encryptedContent = (byte*)XMALLOC(encryptedContentSz, pkcs7->heap,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (encryptedContent == NULL) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
@@ -1725,7 +1746,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
|
||||
ret = wc_InitRsaKey(privKey, 0);
|
||||
if (ret != 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(privKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -1739,7 +1760,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
pkcs7->privateKeySz);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("Failed to decode RSA private key");
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(privKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -1757,7 +1778,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
#endif
|
||||
|
||||
if (keySz <= 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1774,7 +1795,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
encryptedContentSz);
|
||||
|
||||
if (ret != 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1789,7 +1810,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
encryptedContentSz);
|
||||
|
||||
if (ret != 0) {
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1797,7 +1818,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
}
|
||||
} else {
|
||||
WOLFSSL_MSG("Unsupported content encryption OID type");
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
@@ -1812,7 +1833,7 @@ WOLFSSL_API int wc_PKCS7_DecodeEnvelopedData(PKCS7* pkcs7, byte* pkiMsg,
|
||||
/* free memory, zero out keys */
|
||||
ForceZero(encryptedKey, MAX_ENCRYPTED_KEY_SZ);
|
||||
ForceZero(encryptedContent, encryptedContentSz);
|
||||
XFREE(encryptedContent, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(encryptedKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
|
||||
@@ -403,8 +403,19 @@ int DoPKCS12Hash(int hashType, byte* buffer, word32 totalLen,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int passLen,const byte* salt,
|
||||
int saltLen, int iterations, int kLen, int hashType, int id)
|
||||
{
|
||||
return wc_PKCS12_PBKDF_ex(output, passwd, passLen, salt, saltLen,
|
||||
iterations, kLen, hashType, id, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* extended API that allows a heap hint to be used */
|
||||
int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd, int passLen,
|
||||
const byte* salt, int saltLen, int iterations, int kLen,
|
||||
int hashType, int id, void* heap)
|
||||
{
|
||||
/* all in bytes instead of bits */
|
||||
word32 u, v, dLen, pLen, iLen, sLen, totalLen;
|
||||
@@ -460,7 +471,7 @@ int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int passLen,const byte* sa
|
||||
totalLen = dLen + sLen + pLen;
|
||||
|
||||
if (totalLen > sizeof(staticBuffer)) {
|
||||
buffer = (byte*)XMALLOC(totalLen, 0, DYNAMIC_TYPE_KEY);
|
||||
buffer = (byte*)XMALLOC(totalLen, heap, DYNAMIC_TYPE_KEY);
|
||||
if (buffer == NULL) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(Ai, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -548,7 +559,7 @@ int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int passLen,const byte* sa
|
||||
mp_clear(&B1);
|
||||
}
|
||||
|
||||
if (dynamic) XFREE(buffer, 0, DYNAMIC_TYPE_KEY);
|
||||
if (dynamic) XFREE(buffer, heap, DYNAMIC_TYPE_KEY);
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(Ai, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
@@ -200,10 +200,32 @@ static INLINE int DoKey(Rabbit* ctx, const byte* key, const byte* iv)
|
||||
}
|
||||
|
||||
|
||||
int wc_Rabbit_SetHeap(Rabbit* ctx, void* heap)
|
||||
{
|
||||
if (ctx == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
#ifdef XSTREAM_ALIGN
|
||||
ctx->heap = heap;
|
||||
#endif
|
||||
|
||||
(void)heap;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Key setup */
|
||||
int wc_RabbitSetKey(Rabbit* ctx, const byte* key, const byte* iv)
|
||||
{
|
||||
#ifdef XSTREAM_ALIGN
|
||||
/* default heap to NULL or heap test value */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
ctx->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
#else
|
||||
ctx->heap = NULL;
|
||||
#endif /* WOLFSSL_HEAP_TEST */
|
||||
|
||||
if ((wolfssl_word)key % 4) {
|
||||
int alignKey[4];
|
||||
|
||||
@@ -289,14 +311,14 @@ int wc_RabbitProcess(Rabbit* ctx, byte* output, const byte* input, word32 msglen
|
||||
byte* tmp;
|
||||
WOLFSSL_MSG("wc_RabbitProcess unaligned");
|
||||
|
||||
tmp = (byte*)XMALLOC(msglen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
tmp = (byte*)XMALLOC(msglen, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (tmp == NULL) return MEMORY_E;
|
||||
|
||||
XMEMCPY(tmp, input, msglen);
|
||||
DoProcess(ctx, tmp, tmp, msglen);
|
||||
XMEMCPY(output, tmp, msglen);
|
||||
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
||||
@@ -492,16 +492,23 @@ static int Hash_DRBG_Uninstantiate(DRBG* drbg)
|
||||
|
||||
|
||||
/* Get seed and key cipher */
|
||||
int wc_InitRng(WC_RNG* rng)
|
||||
int wc_InitRng_ex(WC_RNG* rng, void* heap)
|
||||
{
|
||||
int ret = BAD_FUNC_ARG;
|
||||
|
||||
if (rng != NULL) {
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
rng->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
(void)heap;
|
||||
#else
|
||||
rng->heap = heap;
|
||||
#endif
|
||||
if (wc_RNG_HealthTestLocal(0) == 0) {
|
||||
byte entropy[ENTROPY_NONCE_SZ];
|
||||
|
||||
rng->drbg =
|
||||
(struct DRBG*)XMALLOC(sizeof(DRBG), NULL, DYNAMIC_TYPE_RNG);
|
||||
(struct DRBG*)XMALLOC(sizeof(DRBG), rng->heap,
|
||||
DYNAMIC_TYPE_RNG);
|
||||
if (rng->drbg == NULL) {
|
||||
ret = MEMORY_E;
|
||||
}
|
||||
@@ -543,6 +550,11 @@ int wc_InitRng(WC_RNG* rng)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int wc_InitRng(WC_RNG* rng)
|
||||
{
|
||||
return wc_InitRng_ex(rng, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* place a generated block in output */
|
||||
int wc_RNG_GenerateBlock(WC_RNG* rng, byte* output, word32 sz)
|
||||
@@ -611,7 +623,7 @@ int wc_FreeRng(WC_RNG* rng)
|
||||
else
|
||||
ret = RNG_FAILURE_E;
|
||||
|
||||
XFREE(rng->drbg, NULL, DYNAMIC_TYPE_RNG);
|
||||
XFREE(rng->drbg, rng->heap, DYNAMIC_TYPE_RNG);
|
||||
rng->drbg = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ int wc_FreeRsaKey(RsaKey* key)
|
||||
outSz: size of output buffer
|
||||
*/
|
||||
static int wc_MGF1(enum wc_HashType hType, byte* seed, word32 seedSz,
|
||||
byte* out, word32 outSz)
|
||||
byte* out, word32 outSz, void* heap)
|
||||
{
|
||||
byte* tmp;
|
||||
/* needs to be large enough for seed size plus counter(4) */
|
||||
@@ -255,7 +255,7 @@ static int wc_MGF1(enum wc_HashType hType, byte* seed, word32 seedSz,
|
||||
/* find largest amount of memory needed which will be the max of
|
||||
* hLen and (seedSz + 4) since tmp is used to store the hash digest */
|
||||
tmpSz = ((seedSz + 4) > (word32)hLen)? seedSz + 4: (word32)hLen;
|
||||
tmp = (byte*)XMALLOC(tmpSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
tmp = (byte*)XMALLOC(tmpSz, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (tmp == NULL) {
|
||||
return MEMORY_E;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ static int wc_MGF1(enum wc_HashType hType, byte* seed, word32 seedSz,
|
||||
if ((ret = wc_Hash(hType, tmp, (seedSz + 4), tmp, tmpSz)) != 0) {
|
||||
/* check for if dynamic memory was needed, then free */
|
||||
if (tmpF) {
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ static int wc_MGF1(enum wc_HashType hType, byte* seed, word32 seedSz,
|
||||
|
||||
/* check for if dynamic memory was needed, then free */
|
||||
if (tmpF) {
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -307,29 +307,32 @@ static int wc_MGF1(enum wc_HashType hType, byte* seed, word32 seedSz,
|
||||
switeched on type input
|
||||
*/
|
||||
static int wc_MGF(int type, byte* seed, word32 seedSz,
|
||||
byte* out, word32 outSz)
|
||||
byte* out, word32 outSz, void* heap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
switch(type) {
|
||||
#ifndef NO_SHA
|
||||
case WC_MGF1SHA1:
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA, seed, seedSz, out, outSz);
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA, seed, seedSz, out, outSz, heap);
|
||||
break;
|
||||
#endif
|
||||
#ifndef NO_SHA256
|
||||
case WC_MGF1SHA256:
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA256, seed, seedSz, out, outSz);
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA256, seed, seedSz,
|
||||
out, outSz, heap);
|
||||
break;
|
||||
#endif
|
||||
#ifdef WOLFSSL_SHA512
|
||||
#ifdef WOLFSSL_SHA384
|
||||
case WC_MGF1SHA384:
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA384, seed, seedSz, out, outSz);
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA384, seed, seedSz,
|
||||
out, outSz, heap);
|
||||
break;
|
||||
#endif
|
||||
case WC_MGF1SHA512:
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA512, seed, seedSz, out, outSz);
|
||||
ret = wc_MGF1(WC_HASH_TYPE_SHA512, seed, seedSz,
|
||||
out, outSz, heap);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -342,6 +345,7 @@ static int wc_MGF(int type, byte* seed, word32 seedSz,
|
||||
(void)seedSz;
|
||||
(void)out;
|
||||
(void)outSz;
|
||||
(void)heap;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -349,7 +353,8 @@ static int wc_MGF(int type, byte* seed, word32 seedSz,
|
||||
|
||||
static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
word32 pkcsBlockLen, byte padValue, WC_RNG* rng,
|
||||
enum wc_HashType hType, int mgf, byte* optLabel, word32 labelLen)
|
||||
enum wc_HashType hType, int mgf, byte* optLabel,
|
||||
word32 labelLen, void* heap)
|
||||
{
|
||||
int ret;
|
||||
int hLen;
|
||||
@@ -464,7 +469,7 @@ static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
}
|
||||
|
||||
/* create maskedDB from dbMask */
|
||||
dbMask = (byte*)XMALLOC(pkcsBlockLen - hLen - 1, NULL, DYNAMIC_TYPE_RSA);
|
||||
dbMask = (byte*)XMALLOC(pkcsBlockLen - hLen - 1, heap, DYNAMIC_TYPE_RSA);
|
||||
if (dbMask == NULL) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(lHash, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -474,9 +479,9 @@ static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
}
|
||||
XMEMSET(dbMask, 0, pkcsBlockLen - hLen - 1); /* help static analyzer */
|
||||
|
||||
ret = wc_MGF(mgf, seed, hLen, dbMask, pkcsBlockLen - hLen - 1);
|
||||
ret = wc_MGF(mgf, seed, hLen, dbMask, pkcsBlockLen - hLen - 1, heap);
|
||||
if (ret != 0) {
|
||||
XFREE(dbMask, NULL, DYNAMIC_TYPE_RSA);
|
||||
XFREE(dbMask, heap, DYNAMIC_TYPE_RSA);
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(lHash, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(seed, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -490,7 +495,7 @@ static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
pkcsBlock[idx] = dbMask[i++] ^ pkcsBlock[idx];
|
||||
idx++;
|
||||
}
|
||||
XFREE(dbMask, NULL, DYNAMIC_TYPE_RSA);
|
||||
XFREE(dbMask, heap, DYNAMIC_TYPE_RSA);
|
||||
|
||||
|
||||
/* create maskedSeed from seedMask */
|
||||
@@ -498,7 +503,7 @@ static int wc_RsaPad_OAEP(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
pkcsBlock[idx++] = 0x00;
|
||||
/* create seedMask inline */
|
||||
if ((ret = wc_MGF(mgf, pkcsBlock + hLen + 1, pkcsBlockLen - hLen - 1,
|
||||
pkcsBlock + 1, hLen)) != 0) {
|
||||
pkcsBlock + 1, hLen, heap)) != 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(lHash, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(seed, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
@@ -572,8 +577,9 @@ static int wc_RsaPad(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
#ifndef WC_NO_RSA_OAEP
|
||||
/* helper function to direct which padding is used */
|
||||
static int wc_RsaPad_ex(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
word32 pkcsBlockLen, byte padValue, WC_RNG* rng, int padType,
|
||||
enum wc_HashType hType, int mgf, byte* optLabel, word32 labelLen)
|
||||
word32 pkcsBlockLen, byte padValue, WC_RNG* rng,
|
||||
int padType, enum wc_HashType hType, int mgf,
|
||||
byte* optLabel, word32 labelLen, void* heap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -588,7 +594,7 @@ static int wc_RsaPad_ex(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
case WC_RSA_OAEP_PAD:
|
||||
WOLFSSL_MSG("wolfSSL Using RSA OAEP padding");
|
||||
ret = wc_RsaPad_OAEP(input, inputLen, pkcsBlock, pkcsBlockLen,
|
||||
padValue, rng, hType, mgf, optLabel, labelLen);
|
||||
padValue, rng, hType, mgf, optLabel, labelLen, heap);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -602,6 +608,7 @@ static int wc_RsaPad_ex(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
(void)mgf;
|
||||
(void)optLabel;
|
||||
(void)labelLen;
|
||||
(void)heap;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -611,7 +618,7 @@ static int wc_RsaPad_ex(const byte* input, word32 inputLen, byte* pkcsBlock,
|
||||
* < 0 on error */
|
||||
static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
byte **output, enum wc_HashType hType, int mgf,
|
||||
byte* optLabel, word32 labelLen)
|
||||
byte* optLabel, word32 labelLen, void* heap)
|
||||
{
|
||||
int hLen;
|
||||
int ret;
|
||||
@@ -624,7 +631,7 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
tmp = (byte*)XMALLOC(pkcsBlockLen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
tmp = (byte*)XMALLOC(pkcsBlockLen, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
if (tmp == NULL) {
|
||||
return MEMORY_E;
|
||||
}
|
||||
@@ -632,8 +639,8 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
|
||||
/* find seedMask value */
|
||||
if ((ret = wc_MGF(mgf, (byte*)(pkcsBlock + (hLen + 1)),
|
||||
pkcsBlockLen - hLen - 1, tmp, hLen)) != 0) {
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
pkcsBlockLen - hLen - 1, tmp, hLen, heap)) != 0) {
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -644,8 +651,8 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
|
||||
/* get dbMask value */
|
||||
if ((ret = wc_MGF(mgf, tmp, hLen, tmp + hLen,
|
||||
pkcsBlockLen - hLen - 1)) != 0) {
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
pkcsBlockLen - hLen - 1, heap)) != 0) {
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -655,10 +662,10 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
}
|
||||
|
||||
/* done with use of tmp buffer */
|
||||
XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(tmp, heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
/* advance idx to index of PS and msg separator */
|
||||
idx = hLen + 2 + hLen;
|
||||
/* advance idx to index of PS and msg separator, account for PS size of 0*/
|
||||
idx = hLen + 1 + hLen;
|
||||
while (idx < pkcsBlockLen && pkcsBlock[idx] == 0) {idx++;}
|
||||
|
||||
/* create hash of label for comparision with hash sent */
|
||||
@@ -739,7 +746,7 @@ static int RsaUnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
/* helper function to direct unpadding */
|
||||
static int wc_RsaUnPad_ex(byte* pkcsBlock, word32 pkcsBlockLen, byte** out,
|
||||
byte padValue, int padType, enum wc_HashType hType,
|
||||
int mgf, byte* optLabel, word32 labelLen)
|
||||
int mgf, byte* optLabel, word32 labelLen, void* heap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -753,7 +760,7 @@ static int wc_RsaUnPad_ex(byte* pkcsBlock, word32 pkcsBlockLen, byte** out,
|
||||
case WC_RSA_OAEP_PAD:
|
||||
WOLFSSL_MSG("wolfSSL Using RSA OAEP padding");
|
||||
ret = wc_RsaUnPad_OAEP((byte*)pkcsBlock, pkcsBlockLen, out,
|
||||
hType, mgf, optLabel, labelLen);
|
||||
hType, mgf, optLabel, labelLen, heap);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -767,6 +774,7 @@ static int wc_RsaUnPad_ex(byte* pkcsBlock, word32 pkcsBlockLen, byte** out,
|
||||
(void)mgf;
|
||||
(void)optLabel;
|
||||
(void)labelLen;
|
||||
(void)heap;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -940,7 +948,7 @@ int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
|
||||
return RSA_BUFFER_E;
|
||||
|
||||
ret = wc_RsaPad_ex(in, inLen, out, sz, RSA_BLOCK_TYPE_2, rng,
|
||||
type, hash, mgf, label, labelSz);
|
||||
type, hash, mgf, label, labelSz, key->heap);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
@@ -1017,7 +1025,7 @@ int wc_RsaPrivateDecryptInline_ex(byte* in, word32 inLen, byte** out,
|
||||
}
|
||||
|
||||
return wc_RsaUnPad_ex(in, inLen, out, RSA_BLOCK_TYPE_2, type, hash, mgf,
|
||||
label, labelSz);
|
||||
label, labelSz, key->heap);
|
||||
}
|
||||
#endif /* WC_NO_RSA_OAEP */
|
||||
|
||||
|
||||
@@ -254,6 +254,13 @@ int wc_SrpInit(Srp* srp, SrpType type, SrpSide side)
|
||||
|
||||
srp->keyGenFunc_cb = wc_SrpSetKey;
|
||||
|
||||
/* default heap hint to NULL or test value */
|
||||
#ifdef WOLFSSL_HEAP_TEST
|
||||
srp->heap = (void*)WOLFSSL_HEAP_TEST;
|
||||
#else
|
||||
srp->heap = NULL;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -263,12 +270,18 @@ void wc_SrpTerm(Srp* srp)
|
||||
mp_clear(&srp->N); mp_clear(&srp->g);
|
||||
mp_clear(&srp->auth); mp_clear(&srp->priv);
|
||||
|
||||
if (srp->salt) {
|
||||
ForceZero(srp->salt, srp->saltSz);
|
||||
XFREE(srp->salt, NULL, DYNAMIC_TYPE_SRP);
|
||||
XFREE(srp->salt, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
}
|
||||
if (srp->user) {
|
||||
ForceZero(srp->user, srp->userSz);
|
||||
XFREE(srp->user, NULL, DYNAMIC_TYPE_SRP);
|
||||
XFREE(srp->user, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
}
|
||||
if (srp->key) {
|
||||
ForceZero(srp->key, srp->keySz);
|
||||
XFREE(srp->key, NULL, DYNAMIC_TYPE_SRP);
|
||||
XFREE(srp->key, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
}
|
||||
|
||||
ForceZero(srp, sizeof(Srp));
|
||||
}
|
||||
@@ -279,7 +292,7 @@ int wc_SrpSetUsername(Srp* srp, const byte* username, word32 size)
|
||||
if (!srp || !username)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
srp->user = (byte*)XMALLOC(size, NULL, DYNAMIC_TYPE_SRP);
|
||||
srp->user = (byte*)XMALLOC(size, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
if (srp->user == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
@@ -322,10 +335,10 @@ int wc_SrpSetParams(Srp* srp, const byte* N, word32 nSz,
|
||||
/* Set salt */
|
||||
if (srp->salt) {
|
||||
ForceZero(srp->salt, srp->saltSz);
|
||||
XFREE(srp->salt, NULL, DYNAMIC_TYPE_SRP);
|
||||
XFREE(srp->salt, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
}
|
||||
|
||||
srp->salt = (byte*)XMALLOC(saltSz, NULL, DYNAMIC_TYPE_SRP);
|
||||
srp->salt = (byte*)XMALLOC(saltSz, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
if (srp->salt == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
@@ -415,7 +428,7 @@ int wc_SrpGetVerifier(Srp* srp, byte* verifier, word32* size)
|
||||
if (!srp || !verifier || !size || srp->side != SRP_CLIENT_SIDE)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (mp_iszero(&srp->auth))
|
||||
if (mp_iszero(&srp->auth) == MP_YES)
|
||||
return SRP_CALL_ORDER_E;
|
||||
|
||||
r = mp_init(&v);
|
||||
@@ -449,7 +462,7 @@ int wc_SrpSetPrivate(Srp* srp, const byte* private, word32 size)
|
||||
if (!srp || !private || !size)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (mp_iszero(&srp->auth))
|
||||
if (mp_iszero(&srp->auth) == MP_YES)
|
||||
return SRP_CALL_ORDER_E;
|
||||
|
||||
r = mp_init(&p);
|
||||
@@ -457,7 +470,7 @@ int wc_SrpSetPrivate(Srp* srp, const byte* private, word32 size)
|
||||
return MP_INIT_E;
|
||||
if (!r) r = mp_read_unsigned_bin(&p, private, size);
|
||||
if (!r) r = mp_mod(&p, &srp->N, &srp->priv);
|
||||
if (!r) r = mp_iszero(&srp->priv) ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_iszero(&srp->priv) == MP_YES ? SRP_BAD_KEY_E : 0;
|
||||
|
||||
mp_clear(&p);
|
||||
|
||||
@@ -486,7 +499,7 @@ int wc_SrpGetPublic(Srp* srp, byte* pub, word32* size)
|
||||
if (!srp || !pub || !size)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (mp_iszero(&srp->auth))
|
||||
if (mp_iszero(&srp->auth) == MP_YES)
|
||||
return SRP_CALL_ORDER_E;
|
||||
|
||||
modulusSz = mp_unsigned_bin_size(&srp->N);
|
||||
@@ -498,7 +511,7 @@ int wc_SrpGetPublic(Srp* srp, byte* pub, word32* size)
|
||||
return MP_INIT_E;
|
||||
|
||||
/* priv = random() */
|
||||
if (mp_iszero(&srp->priv))
|
||||
if (mp_iszero(&srp->priv) == MP_YES)
|
||||
r = wc_SrpGenPrivate(srp, pub, modulusSz);
|
||||
|
||||
/* client side: A = g ^ a % N */
|
||||
@@ -511,7 +524,7 @@ int wc_SrpGetPublic(Srp* srp, byte* pub, word32* size)
|
||||
|
||||
if (mp_init_multi(&i, &j, 0, 0, 0, 0) == MP_OKAY) {
|
||||
if (!r) r = mp_read_unsigned_bin(&i, srp->k,SrpHashSize(srp->type));
|
||||
if (!r) r = mp_iszero(&i) ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_iszero(&i) == MP_YES ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_exptmod(&srp->g, &srp->priv, &srp->N, &pubkey);
|
||||
if (!r) r = mp_mulmod(&i, &srp->auth, &srp->N, &j);
|
||||
if (!r) r = mp_add(&j, &pubkey, &i);
|
||||
@@ -538,7 +551,7 @@ static int wc_SrpSetKey(Srp* srp, byte* secret, word32 size)
|
||||
byte counter[4];
|
||||
int r = BAD_FUNC_ARG;
|
||||
|
||||
srp->key = (byte*)XMALLOC(2 * digestSz, NULL, DYNAMIC_TYPE_SRP);
|
||||
srp->key = (byte*)XMALLOC(2 * digestSz, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
if (srp->key == NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
@@ -588,7 +601,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
|
||||
|| !serverPubKey || serverPubKeySz == 0)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (mp_iszero(&srp->priv))
|
||||
if (mp_iszero(&srp->priv) == MP_YES)
|
||||
return SRP_CALL_ORDER_E;
|
||||
|
||||
/* initializing variables */
|
||||
@@ -599,11 +612,11 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
|
||||
digestSz = SrpHashSize(srp->type);
|
||||
secretSz = mp_unsigned_bin_size(&srp->N);
|
||||
|
||||
if ((secret = (byte*)XMALLOC(secretSz, NULL, DYNAMIC_TYPE_SRP)) == NULL)
|
||||
if ((secret = (byte*)XMALLOC(secretSz, srp->heap, DYNAMIC_TYPE_SRP)) ==NULL)
|
||||
return MEMORY_E;
|
||||
|
||||
if ((r = mp_init_multi(&u, &s, &temp1, &temp2, 0, 0)) != MP_OKAY) {
|
||||
XFREE(secret, NULL, DYNAMIC_TYPE_SRP);
|
||||
XFREE(secret, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -629,11 +642,11 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
|
||||
|
||||
/* temp1 = B - k * v; rejects k == 0, B == 0 and B >= N. */
|
||||
r = mp_read_unsigned_bin(&temp1, srp->k, digestSz);
|
||||
if (!r) r = mp_iszero(&temp1) ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_iszero(&temp1) == MP_YES ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_exptmod(&srp->g, &srp->auth, &srp->N, &temp2);
|
||||
if (!r) r = mp_mulmod(&temp1, &temp2, &srp->N, &s);
|
||||
if (!r) r = mp_read_unsigned_bin(&temp2, serverPubKey, serverPubKeySz);
|
||||
if (!r) r = mp_iszero(&temp2) ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_iszero(&temp2) == MP_YES ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_cmp(&temp2, &srp->N) != MP_LT ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_sub(&temp2, &s, &temp1);
|
||||
|
||||
@@ -650,7 +663,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
|
||||
|
||||
/* temp2 = A * temp1 % N; rejects A == 0, A >= N */
|
||||
if (!r) r = mp_read_unsigned_bin(&s, clientPubKey, clientPubKeySz);
|
||||
if (!r) r = mp_iszero(&s) ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_iszero(&s) == MP_YES ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_cmp(&s, &srp->N) != MP_LT ? SRP_BAD_KEY_E : 0;
|
||||
if (!r) r = mp_mulmod(&s, &temp1, &srp->N, &temp2);
|
||||
|
||||
@@ -679,7 +692,7 @@ int wc_SrpComputeKey(Srp* srp, byte* clientPubKey, word32 clientPubKeySz,
|
||||
|
||||
if (!r) r = SrpHashUpdate(&srp->server_proof, clientPubKey, clientPubKeySz);
|
||||
|
||||
XFREE(secret, NULL, DYNAMIC_TYPE_SRP);
|
||||
XFREE(secret, srp->heap, DYNAMIC_TYPE_SRP);
|
||||
mp_clear(&u); mp_clear(&s); mp_clear(&temp1); mp_clear(&temp2);
|
||||
|
||||
return r;
|
||||
|
||||
@@ -104,7 +104,7 @@ void fp_add(fp_int *a, fp_int *b, fp_int *c)
|
||||
void s_fp_add(fp_int *a, fp_int *b, fp_int *c)
|
||||
{
|
||||
int x, y, oldused;
|
||||
register fp_word t;
|
||||
fp_word t;
|
||||
|
||||
y = MAX(a->used, b->used);
|
||||
oldused = MIN(c->used, FP_SIZE); /* help static analysis w/ largest size */
|
||||
@@ -323,7 +323,7 @@ void fp_mul_2(fp_int * a, fp_int * b)
|
||||
b->used = a->used;
|
||||
|
||||
{
|
||||
register fp_digit r, rr, *tmpa, *tmpb;
|
||||
fp_digit r, rr, *tmpa, *tmpb;
|
||||
|
||||
/* alias for source */
|
||||
tmpa = a->dp;
|
||||
@@ -498,8 +498,9 @@ void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C)
|
||||
/* execute loop */
|
||||
COMBA_FORWARD;
|
||||
for (iz = 0; iz < iy; ++iz) {
|
||||
/* TAO change COMBA_ADD back to MULADD */
|
||||
MULADD(*tmpx++, *tmpy--);
|
||||
fp_digit _tmpx = *tmpx++;
|
||||
fp_digit _tmpy = *tmpy--;
|
||||
MULADD(_tmpx, _tmpy);
|
||||
}
|
||||
|
||||
/* store term */
|
||||
@@ -662,7 +663,7 @@ void fp_div_2(fp_int * a, fp_int * b)
|
||||
oldused = b->used;
|
||||
b->used = a->used;
|
||||
{
|
||||
register fp_digit r, rr, *tmpa, *tmpb;
|
||||
fp_digit r, rr, *tmpa, *tmpb;
|
||||
|
||||
/* source alias */
|
||||
tmpa = a->dp + b->used - 1;
|
||||
@@ -983,10 +984,55 @@ top:
|
||||
/* d = a * b (mod c) */
|
||||
int fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
||||
{
|
||||
fp_int tmp;
|
||||
fp_init(&tmp);
|
||||
fp_mul(a, b, &tmp);
|
||||
return fp_mod(&tmp, c, d);
|
||||
int err;
|
||||
fp_int t;
|
||||
|
||||
fp_init(&t);
|
||||
fp_mul(a, b, &t);
|
||||
#ifdef ALT_ECC_SIZE
|
||||
err = fp_mod(&t, c, &t);
|
||||
fp_copy(&t, d);
|
||||
#else
|
||||
err = fp_mod(&t, c, d);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* d = a - b (mod c) */
|
||||
int fp_submod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
||||
{
|
||||
int err;
|
||||
fp_int t;
|
||||
|
||||
fp_init(&t);
|
||||
fp_sub(a, b, &t);
|
||||
#ifdef ALT_ECC_SIZE
|
||||
err = fp_mod(&t, c, &t);
|
||||
fp_copy(&t, d);
|
||||
#else
|
||||
err = fp_mod(&t, c, d);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/* d = a + b (mod c) */
|
||||
int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
||||
{
|
||||
int err;
|
||||
fp_int t;
|
||||
|
||||
fp_init(&t);
|
||||
fp_add(a, b, &t);
|
||||
#ifdef ALT_ECC_SIZE
|
||||
err = fp_mod(&t, c, &t);
|
||||
fp_copy(&t, d);
|
||||
#else
|
||||
err = fp_mod(&t, c, d);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef TFM_TIMING_RESISTANT
|
||||
@@ -1056,7 +1102,7 @@ static int _fp_exptmod(fp_int * G, fp_int * X, fp_int * P, fp_int * Y)
|
||||
return FP_OKAY;
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* TFM_TIMING_RESISTANT */
|
||||
|
||||
/* y = g**x (mod b)
|
||||
* Some restrictions... x must be positive and < b
|
||||
@@ -1750,13 +1796,13 @@ void fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp)
|
||||
_c = c + x;
|
||||
tmpm = m->dp;
|
||||
y = 0;
|
||||
#if (defined(TFM_SSE2) || defined(TFM_X86_64))
|
||||
#if defined(INNERMUL8)
|
||||
for (; y < (pa & ~7); y += 8) {
|
||||
INNERMUL8 ;
|
||||
_c += 8;
|
||||
tmpm += 8;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
for (; y < pa; y++) {
|
||||
INNERMUL;
|
||||
++_c;
|
||||
@@ -1791,7 +1837,7 @@ void fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp)
|
||||
}
|
||||
}
|
||||
|
||||
void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c)
|
||||
void fp_read_unsigned_bin(fp_int *a, const unsigned char *b, int c)
|
||||
{
|
||||
/* zero the int */
|
||||
fp_zero (a);
|
||||
@@ -1978,7 +2024,7 @@ void fp_lshd(fp_int *a, int x)
|
||||
/* right shift by bit count */
|
||||
void fp_rshb(fp_int *c, int x)
|
||||
{
|
||||
register fp_digit *tmpc, mask, shift;
|
||||
fp_digit *tmpc, mask, shift;
|
||||
fp_digit r, rr;
|
||||
fp_digit D = x;
|
||||
|
||||
@@ -2057,6 +2103,7 @@ void fp_sub_d(fp_int *a, fp_digit b, fp_int *c)
|
||||
fp_init(&tmp);
|
||||
fp_set(&tmp, b);
|
||||
fp_sub(a, &tmp, c);
|
||||
fp_clear(&tmp);
|
||||
}
|
||||
|
||||
|
||||
@@ -2146,6 +2193,18 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
return fp_mulmod(a, b, c, d);
|
||||
}
|
||||
|
||||
/* d = a - b (mod c) */
|
||||
int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d)
|
||||
{
|
||||
return fp_submod(a, b, c, d);
|
||||
}
|
||||
|
||||
/* d = a + b (mod c) */
|
||||
int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d)
|
||||
{
|
||||
return fp_addmod(a, b, c, d);
|
||||
}
|
||||
|
||||
/* c = a mod b, 0 <= c < b */
|
||||
int mp_mod (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
@@ -2196,7 +2255,7 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b)
|
||||
/* reads a unsigned char array, assumes the msb is stored first [big endian] */
|
||||
int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c)
|
||||
{
|
||||
fp_read_unsigned_bin(a, (unsigned char *)b, c);
|
||||
fp_read_unsigned_bin(a, b, c);
|
||||
return MP_OKAY;
|
||||
}
|
||||
|
||||
@@ -2263,6 +2322,10 @@ int mp_iszero(mp_int* a)
|
||||
return fp_iszero(a);
|
||||
}
|
||||
|
||||
int mp_isneg(mp_int* a)
|
||||
{
|
||||
return fp_isneg(a);
|
||||
}
|
||||
|
||||
int mp_count_bits (mp_int* a)
|
||||
{
|
||||
@@ -2778,7 +2841,7 @@ void fp_add_d(fp_int *a, fp_digit b, fp_int *c)
|
||||
fp_int tmp;
|
||||
fp_init(&tmp);
|
||||
fp_set(&tmp, b);
|
||||
fp_add(a,&tmp,c);
|
||||
fp_add(a, &tmp, c);
|
||||
}
|
||||
|
||||
/* external compatibility */
|
||||
@@ -2804,6 +2867,9 @@ static int fp_read_radix(fp_int *a, const char *str, int radix)
|
||||
int y, neg;
|
||||
char ch;
|
||||
|
||||
/* set the integer to the default of zero */
|
||||
fp_zero (a);
|
||||
|
||||
/* make sure the radix is ok */
|
||||
if (radix < 2 || radix > 64) {
|
||||
return FP_VAL;
|
||||
@@ -2819,16 +2885,13 @@ static int fp_read_radix(fp_int *a, const char *str, int radix)
|
||||
neg = FP_ZPOS;
|
||||
}
|
||||
|
||||
/* set the integer to the default of zero */
|
||||
fp_zero (a);
|
||||
|
||||
/* process each digit of the string */
|
||||
while (*str) {
|
||||
/* if the radix < 36 the conversion is case insensitive
|
||||
/* if the radix <= 36 the conversion is case insensitive
|
||||
* this allows numbers like 1AB and 1ab to represent the same value
|
||||
* [e.g. in hex]
|
||||
*/
|
||||
ch = (char) ((radix < 36) ? XTOUPPER((unsigned char)*str) : *str);
|
||||
ch = (char)((radix <= 36) ? XTOUPPER((unsigned char)*str) : *str);
|
||||
for (y = 0; y < 64; y++) {
|
||||
if (ch == fp_s_rmap[y]) {
|
||||
break;
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
/* prevent multiple mutex initializations */
|
||||
static volatile int initRefCount = 0;
|
||||
|
||||
/* Used to initialize state for wolfcrypt
|
||||
return 0 on success
|
||||
@@ -47,6 +49,8 @@
|
||||
int wolfCrypt_Init()
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (initRefCount == 0) {
|
||||
#if WOLFSSL_CRYPT_HW_MUTEX
|
||||
/* If crypto hardware mutex protection is enabled, then initialize it */
|
||||
wolfSSL_CryptHwMutexInit();
|
||||
@@ -65,6 +69,9 @@ int wolfCrypt_Init()
|
||||
}
|
||||
#endif
|
||||
|
||||
initRefCount = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -98,9 +98,9 @@ static const int sizeof_client_keypub_der_1024 = sizeof(client_keypub_der_1024);
|
||||
/* ./certs/1024/client-cert.der, 1024-bit */
|
||||
static const unsigned char client_cert_der_1024[] =
|
||||
{
|
||||
0x30, 0x82, 0x03, 0xF9, 0x30, 0x82, 0x03, 0x62, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xD3, 0xDF, 0x98, 0xC4,
|
||||
0x80, 0x1F, 0x1F, 0x6F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x30, 0x82, 0x03, 0xC5, 0x30, 0x82, 0x03, 0x2E, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xE3, 0xD7, 0xA0, 0xFA,
|
||||
0x76, 0xDF, 0x2A, 0xFA, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
|
||||
0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
|
||||
@@ -118,10 +118,10 @@ static const unsigned char client_cert_der_1024[] =
|
||||
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
|
||||
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
|
||||
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
|
||||
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x31, 0x31, 0x32, 0x33,
|
||||
0x31, 0x32, 0x34, 0x39, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31,
|
||||
0x38, 0x30, 0x38, 0x31, 0x39, 0x31, 0x32, 0x34, 0x39, 0x33,
|
||||
0x37, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06,
|
||||
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x30, 0x35, 0x30, 0x37,
|
||||
0x31, 0x38, 0x32, 0x31, 0x30, 0x31, 0x5A, 0x17, 0x0D, 0x31,
|
||||
0x38, 0x30, 0x31, 0x33, 0x31, 0x31, 0x38, 0x32, 0x31, 0x30,
|
||||
0x31, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06,
|
||||
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10,
|
||||
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D,
|
||||
0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E,
|
||||
@@ -153,8 +153,8 @@ static const unsigned char client_cert_der_1024[] =
|
||||
0x4C, 0xE8, 0xC1, 0xFD, 0x4A, 0x6F, 0x2B, 0x1F, 0xEF, 0x8A,
|
||||
0xAE, 0xF6, 0x90, 0x62, 0xE5, 0x64, 0x1E, 0xEB, 0x2B, 0x3C,
|
||||
0x67, 0xC8, 0xDC, 0x27, 0x00, 0xF6, 0x91, 0x68, 0x65, 0xA9,
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x3B, 0x30,
|
||||
0x82, 0x01, 0x37, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x07, 0x30,
|
||||
0x82, 0x01, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
|
||||
0x04, 0x16, 0x04, 0x14, 0x81, 0x69, 0x0F, 0xF8, 0xDF, 0xDD,
|
||||
0xCF, 0x34, 0x29, 0xD5, 0x67, 0x75, 0x71, 0x85, 0xC7, 0x75,
|
||||
0x10, 0x69, 0x59, 0xEC, 0x30, 0x81, 0xD3, 0x06, 0x03, 0x55,
|
||||
@@ -178,29 +178,23 @@ static const unsigned char client_cert_der_1024[] =
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
|
||||
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
|
||||
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
|
||||
0xD3, 0xDF, 0x98, 0xC4, 0x80, 0x1F, 0x1F, 0x6F, 0x30, 0x0C,
|
||||
0xE3, 0xD7, 0xA0, 0xFA, 0x76, 0xDF, 0x2A, 0xFA, 0x30, 0x0C,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
|
||||
0x01, 0xFF, 0x30, 0x32, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05,
|
||||
0x05, 0x07, 0x01, 0x01, 0x04, 0x26, 0x30, 0x24, 0x30, 0x22,
|
||||
0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01,
|
||||
0x86, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x6C,
|
||||
0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74, 0x3A, 0x32,
|
||||
0x32, 0x32, 0x32, 0x32, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03,
|
||||
0x81, 0x81, 0x00, 0x71, 0x39, 0xFA, 0x86, 0xC3, 0x54, 0xE5,
|
||||
0x98, 0xB5, 0xE8, 0xC3, 0xCB, 0x97, 0x2F, 0x86, 0xBF, 0xE8,
|
||||
0xBC, 0xFB, 0xEB, 0xD8, 0x73, 0x97, 0x34, 0x9A, 0x16, 0xBF,
|
||||
0xE0, 0xB2, 0xBD, 0xBE, 0x7D, 0xFF, 0xA0, 0xD7, 0xE6, 0xDB,
|
||||
0xA3, 0x52, 0x43, 0x41, 0x60, 0xF1, 0xD7, 0xC3, 0x63, 0xC0,
|
||||
0x9B, 0xE2, 0xB2, 0x28, 0x87, 0x70, 0x60, 0x5D, 0x2B, 0x5D,
|
||||
0x56, 0x15, 0x3C, 0xB1, 0x1E, 0x03, 0x53, 0x72, 0x39, 0x32,
|
||||
0xE2, 0x47, 0x85, 0xF7, 0x8B, 0xE8, 0x38, 0x50, 0xA9, 0xC9,
|
||||
0xD3, 0x52, 0x75, 0x0E, 0x16, 0x14, 0xA5, 0xA5, 0xC4, 0x9F,
|
||||
0x3E, 0x73, 0xD8, 0x38, 0x79, 0xBF, 0xF7, 0x9B, 0x4D, 0x0D,
|
||||
0xF3, 0xAA, 0xCE, 0xA2, 0x03, 0x84, 0x66, 0x14, 0xC9, 0x01,
|
||||
0xF5, 0x86, 0xA5, 0x66, 0xA1, 0xCA, 0x6A, 0x71, 0x5F, 0x2D,
|
||||
0x31, 0x8E, 0x1C, 0xCC, 0x0C, 0xE6, 0x46, 0x99, 0x5D, 0x0A,
|
||||
0x4C
|
||||
0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x81, 0x81,
|
||||
0x00, 0x1D, 0xB7, 0xD5, 0x7C, 0xE1, 0xB1, 0xD8, 0xC0, 0x67,
|
||||
0x5D, 0xB5, 0xD3, 0x88, 0xE7, 0x50, 0x29, 0x71, 0x63, 0x8F,
|
||||
0xCC, 0x26, 0x1F, 0x33, 0x09, 0x55, 0x43, 0x9B, 0xAB, 0xC6,
|
||||
0x1B, 0xBC, 0xC7, 0x01, 0x95, 0x1A, 0xFA, 0x65, 0xE0, 0xFD,
|
||||
0x9C, 0xEB, 0x6F, 0x0A, 0x0F, 0x14, 0xEC, 0xB5, 0x2F, 0xDC,
|
||||
0x1C, 0x30, 0xDD, 0x52, 0x97, 0xD4, 0x1C, 0x09, 0x00, 0x33,
|
||||
0x38, 0x5F, 0xCB, 0xA8, 0x16, 0x8F, 0x11, 0xB7, 0xB8, 0xD0,
|
||||
0x66, 0xE1, 0x54, 0x28, 0xF3, 0x3F, 0xBF, 0x6A, 0x6F, 0x76,
|
||||
0x48, 0x2A, 0x5E, 0x56, 0xA7, 0xCE, 0x1C, 0xF0, 0x04, 0xDD,
|
||||
0x17, 0xBD, 0x06, 0x78, 0x21, 0x6D, 0xD6, 0xB1, 0x9B, 0x75,
|
||||
0x31, 0x92, 0xC1, 0xFE, 0xD4, 0x8D, 0xD4, 0x67, 0x2F, 0x03,
|
||||
0x1B, 0x27, 0x8D, 0xAB, 0xFF, 0x30, 0x3B, 0xC3, 0x7F, 0x23,
|
||||
0xE4, 0xAB, 0x5B, 0x91, 0xE1, 0x1B, 0x66, 0xE6, 0xED
|
||||
};
|
||||
static const int sizeof_client_cert_der_1024 = sizeof(client_cert_der_1024);
|
||||
|
||||
@@ -781,9 +775,9 @@ static const int sizeof_client_keypub_der_2048 = sizeof(client_keypub_der_2048);
|
||||
/* ./certs/client-cert.der, 2048-bit */
|
||||
static const unsigned char client_cert_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0xFE, 0x30, 0x82, 0x03, 0xE6, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x95, 0x90, 0x12, 0x9B,
|
||||
0x22, 0xA1, 0x50, 0x40, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x30, 0x82, 0x04, 0xCA, 0x30, 0x82, 0x03, 0xB2, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xAA, 0x27, 0xB3, 0xC5,
|
||||
0xA9, 0x72, 0x6E, 0x0D, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
|
||||
0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
|
||||
@@ -801,10 +795,10 @@ static const unsigned char client_cert_der_2048[] =
|
||||
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
|
||||
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
|
||||
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
|
||||
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x31, 0x31, 0x32, 0x33,
|
||||
0x31, 0x32, 0x34, 0x39, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31,
|
||||
0x38, 0x30, 0x38, 0x31, 0x39, 0x31, 0x32, 0x34, 0x39, 0x33,
|
||||
0x37, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06,
|
||||
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x30, 0x35, 0x30, 0x37,
|
||||
0x31, 0x38, 0x32, 0x31, 0x30, 0x31, 0x5A, 0x17, 0x0D, 0x31,
|
||||
0x38, 0x30, 0x31, 0x33, 0x31, 0x31, 0x38, 0x32, 0x31, 0x30,
|
||||
0x31, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x0B, 0x30, 0x09, 0x06,
|
||||
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10,
|
||||
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D,
|
||||
0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E,
|
||||
@@ -850,7 +844,7 @@ static const unsigned char client_cert_der_2048[] =
|
||||
0x30, 0xC4, 0x97, 0x84, 0x86, 0x2D, 0x56, 0x2F, 0xD7, 0x15,
|
||||
0xF7, 0x7F, 0xC0, 0xAE, 0xF5, 0xFC, 0x5B, 0xE5, 0xFB, 0xA1,
|
||||
0xBA, 0xD3, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01,
|
||||
0x3B, 0x30, 0x82, 0x01, 0x37, 0x30, 0x1D, 0x06, 0x03, 0x55,
|
||||
0x07, 0x30, 0x82, 0x01, 0x03, 0x30, 0x1D, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x33, 0xD8, 0x45, 0x66,
|
||||
0xD7, 0x68, 0x87, 0x18, 0x7E, 0x54, 0x0D, 0x70, 0x27, 0x91,
|
||||
0xC7, 0x26, 0xD7, 0x85, 0x65, 0xC0, 0x30, 0x81, 0xD3, 0x06,
|
||||
@@ -874,42 +868,37 @@ static const unsigned char client_cert_der_2048[] =
|
||||
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09,
|
||||
0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F,
|
||||
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82,
|
||||
0x09, 0x00, 0x95, 0x90, 0x12, 0x9B, 0x22, 0xA1, 0x50, 0x40,
|
||||
0x09, 0x00, 0xAA, 0x27, 0xB3, 0xC5, 0xA9, 0x72, 0x6E, 0x0D,
|
||||
0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30,
|
||||
0x03, 0x01, 0x01, 0xFF, 0x30, 0x32, 0x06, 0x08, 0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x26, 0x30, 0x24,
|
||||
0x30, 0x22, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07,
|
||||
0x30, 0x01, 0x86, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F,
|
||||
0x2F, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74,
|
||||
0x3A, 0x32, 0x32, 0x32, 0x32, 0x32, 0x30, 0x0D, 0x06, 0x09,
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05,
|
||||
0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x7B, 0x91, 0x63, 0x8D,
|
||||
0x39, 0x54, 0x64, 0x3C, 0xB4, 0x3F, 0xD5, 0xC8, 0x4F, 0xBF,
|
||||
0x0B, 0xBF, 0xAF, 0x5C, 0x9C, 0x41, 0xC7, 0x0B, 0x52, 0x6D,
|
||||
0xC6, 0xF0, 0xDE, 0x7C, 0xFF, 0x9B, 0x4E, 0xFE, 0xF3, 0x22,
|
||||
0xA5, 0x00, 0x13, 0x9F, 0x81, 0xE4, 0x6D, 0x70, 0x2C, 0xF9,
|
||||
0x7A, 0xF4, 0xD8, 0x50, 0xBE, 0x72, 0xE1, 0x04, 0x8B, 0xB0,
|
||||
0x05, 0xE3, 0x61, 0x82, 0x3F, 0x65, 0xDE, 0xF9, 0xE9, 0xD3,
|
||||
0x3D, 0x97, 0x7D, 0x88, 0xB7, 0x99, 0x85, 0xC1, 0xE5, 0x5C,
|
||||
0x57, 0xA7, 0x9C, 0x1F, 0xF2, 0xB8, 0xCE, 0xEC, 0xD7, 0xD1,
|
||||
0x9B, 0xEC, 0xFB, 0x0E, 0x6F, 0x02, 0xAD, 0x51, 0xC0, 0x76,
|
||||
0xDD, 0x66, 0x0A, 0xCE, 0x0D, 0x09, 0xE6, 0xA8, 0x42, 0xB0,
|
||||
0x06, 0xC3, 0x04, 0xE7, 0x1C, 0xC7, 0x10, 0x83, 0x07, 0xF2,
|
||||
0xE6, 0x11, 0x1A, 0xCD, 0xA7, 0xB9, 0x7E, 0x17, 0xEF, 0xEA,
|
||||
0x63, 0x9C, 0xF2, 0xA5, 0xBE, 0x6B, 0xB6, 0xDF, 0xEB, 0x5A,
|
||||
0x75, 0x01, 0x59, 0x05, 0xF7, 0xEC, 0x49, 0x75, 0x10, 0xDD,
|
||||
0x40, 0x1A, 0x25, 0x25, 0x4F, 0x78, 0x6E, 0xE1, 0x92, 0x21,
|
||||
0xB5, 0xB8, 0x82, 0x2F, 0x33, 0xB3, 0x5B, 0xB6, 0x81, 0xB8,
|
||||
0xB1, 0xA4, 0x0C, 0x8D, 0x98, 0x74, 0x74, 0xDA, 0x0D, 0x90,
|
||||
0x33, 0xC8, 0xA7, 0xAA, 0x0D, 0x06, 0x5A, 0x04, 0xEB, 0x37,
|
||||
0xD3, 0xE4, 0x55, 0x0C, 0x93, 0xB6, 0xC8, 0x3A, 0xE8, 0xA7,
|
||||
0x2B, 0x4E, 0xB8, 0x90, 0xBB, 0x36, 0x0B, 0xDB, 0x7F, 0x2E,
|
||||
0x99, 0x23, 0x76, 0x68, 0x81, 0xA8, 0x73, 0x74, 0xE7, 0x68,
|
||||
0xFB, 0x1D, 0xFF, 0x5B, 0xEC, 0xB5, 0x6B, 0x30, 0xD1, 0xD0,
|
||||
0x2B, 0x89, 0xA6, 0xC6, 0xA9, 0xFC, 0x03, 0x66, 0xFE, 0xB5,
|
||||
0x8C, 0xAF, 0xDE, 0x8E, 0x2A, 0xB4, 0x78, 0x9C, 0xD7, 0x4A,
|
||||
0xFC, 0x9C, 0xC4, 0x7C, 0x19, 0x20, 0x83, 0x0E, 0xFD, 0x3F,
|
||||
0x4D, 0xA7
|
||||
0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03,
|
||||
0x82, 0x01, 0x01, 0x00, 0x51, 0x96, 0xA7, 0x1C, 0x26, 0x5D,
|
||||
0x1C, 0x90, 0xC6, 0x32, 0x9F, 0x96, 0x15, 0xF2, 0x1D, 0xE7,
|
||||
0x93, 0x9C, 0xAC, 0x75, 0x56, 0x95, 0xFD, 0x20, 0x70, 0xAB,
|
||||
0x45, 0x6A, 0x09, 0xB0, 0xF3, 0xF2, 0x03, 0xA8, 0xDB, 0xDC,
|
||||
0x2F, 0xBC, 0x1F, 0x87, 0x7A, 0xA3, 0xD4, 0x8F, 0xD5, 0x49,
|
||||
0x97, 0x7E, 0x3C, 0x54, 0xAC, 0xB1, 0xE3, 0xF0, 0x39, 0x0D,
|
||||
0xFE, 0x09, 0x9A, 0x23, 0xF6, 0x32, 0xA6, 0x41, 0x59, 0xBD,
|
||||
0x60, 0xE8, 0xBD, 0xDE, 0x00, 0x36, 0x6F, 0x3E, 0xE9, 0x41,
|
||||
0x6F, 0xA9, 0x63, 0xC7, 0xAA, 0xD5, 0x7B, 0xF3, 0xE4, 0x39,
|
||||
0x48, 0x9E, 0xF6, 0x60, 0xC6, 0xC6, 0x86, 0xD5, 0x72, 0x86,
|
||||
0x23, 0xCD, 0xF5, 0x6A, 0x63, 0x53, 0xA4, 0xF8, 0xFC, 0x51,
|
||||
0x6A, 0xCD, 0x60, 0x74, 0x8E, 0xA3, 0x86, 0x61, 0x01, 0x34,
|
||||
0x78, 0xF7, 0x29, 0x97, 0xB3, 0xA7, 0x34, 0xB6, 0x0A, 0xDE,
|
||||
0xB5, 0x71, 0x7A, 0x09, 0xA6, 0x3E, 0xD6, 0x82, 0x58, 0x89,
|
||||
0x67, 0x9C, 0xC5, 0x68, 0x62, 0xBA, 0x06, 0xD6, 0x39, 0xBB,
|
||||
0xCB, 0x3A, 0xC0, 0xE0, 0x63, 0x1F, 0xC7, 0x0C, 0x9C, 0x12,
|
||||
0x86, 0xEC, 0xF7, 0x39, 0x6A, 0x61, 0x93, 0xD0, 0x33, 0x14,
|
||||
0xC6, 0x55, 0x3B, 0xB6, 0xCF, 0x80, 0x5B, 0x8C, 0x43, 0xEF,
|
||||
0x43, 0x44, 0x0B, 0x3C, 0x93, 0x39, 0xA3, 0x4E, 0x15, 0xD1,
|
||||
0x0B, 0x5F, 0x84, 0x98, 0x1D, 0xCD, 0x9F, 0xA9, 0x47, 0xEB,
|
||||
0x3B, 0x56, 0x30, 0xB6, 0x76, 0x92, 0xC1, 0x48, 0x5F, 0xBC,
|
||||
0x95, 0xB0, 0x50, 0x1A, 0x55, 0xC8, 0x4E, 0x62, 0x47, 0x87,
|
||||
0x54, 0x64, 0x0C, 0x9B, 0x91, 0xFA, 0x43, 0xB3, 0x29, 0x48,
|
||||
0xBE, 0xE6, 0x12, 0xEB, 0xE3, 0x44, 0xC6, 0x52, 0xE4, 0x40,
|
||||
0xC6, 0x83, 0x95, 0x1B, 0xA7, 0x65, 0x27, 0x69, 0x73, 0x2F,
|
||||
0xC8, 0xA0, 0x4D, 0x7F, 0xBE, 0xEA, 0x9B, 0x67, 0xB2, 0x7B
|
||||
|
||||
};
|
||||
static const int sizeof_client_cert_der_2048 = sizeof(client_cert_der_2048);
|
||||
|
||||
@@ -1165,9 +1154,9 @@ static const int sizeof_rsa_key_der_2048 = sizeof(rsa_key_der_2048);
|
||||
/* ./certs/ca-cert.der, 2048-bit */
|
||||
static const unsigned char ca_cert_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0xE0, 0x30, 0x82, 0x03, 0xC8, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xA6, 0x66, 0x38, 0x49,
|
||||
0x45, 0x9B, 0xDC, 0x81, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x30, 0x82, 0x04, 0xAA, 0x30, 0x82, 0x03, 0x92, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xD9, 0x80, 0x3A, 0xC3,
|
||||
0xD2, 0xF4, 0xDA, 0x37, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x30,
|
||||
0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
|
||||
0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06,
|
||||
@@ -1184,10 +1173,10 @@ static const unsigned char ca_cert_der_2048[] =
|
||||
0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
|
||||
0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77,
|
||||
0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D,
|
||||
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x31, 0x31, 0x32, 0x33,
|
||||
0x31, 0x32, 0x34, 0x39, 0x33, 0x37, 0x5A, 0x17, 0x0D, 0x31,
|
||||
0x38, 0x30, 0x38, 0x31, 0x39, 0x31, 0x32, 0x34, 0x39, 0x33,
|
||||
0x37, 0x5A, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06,
|
||||
0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x30, 0x35, 0x30, 0x37,
|
||||
0x31, 0x38, 0x32, 0x31, 0x30, 0x31, 0x5A, 0x17, 0x0D, 0x31,
|
||||
0x38, 0x30, 0x31, 0x33, 0x31, 0x31, 0x38, 0x32, 0x31, 0x30,
|
||||
0x31, 0x5A, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06,
|
||||
0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x10,
|
||||
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D,
|
||||
0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E,
|
||||
@@ -1231,66 +1220,60 @@ static const unsigned char ca_cert_der_2048[] =
|
||||
0x13, 0x49, 0x08, 0x16, 0x0B, 0xA7, 0x4D, 0x67, 0x00, 0x52,
|
||||
0x31, 0x67, 0x23, 0x4E, 0x98, 0xED, 0x51, 0x45, 0x1D, 0xB9,
|
||||
0x04, 0xD9, 0x0B, 0xEC, 0xD8, 0x28, 0xB3, 0x4B, 0xBD, 0xED,
|
||||
0x36, 0x79, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01,
|
||||
0x31, 0x30, 0x82, 0x01, 0x2D, 0x30, 0x1D, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x27, 0x8E, 0x67, 0x11,
|
||||
0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63, 0xB3, 0xA4,
|
||||
0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, 0x30, 0x81, 0xC9, 0x06,
|
||||
0x03, 0x55, 0x1D, 0x23, 0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE,
|
||||
0x80, 0x14, 0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D,
|
||||
0x3F, 0xED, 0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5,
|
||||
0xE8, 0xD5, 0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81,
|
||||
0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06,
|
||||
0x13, 0x02, 0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03,
|
||||
0x55, 0x04, 0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61,
|
||||
0x6E, 0x61, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
|
||||
0x07, 0x0C, 0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E,
|
||||
0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C,
|
||||
0x08, 0x53, 0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31,
|
||||
0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A,
|
||||
0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67,
|
||||
0x31, 0x18, 0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
|
||||
0x0F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73,
|
||||
0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D,
|
||||
0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09,
|
||||
0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F,
|
||||
0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82,
|
||||
0x09, 0x00, 0xA6, 0x66, 0x38, 0x49, 0x45, 0x9B, 0xDC, 0x81,
|
||||
0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30,
|
||||
0x03, 0x01, 0x01, 0xFF, 0x30, 0x32, 0x06, 0x08, 0x2B, 0x06,
|
||||
0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x26, 0x30, 0x24,
|
||||
0x30, 0x22, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07,
|
||||
0x30, 0x01, 0x86, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F,
|
||||
0x2F, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74,
|
||||
0x3A, 0x32, 0x32, 0x32, 0x32, 0x32, 0x30, 0x0D, 0x06, 0x09,
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05,
|
||||
0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x41, 0x8F, 0xFB, 0x6B,
|
||||
0x65, 0x6B, 0x36, 0xF2, 0x56, 0x4F, 0x0C, 0x48, 0xB0, 0x4D,
|
||||
0x8C, 0xC2, 0xCB, 0xD6, 0x58, 0x7A, 0x83, 0x3A, 0x30, 0x7D,
|
||||
0x62, 0x7B, 0x86, 0xF1, 0x15, 0x26, 0xB3, 0x26, 0x02, 0x77,
|
||||
0xF2, 0xC8, 0x57, 0xE5, 0x1E, 0x60, 0x68, 0x8B, 0xA4, 0xE8,
|
||||
0xF3, 0xA8, 0xB2, 0x88, 0xA4, 0x2F, 0xE8, 0x6E, 0x25, 0x8D,
|
||||
0x6B, 0xDC, 0x53, 0xAB, 0x2F, 0xD3, 0x47, 0x8C, 0xD6, 0x27,
|
||||
0xAB, 0x39, 0xBC, 0xD3, 0xCA, 0xD8, 0x01, 0x96, 0xA4, 0x44,
|
||||
0x57, 0x38, 0x93, 0xAB, 0xC3, 0xF3, 0x95, 0x67, 0x7F, 0xCF,
|
||||
0x25, 0x1D, 0xB7, 0x04, 0xDC, 0x06, 0xC9, 0x5D, 0x24, 0xC1,
|
||||
0x54, 0x13, 0x71, 0x81, 0x21, 0x31, 0xEE, 0x9F, 0xB4, 0x9D,
|
||||
0xCE, 0x98, 0x66, 0xA4, 0xA0, 0x77, 0xC1, 0x88, 0x18, 0xA4,
|
||||
0xD1, 0x36, 0xEE, 0xCD, 0xD8, 0xC1, 0x1B, 0xBC, 0x03, 0xD6,
|
||||
0x85, 0x9A, 0x2E, 0x21, 0x82, 0x95, 0x4C, 0xB2, 0x2A, 0xFE,
|
||||
0x69, 0xDB, 0xAC, 0xE4, 0x97, 0xE1, 0xE9, 0x0E, 0xF1, 0xD3,
|
||||
0xEF, 0x20, 0x86, 0x03, 0x01, 0x66, 0x6B, 0xF0, 0x26, 0x0F,
|
||||
0x39, 0x04, 0x26, 0xF5, 0x42, 0x98, 0x3F, 0x95, 0x48, 0x5F,
|
||||
0xB5, 0x5D, 0xBC, 0x49, 0x4C, 0x81, 0x38, 0xD5, 0xE9, 0x72,
|
||||
0x32, 0x1C, 0x66, 0x1B, 0x12, 0x80, 0x0F, 0xDB, 0x99, 0xF0,
|
||||
0x97, 0x67, 0x61, 0x79, 0xAD, 0xAB, 0xBE, 0x6A, 0xEA, 0xAA,
|
||||
0xCC, 0x3D, 0xF9, 0x40, 0x99, 0x00, 0x93, 0xBB, 0xDF, 0x4B,
|
||||
0x41, 0xD4, 0x7F, 0xF1, 0x93, 0xB2, 0x70, 0x83, 0x3A, 0xE3,
|
||||
0x6B, 0x44, 0x4B, 0x1F, 0x9F, 0x77, 0x53, 0xEA, 0x5D, 0xE6,
|
||||
0x59, 0x1E, 0xC0, 0x2D, 0x4B, 0x83, 0xD6, 0xF4, 0xA3, 0xD4,
|
||||
0xA9, 0xC3, 0x91, 0x12, 0xE7, 0x61, 0x3F, 0x56, 0x9D, 0x8F,
|
||||
0xB8, 0x19, 0x29, 0x62, 0x1B, 0x58, 0xDF, 0x73, 0x99, 0x1F,
|
||||
0x49, 0x63
|
||||
0x36, 0x79, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0xFC,
|
||||
0x30, 0x81, 0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
|
||||
0x04, 0x16, 0x04, 0x14, 0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3,
|
||||
0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D,
|
||||
0x30, 0xE5, 0xE8, 0xD5, 0x30, 0x81, 0xC9, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x23, 0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE, 0x80, 0x14,
|
||||
0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED,
|
||||
0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5,
|
||||
0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31,
|
||||
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
|
||||
0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61,
|
||||
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
|
||||
0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11,
|
||||
0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53,
|
||||
0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30,
|
||||
0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F,
|
||||
0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18,
|
||||
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
|
||||
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
|
||||
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
|
||||
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
|
||||
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
|
||||
0xD9, 0x80, 0x3A, 0xC3, 0xD2, 0xF4, 0xDA, 0x37, 0x30, 0x0C,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
|
||||
0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
|
||||
0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01,
|
||||
0x01, 0x00, 0x7A, 0xAF, 0x44, 0x3B, 0xAA, 0x6F, 0x53, 0x42,
|
||||
0xB2, 0x33, 0xAA, 0x43, 0x5F, 0x56, 0x30, 0xD3, 0xB9, 0x96,
|
||||
0x0B, 0x9A, 0x55, 0x5A, 0x39, 0x2A, 0x0B, 0x4E, 0xE4, 0x2E,
|
||||
0xF1, 0x95, 0x66, 0xC9, 0x86, 0x36, 0x82, 0x8D, 0x63, 0x7C,
|
||||
0x4D, 0xA2, 0xEE, 0x48, 0xBA, 0x03, 0xC7, 0x90, 0xD7, 0xA7,
|
||||
0xC6, 0x74, 0x60, 0x48, 0x5F, 0x31, 0xA2, 0xF9, 0x5E, 0x3E,
|
||||
0xC3, 0x82, 0xE1, 0xE5, 0x2F, 0x41, 0x81, 0x83, 0x29, 0x25,
|
||||
0x79, 0xD1, 0x53, 0x00, 0x69, 0x3C, 0xED, 0x0A, 0x30, 0x3B,
|
||||
0x41, 0x1D, 0x92, 0xA1, 0x2C, 0xA8, 0x9D, 0x2C, 0xE3, 0x23,
|
||||
0x87, 0x79, 0xE0, 0x55, 0x6E, 0x91, 0xA8, 0x50, 0xDA, 0x46,
|
||||
0x2F, 0xC2, 0x20, 0x50, 0x3E, 0x2B, 0x47, 0x97, 0x14, 0xB0,
|
||||
0x7D, 0x04, 0xBA, 0x45, 0x51, 0xD0, 0x6E, 0xE1, 0x5A, 0xA2,
|
||||
0x4B, 0x84, 0x9C, 0x4D, 0xCD, 0x85, 0x04, 0xF9, 0x28, 0x31,
|
||||
0x82, 0x93, 0xBC, 0xC7, 0x59, 0x49, 0x91, 0x03, 0xE8, 0xDF,
|
||||
0x6A, 0xE4, 0x56, 0xAD, 0x6A, 0xCB, 0x1F, 0x0D, 0x37, 0xE4,
|
||||
0x5E, 0xBD, 0xE7, 0x9F, 0xD5, 0xEC, 0x9D, 0x3C, 0x18, 0x25,
|
||||
0x9B, 0xF1, 0x2F, 0x50, 0x7D, 0xEB, 0x31, 0xCB, 0xF1, 0x63,
|
||||
0x22, 0x9D, 0x57, 0xFC, 0xF3, 0x84, 0x20, 0x1A, 0xC6, 0x07,
|
||||
0x87, 0x92, 0x26, 0x9E, 0x15, 0x18, 0x59, 0x33, 0x06, 0xDC,
|
||||
0xFB, 0xB0, 0xB6, 0x76, 0x5D, 0xF1, 0xC1, 0x2F, 0xC8, 0x2F,
|
||||
0x62, 0x9C, 0xC0, 0xD6, 0xDE, 0xEB, 0x65, 0x77, 0xF3, 0x5C,
|
||||
0xA6, 0xC3, 0x88, 0x27, 0x96, 0x75, 0xB4, 0xF4, 0x54, 0xCD,
|
||||
0xFF, 0x2D, 0x21, 0x2E, 0x96, 0xF0, 0x07, 0x73, 0x4B, 0xE9,
|
||||
0x93, 0x92, 0x90, 0xDE, 0x62, 0xD9, 0xA3, 0x3B, 0xAC, 0x6E,
|
||||
0x24, 0x5F, 0x27, 0x4A, 0xB3, 0x94, 0x70, 0xFF, 0x30, 0x17,
|
||||
0xE7, 0x7E, 0x32, 0x8F, 0x65, 0xB7, 0x75, 0x58
|
||||
};
|
||||
static const int sizeof_ca_cert_der_2048 = sizeof(ca_cert_der_2048);
|
||||
|
||||
@@ -1423,7 +1406,7 @@ static const int sizeof_server_key_der_2048 = sizeof(server_key_der_2048);
|
||||
/* ./certs/server-cert.der, 2048-bit */
|
||||
static const unsigned char server_cert_der_2048[] =
|
||||
{
|
||||
0x30, 0x82, 0x04, 0xD4, 0x30, 0x82, 0x03, 0xBC, 0xA0, 0x03,
|
||||
0x30, 0x82, 0x04, 0x9E, 0x30, 0x82, 0x03, 0x86, 0xA0, 0x03,
|
||||
0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09,
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05,
|
||||
0x00, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03,
|
||||
@@ -1441,10 +1424,10 @@ static const unsigned char server_cert_der_2048[] =
|
||||
0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
|
||||
0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69, 0x6E, 0x66, 0x6F,
|
||||
0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
|
||||
0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x31, 0x31,
|
||||
0x32, 0x33, 0x31, 0x32, 0x34, 0x39, 0x33, 0x37, 0x5A, 0x17,
|
||||
0x0D, 0x31, 0x38, 0x30, 0x38, 0x31, 0x39, 0x31, 0x32, 0x34,
|
||||
0x39, 0x33, 0x37, 0x5A, 0x30, 0x81, 0x90, 0x31, 0x0B, 0x30,
|
||||
0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x35, 0x30, 0x35,
|
||||
0x30, 0x37, 0x31, 0x38, 0x32, 0x31, 0x30, 0x31, 0x5A, 0x17,
|
||||
0x0D, 0x31, 0x38, 0x30, 0x31, 0x33, 0x31, 0x31, 0x38, 0x32,
|
||||
0x31, 0x30, 0x31, 0x5A, 0x30, 0x81, 0x90, 0x31, 0x0B, 0x30,
|
||||
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
|
||||
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
|
||||
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
|
||||
@@ -1488,66 +1471,60 @@ static const unsigned char server_cert_der_2048[] =
|
||||
0x69, 0x42, 0x42, 0x09, 0xE9, 0xD8, 0x08, 0xBC, 0x33, 0x20,
|
||||
0xB3, 0x58, 0x22, 0xA7, 0xAA, 0xEB, 0xC4, 0xE1, 0xE6, 0x61,
|
||||
0x83, 0xC5, 0xD2, 0x96, 0xDF, 0xD9, 0xD0, 0x4F, 0xAD, 0xD7,
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x82, 0x01, 0x31, 0x30,
|
||||
0x82, 0x01, 0x2D, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E,
|
||||
0x04, 0x16, 0x04, 0x14, 0xB3, 0x11, 0x32, 0xC9, 0x92, 0x98,
|
||||
0x84, 0xE2, 0xC9, 0xF8, 0xD0, 0x3B, 0x6E, 0x03, 0x42, 0xCA,
|
||||
0x1F, 0x0E, 0x8E, 0x3C, 0x30, 0x81, 0xC9, 0x06, 0x03, 0x55,
|
||||
0x1D, 0x23, 0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE, 0x80, 0x14,
|
||||
0x27, 0x8E, 0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED,
|
||||
0x33, 0x63, 0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5,
|
||||
0xA1, 0x81, 0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31,
|
||||
0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
|
||||
0x55, 0x53, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04,
|
||||
0x08, 0x0C, 0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61,
|
||||
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C,
|
||||
0x07, 0x42, 0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11,
|
||||
0x30, 0x0F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53,
|
||||
0x61, 0x77, 0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30,
|
||||
0x11, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F,
|
||||
0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18,
|
||||
0x30, 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77,
|
||||
0x77, 0x77, 0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C,
|
||||
0x2E, 0x63, 0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09,
|
||||
0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16,
|
||||
0x10, 0x69, 0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66,
|
||||
0x73, 0x73, 0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00,
|
||||
0xA6, 0x66, 0x38, 0x49, 0x45, 0x9B, 0xDC, 0x81, 0x30, 0x0C,
|
||||
0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
|
||||
0x01, 0xFF, 0x30, 0x32, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05,
|
||||
0x05, 0x07, 0x01, 0x01, 0x04, 0x26, 0x30, 0x24, 0x30, 0x22,
|
||||
0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01,
|
||||
0x86, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x6C,
|
||||
0x6F, 0x63, 0x61, 0x6C, 0x68, 0x6F, 0x73, 0x74, 0x3A, 0x32,
|
||||
0x32, 0x32, 0x32, 0x32, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x05, 0x00, 0x03,
|
||||
0x82, 0x01, 0x01, 0x00, 0x71, 0x17, 0x8F, 0x6F, 0x7D, 0xD6,
|
||||
0x11, 0x01, 0x79, 0xAC, 0xE9, 0xC2, 0xFB, 0x71, 0x69, 0x6B,
|
||||
0x0C, 0x64, 0x91, 0xC1, 0x32, 0x8B, 0x9C, 0x62, 0x72, 0xB5,
|
||||
0x62, 0xBB, 0xF8, 0xCF, 0x6C, 0x27, 0xDF, 0xF0, 0x64, 0xD6,
|
||||
0x4A, 0x55, 0x4F, 0x7F, 0x4A, 0x8B, 0x7B, 0x80, 0x5B, 0x3C,
|
||||
0xA0, 0x31, 0xB0, 0x25, 0x92, 0x02, 0x02, 0x9C, 0x99, 0xA5,
|
||||
0x8E, 0x0C, 0x61, 0xEF, 0xB4, 0x1E, 0x01, 0x2E, 0x1C, 0xE9,
|
||||
0x9C, 0x59, 0x2D, 0xEF, 0x6E, 0x03, 0x4D, 0xF1, 0x59, 0xE5,
|
||||
0x5F, 0x69, 0x66, 0x5C, 0x0A, 0xE6, 0xCD, 0xF6, 0x74, 0x20,
|
||||
0x86, 0x4C, 0xF6, 0x8F, 0x22, 0x86, 0x68, 0x7E, 0xFE, 0x67,
|
||||
0x3F, 0x3D, 0x19, 0xB8, 0x61, 0xEF, 0xC5, 0xA5, 0x58, 0xA8,
|
||||
0x2A, 0xCE, 0xD3, 0x2C, 0xA7, 0x1B, 0xDD, 0xC8, 0x59, 0xC7,
|
||||
0xE7, 0xCF, 0x42, 0x42, 0xDB, 0xAF, 0xFE, 0x15, 0x82, 0xC9,
|
||||
0xE5, 0x53, 0xFA, 0xB4, 0x37, 0x55, 0x67, 0x47, 0x0F, 0xE7,
|
||||
0x24, 0x88, 0x14, 0xA3, 0x6C, 0xBE, 0x5F, 0x72, 0x05, 0x5F,
|
||||
0x56, 0x33, 0xAA, 0x7F, 0xAC, 0x2E, 0x10, 0x92, 0xB7, 0xA2,
|
||||
0xF9, 0xC1, 0x62, 0x0C, 0x3B, 0x0C, 0x69, 0x9A, 0x71, 0x15,
|
||||
0x11, 0xBC, 0x37, 0xBF, 0x8E, 0x23, 0x14, 0xC2, 0xB1, 0x0D,
|
||||
0xDF, 0x89, 0x45, 0x1E, 0xDF, 0x14, 0xE8, 0x95, 0x35, 0x88,
|
||||
0x27, 0xA8, 0xAB, 0xDD, 0x7C, 0x23, 0x3F, 0xBB, 0xFE, 0x4E,
|
||||
0x0E, 0xEA, 0xA6, 0xEE, 0xF5, 0x77, 0xFB, 0xAA, 0xB8, 0x28,
|
||||
0x33, 0xF9, 0x61, 0xB0, 0xD2, 0x79, 0x46, 0xA4, 0xBA, 0xA0,
|
||||
0x90, 0xC8, 0xE7, 0x96, 0x8F, 0x27, 0xE9, 0x1E, 0xD0, 0x92,
|
||||
0x43, 0xBB, 0x84, 0xC7, 0xF3, 0x28, 0x0C, 0x41, 0xAA, 0x77,
|
||||
0x39, 0x65, 0xAA, 0x0D, 0x02, 0xB0, 0xE0, 0x4D, 0xB1, 0x17,
|
||||
0x41, 0xC9, 0xF0, 0xD4, 0x47, 0x87, 0xFB, 0x0F, 0xF0, 0x40
|
||||
|
||||
0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x81, 0xFC, 0x30, 0x81,
|
||||
0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16,
|
||||
0x04, 0x14, 0xB3, 0x11, 0x32, 0xC9, 0x92, 0x98, 0x84, 0xE2,
|
||||
0xC9, 0xF8, 0xD0, 0x3B, 0x6E, 0x03, 0x42, 0xCA, 0x1F, 0x0E,
|
||||
0x8E, 0x3C, 0x30, 0x81, 0xC9, 0x06, 0x03, 0x55, 0x1D, 0x23,
|
||||
0x04, 0x81, 0xC1, 0x30, 0x81, 0xBE, 0x80, 0x14, 0x27, 0x8E,
|
||||
0x67, 0x11, 0x74, 0xC3, 0x26, 0x1D, 0x3F, 0xED, 0x33, 0x63,
|
||||
0xB3, 0xA4, 0xD8, 0x1D, 0x30, 0xE5, 0xE8, 0xD5, 0xA1, 0x81,
|
||||
0x9A, 0xA4, 0x81, 0x97, 0x30, 0x81, 0x94, 0x31, 0x0B, 0x30,
|
||||
0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53,
|
||||
0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C,
|
||||
0x07, 0x4D, 0x6F, 0x6E, 0x74, 0x61, 0x6E, 0x61, 0x31, 0x10,
|
||||
0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x07, 0x42,
|
||||
0x6F, 0x7A, 0x65, 0x6D, 0x61, 0x6E, 0x31, 0x11, 0x30, 0x0F,
|
||||
0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x08, 0x53, 0x61, 0x77,
|
||||
0x74, 0x6F, 0x6F, 0x74, 0x68, 0x31, 0x13, 0x30, 0x11, 0x06,
|
||||
0x03, 0x55, 0x04, 0x0B, 0x0C, 0x0A, 0x43, 0x6F, 0x6E, 0x73,
|
||||
0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x31, 0x18, 0x30, 0x16,
|
||||
0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x77, 0x77, 0x77,
|
||||
0x2E, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73, 0x6C, 0x2E, 0x63,
|
||||
0x6F, 0x6D, 0x31, 0x1F, 0x30, 0x1D, 0x06, 0x09, 0x2A, 0x86,
|
||||
0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x10, 0x69,
|
||||
0x6E, 0x66, 0x6F, 0x40, 0x77, 0x6F, 0x6C, 0x66, 0x73, 0x73,
|
||||
0x6C, 0x2E, 0x63, 0x6F, 0x6D, 0x82, 0x09, 0x00, 0xD9, 0x80,
|
||||
0x3A, 0xC3, 0xD2, 0xF4, 0xDA, 0x37, 0x30, 0x0C, 0x06, 0x03,
|
||||
0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF,
|
||||
0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
|
||||
0x01, 0x01, 0x0B, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00,
|
||||
0x67, 0xC0, 0x2C, 0xA9, 0x43, 0x47, 0xE7, 0x11, 0x14, 0x77,
|
||||
0xAE, 0xCC, 0xD8, 0xE0, 0x6B, 0x23, 0x82, 0x91, 0x63, 0xE8,
|
||||
0xA8, 0x0D, 0x21, 0xC5, 0xC8, 0x47, 0x97, 0x2F, 0xD5, 0xF3,
|
||||
0x86, 0xFB, 0x6C, 0xCE, 0x25, 0xF9, 0x7C, 0x78, 0xC8, 0x3A,
|
||||
0x22, 0x68, 0xF2, 0x16, 0x1E, 0xD2, 0xD2, 0x3F, 0x24, 0x04,
|
||||
0x87, 0xF2, 0xB7, 0xC1, 0x62, 0x63, 0xBA, 0xC5, 0xFA, 0xAE,
|
||||
0xD2, 0x20, 0x81, 0x1A, 0xD2, 0x0C, 0xAE, 0x26, 0x6B, 0x1B,
|
||||
0x2B, 0x10, 0xD3, 0xE1, 0x9A, 0x4E, 0x64, 0x6C, 0x97, 0xDB,
|
||||
0x36, 0xA8, 0x8F, 0xF8, 0x05, 0x63, 0xBF, 0xBA, 0x0D, 0x88,
|
||||
0x0B, 0x87, 0x46, 0xC9, 0xE4, 0x64, 0xE3, 0xD7, 0xBD, 0xB8,
|
||||
0x2D, 0xD5, 0xC1, 0xC3, 0xC4, 0xDB, 0x55, 0x68, 0xDC, 0xA3,
|
||||
0x7A, 0x40, 0xB9, 0xA9, 0xF6, 0x04, 0x4A, 0x22, 0xCF, 0x98,
|
||||
0x76, 0x1C, 0xE4, 0xA3, 0xFF, 0x79, 0x19, 0x96, 0x57, 0x63,
|
||||
0x07, 0x6F, 0xF6, 0x32, 0x77, 0x16, 0x50, 0x9B, 0xE3, 0x34,
|
||||
0x18, 0xD4, 0xEB, 0xBE, 0xFD, 0xB6, 0x6F, 0xE3, 0xC7, 0xF6,
|
||||
0x85, 0xBF, 0xAC, 0x32, 0xAD, 0x98, 0x57, 0xBE, 0x13, 0x92,
|
||||
0x44, 0x10, 0xA5, 0xF3, 0xAE, 0xE2, 0x66, 0xDA, 0x44, 0xA9,
|
||||
0x94, 0x71, 0x3F, 0xD0, 0x2F, 0x20, 0x59, 0x87, 0xE4, 0x5A,
|
||||
0x40, 0xEE, 0xD2, 0xE4, 0x0C, 0xCE, 0x25, 0x94, 0xDC, 0x0F,
|
||||
0xFE, 0x38, 0xE0, 0x41, 0x52, 0x34, 0x5C, 0xBB, 0xC3, 0xDB,
|
||||
0xC1, 0x5F, 0x76, 0xC3, 0x5D, 0x0E, 0x32, 0x69, 0x2B, 0x9D,
|
||||
0x01, 0xED, 0x50, 0x1B, 0x4F, 0x77, 0xA9, 0xA9, 0xD8, 0x71,
|
||||
0x30, 0xCB, 0x2E, 0x2C, 0x70, 0x00, 0xAB, 0x78, 0x4B, 0xD7,
|
||||
0x15, 0xD9, 0x17, 0xF8, 0x64, 0xB2, 0xF7, 0x3A, 0xDA, 0xE1,
|
||||
0x0B, 0x8B, 0x0A, 0xE1, 0x4E, 0xB1, 0x03, 0x46, 0x14, 0xCA,
|
||||
0x94, 0xE3, 0x44, 0x77, 0xD7, 0x59
|
||||
};
|
||||
static const int sizeof_server_cert_der_2048 = sizeof(server_cert_der_2048);
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ enum wolfSSL_ErrorCodes {
|
||||
ECC_KEY_SIZE_E = -410, /* ECC key too small */
|
||||
|
||||
DTLS_EXPORT_VER_E = -411, /* export version error */
|
||||
INPUT_SIZE_E = -412, /* input size too big error */
|
||||
/* add strings to wolfSSL_ERR_reason_error_string in internal.c !!!!! */
|
||||
|
||||
/* begin negotiation parameter errors */
|
||||
|
||||
@@ -959,6 +959,7 @@ enum Misc {
|
||||
DTLS_EXPORT_MIN_KEY_SZ = 75, /* min amount of bytes used from Keys */
|
||||
DTLS_EXPORT_SPC_SZ = 16, /* amount of bytes used from CipherSpecs */
|
||||
DTLS_EXPORT_LEN = 2, /* 2 bytes for length and protocol */
|
||||
DTLS_EXPORT_IP = 46, /* max ip size IPv4 mapped IPv6 */
|
||||
MAX_EXPORT_BUFFER = 500, /* max size of buffer for exporting */
|
||||
FINISHED_LABEL_SZ = 15, /* TLS finished label size */
|
||||
TLS_FINISHED_SZ = 12, /* TLS has a shorter size */
|
||||
@@ -1458,6 +1459,7 @@ struct WOLFSSL_CRL {
|
||||
int mfd; /* monitor fd, -1 if no init yet */
|
||||
int setup; /* thread is setup predicate */
|
||||
#endif
|
||||
void* heap; /* heap hint for dynamic memory */
|
||||
};
|
||||
|
||||
|
||||
@@ -1618,7 +1620,7 @@ typedef struct TLSX {
|
||||
} TLSX;
|
||||
|
||||
WOLFSSL_LOCAL TLSX* TLSX_Find(TLSX* list, TLSX_Type type);
|
||||
WOLFSSL_LOCAL void TLSX_FreeAll(TLSX* list);
|
||||
WOLFSSL_LOCAL void TLSX_FreeAll(TLSX* list, void* heap);
|
||||
WOLFSSL_LOCAL int TLSX_SupportExtensions(WOLFSSL* ssl);
|
||||
WOLFSSL_LOCAL int TLSX_PopulateExtensions(WOLFSSL* ssl, byte isRequest);
|
||||
|
||||
@@ -1664,7 +1666,7 @@ typedef struct SNI {
|
||||
} SNI;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseSNI(TLSX** extensions, byte type, const void* data,
|
||||
word16 size);
|
||||
word16 size, void* heap);
|
||||
|
||||
#ifndef NO_WOLFSSL_SERVER
|
||||
WOLFSSL_LOCAL void TLSX_SNI_SetOptions(TLSX* extensions, byte type,
|
||||
@@ -1691,7 +1693,7 @@ WOLFSSL_LOCAL int TLSX_ALPN_GetRequest(TLSX* extensions,
|
||||
void** data, word16 *dataSz);
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseALPN(TLSX** extensions, const void* data,
|
||||
word16 size, byte options);
|
||||
word16 size, byte options, void* heap);
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_ALPN_SetOptions(TLSX** extensions, const byte option);
|
||||
|
||||
@@ -1700,14 +1702,14 @@ WOLFSSL_LOCAL int TLSX_ALPN_SetOptions(TLSX** extensions, const byte option);
|
||||
/** Maximum Fragment Length Negotiation - RFC 6066 (session 4) */
|
||||
#ifdef HAVE_MAX_FRAGMENT
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseMaxFragment(TLSX** extensions, byte mfl);
|
||||
WOLFSSL_LOCAL int TLSX_UseMaxFragment(TLSX** extensions, byte mfl, void* heap);
|
||||
|
||||
#endif /* HAVE_MAX_FRAGMENT */
|
||||
|
||||
/** Truncated HMAC - RFC 6066 (session 7) */
|
||||
#ifdef HAVE_TRUNCATED_HMAC
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseTruncatedHMAC(TLSX** extensions);
|
||||
WOLFSSL_LOCAL int TLSX_UseTruncatedHMAC(TLSX** extensions, void* heap);
|
||||
|
||||
#endif /* HAVE_TRUNCATED_HMAC */
|
||||
|
||||
@@ -1723,8 +1725,9 @@ typedef struct {
|
||||
} CertificateStatusRequest;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseCertificateStatusRequest(TLSX** extensions,
|
||||
byte status_type, byte options);
|
||||
WOLFSSL_LOCAL int TLSX_CSR_InitRequest(TLSX* extensions, DecodedCert* cert);
|
||||
byte status_type, byte options, void* heap);
|
||||
WOLFSSL_LOCAL int TLSX_CSR_InitRequest(TLSX* extensions, DecodedCert* cert,
|
||||
void* heap);
|
||||
WOLFSSL_LOCAL void* TLSX_CSR_GetRequest(TLSX* extensions);
|
||||
WOLFSSL_LOCAL int TLSX_CSR_ForceRequest(WOLFSSL* ssl);
|
||||
|
||||
@@ -1744,8 +1747,9 @@ typedef struct CSRIv2 {
|
||||
} CertificateStatusRequestItemV2;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseCertificateStatusRequestV2(TLSX** extensions,
|
||||
byte status_type, byte options);
|
||||
WOLFSSL_LOCAL int TLSX_CSR2_InitRequests(TLSX* extensions, DecodedCert* cert, byte isPeer);
|
||||
byte status_type, byte options, void* heap);
|
||||
WOLFSSL_LOCAL int TLSX_CSR2_InitRequests(TLSX* extensions, DecodedCert* cert,
|
||||
byte isPeer, void* heap);
|
||||
WOLFSSL_LOCAL void* TLSX_CSR2_GetRequest(TLSX* extensions, byte status_type,
|
||||
byte index);
|
||||
WOLFSSL_LOCAL int TLSX_CSR2_ForceRequest(WOLFSSL* ssl);
|
||||
@@ -1760,7 +1764,8 @@ typedef struct EllipticCurve {
|
||||
struct EllipticCurve* next; /* List Behavior */
|
||||
} EllipticCurve;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseSupportedCurve(TLSX** extensions, word16 name);
|
||||
WOLFSSL_LOCAL int TLSX_UseSupportedCurve(TLSX** extensions, word16 name,
|
||||
void* heap);
|
||||
|
||||
#ifndef NO_WOLFSSL_SERVER
|
||||
WOLFSSL_LOCAL int TLSX_ValidateEllipticCurves(WOLFSSL* ssl, byte first,
|
||||
@@ -1791,7 +1796,7 @@ typedef struct SecureRenegotiation {
|
||||
Keys tmp_keys; /* can't overwrite real keys yet */
|
||||
} SecureRenegotiation;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseSecureRenegotiation(TLSX** extensions);
|
||||
WOLFSSL_LOCAL int TLSX_UseSecureRenegotiation(TLSX** extensions, void* heap);
|
||||
|
||||
#endif /* HAVE_SECURE_RENEGOTIATION */
|
||||
|
||||
@@ -1805,10 +1810,10 @@ typedef struct SessionTicket {
|
||||
} SessionTicket;
|
||||
|
||||
WOLFSSL_LOCAL int TLSX_UseSessionTicket(TLSX** extensions,
|
||||
SessionTicket* ticket);
|
||||
SessionTicket* ticket, void* heap);
|
||||
WOLFSSL_LOCAL SessionTicket* TLSX_SessionTicket_Create(word32 lifetime,
|
||||
byte* data, word16 size);
|
||||
WOLFSSL_LOCAL void TLSX_SessionTicket_Free(SessionTicket* ticket);
|
||||
byte* data, word16 size, void* heap);
|
||||
WOLFSSL_LOCAL void TLSX_SessionTicket_Free(SessionTicket* ticket, void* heap);
|
||||
|
||||
#endif /* HAVE_SESSION_TICKET */
|
||||
|
||||
@@ -1843,7 +1848,7 @@ WOLFSSL_LOCAL word16 TLSX_QSH_GetSize(QSHScheme* list, byte isRequest);
|
||||
|
||||
/* used by api for setting a specific QSH scheme */
|
||||
WOLFSSL_LOCAL int TLSX_UseQSHScheme(TLSX** extensions, word16 name,
|
||||
byte* pKey, word16 pKeySz);
|
||||
byte* pKey, word16 pKeySz, void* heap);
|
||||
|
||||
/* used when parsing in QSHCipher structs */
|
||||
WOLFSSL_LOCAL int QSH_Decrypt(QSHKey* key, byte* in, word32 szIn,
|
||||
@@ -1869,6 +1874,9 @@ WOLFSSL_LOCAL int wolfSSL_EventInit(WOLFSSL* ssl, WOLF_EVENT_TYPE type);
|
||||
WOLFSSL_LOCAL int wolfSSL_CTX_EventPush(WOLFSSL_CTX* ctx, WOLF_EVENT* event);
|
||||
#endif /* HAVE_WOLF_EVENT */
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
WOLFSSL_LOCAL int wolfSSL_init_memory_heap(WOLFSSL_HEAP* heap);
|
||||
#endif
|
||||
|
||||
/* wolfSSL context type */
|
||||
struct WOLFSSL_CTX {
|
||||
@@ -1922,7 +1930,11 @@ struct WOLFSSL_CTX {
|
||||
#ifdef WOLFSSL_DTLS
|
||||
CallbackGenCookie CBIOCookie; /* gen cookie callback */
|
||||
wc_dtls_export dtls_export; /* export function for DTLS session */
|
||||
#ifdef WOLFSSL_SESSION_EXPORT
|
||||
CallbackGetPeer CBGetPeer;
|
||||
CallbackSetPeer CBSetPeer;
|
||||
#endif
|
||||
#endif /* WOLFSSL_DTLS */
|
||||
VerifyCallback verifyCallback; /* cert verification callback */
|
||||
word32 timeout; /* session timeout */
|
||||
#ifdef HAVE_ECC
|
||||
@@ -1993,7 +2005,9 @@ struct WOLFSSL_CTX {
|
||||
|
||||
|
||||
WOLFSSL_LOCAL
|
||||
int InitSSL_Ctx(WOLFSSL_CTX*, WOLFSSL_METHOD*);
|
||||
WOLFSSL_CTX* wolfSSL_CTX_new_ex(WOLFSSL_METHOD* method, void* heap);
|
||||
WOLFSSL_LOCAL
|
||||
int InitSSL_Ctx(WOLFSSL_CTX*, WOLFSSL_METHOD*, void* heap);
|
||||
WOLFSSL_LOCAL
|
||||
void FreeSSL_Ctx(WOLFSSL_CTX*);
|
||||
WOLFSSL_LOCAL
|
||||
@@ -2200,8 +2214,10 @@ struct WOLFSSL_SESSION {
|
||||
byte serverID[SERVER_ID_LEN]; /* for easier client lookup */
|
||||
#endif
|
||||
#ifdef HAVE_SESSION_TICKET
|
||||
byte* ticket;
|
||||
word16 ticketLen;
|
||||
byte ticket[SESSION_TICKET_LEN];
|
||||
byte staticTicket[SESSION_TICKET_LEN];
|
||||
byte isDynamic;
|
||||
#endif
|
||||
#ifdef HAVE_STUNNEL
|
||||
void* ex_data[MAX_EX_DATA];
|
||||
@@ -2210,7 +2226,7 @@ struct WOLFSSL_SESSION {
|
||||
|
||||
|
||||
WOLFSSL_LOCAL
|
||||
WOLFSSL_SESSION* GetSession(WOLFSSL*, byte*);
|
||||
WOLFSSL_SESSION* GetSession(WOLFSSL*, byte*, byte);
|
||||
WOLFSSL_LOCAL
|
||||
int SetSession(WOLFSSL*, WOLFSSL_SESSION*);
|
||||
WOLFSSL_LOCAL int DupSession(WOLFSSL* ssl, WOLFSSL* ossl);
|
||||
@@ -2480,6 +2496,7 @@ struct WOLFSSL_X509 {
|
||||
#endif
|
||||
DNS_entry* altNames; /* alt names list */
|
||||
DNS_entry* altNamesNext; /* hint for retrieval */
|
||||
void* heap; /* heap hint */
|
||||
byte dynamicMemory; /* dynamic memory flag */
|
||||
byte isCa;
|
||||
#ifdef OPENSSL_EXTRA
|
||||
@@ -2618,6 +2635,9 @@ struct WOLFSSL {
|
||||
void* verifyCbCtx; /* cert verify callback user ctx*/
|
||||
VerifyCallback verifyCallback; /* cert verification callback */
|
||||
void* heap; /* for user overrides */
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
WOLFSSL_HEAP_HINT heap_hint;
|
||||
#endif
|
||||
#ifndef NO_HANDSHAKE_DONE_CB
|
||||
HandShakeDoneCb hsDoneCb; /* notify user handshake done */
|
||||
void* hsDoneCtx; /* user handshake cb context */
|
||||
@@ -2797,7 +2817,7 @@ int SetSSL_CTX(WOLFSSL*, WOLFSSL_CTX*);
|
||||
WOLFSSL_LOCAL
|
||||
int InitSSL(WOLFSSL*, WOLFSSL_CTX*);
|
||||
WOLFSSL_LOCAL
|
||||
void FreeSSL(WOLFSSL*);
|
||||
void FreeSSL(WOLFSSL*, void* heap);
|
||||
WOLFSSL_API void SSL_ResourceFree(WOLFSSL*); /* Micrium uses */
|
||||
|
||||
|
||||
@@ -3034,8 +3054,8 @@ WOLFSSL_LOCAL word32 LowResTimer(void);
|
||||
|
||||
#ifndef NO_CERTS
|
||||
WOLFSSL_LOCAL void InitX509Name(WOLFSSL_X509_NAME*, int);
|
||||
WOLFSSL_LOCAL void FreeX509Name(WOLFSSL_X509_NAME* name);
|
||||
WOLFSSL_LOCAL void InitX509(WOLFSSL_X509*, int);
|
||||
WOLFSSL_LOCAL void FreeX509Name(WOLFSSL_X509_NAME* name, void* heap);
|
||||
WOLFSSL_LOCAL void InitX509(WOLFSSL_X509*, int, void* heap);
|
||||
WOLFSSL_LOCAL void FreeX509(WOLFSSL_X509*);
|
||||
WOLFSSL_LOCAL int CopyDecodedToX509(WOLFSSL_X509*, DecodedCert*);
|
||||
#endif
|
||||
@@ -3076,6 +3096,10 @@ WOLFSSL_LOCAL int SetKeysSide(WOLFSSL*, enum encrypt_side);
|
||||
WOLFSSL_LOCAL int EccMakeTempKey(WOLFSSL* ssl);
|
||||
#endif
|
||||
|
||||
WOLFSSL_LOCAL int BuildMessage(WOLFSSL* ssl, byte* output, int outSz,
|
||||
const byte* input, int inSz, int type, int hashOutput,
|
||||
int sizeOnly);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -16,9 +16,9 @@ enum {
|
||||
NID_secp112r1 = 0,
|
||||
NID_secp128r1 = 1,
|
||||
NID_secp160r1 = 2,
|
||||
NID_cert192 = 3,
|
||||
NID_cert224 = 4,
|
||||
NID_X9_62_prime256v1 = 5,
|
||||
NID_secp192k1 = 3,
|
||||
NID_secp224r1 = 4,
|
||||
NID_secp256k1 = 5,
|
||||
NID_secp384r1 = 6,
|
||||
NID_secp521r1 = 7,
|
||||
NID_X9_62_prime_field = 100,
|
||||
|
||||
@@ -203,6 +203,24 @@ enum AlertLevel {
|
||||
};
|
||||
|
||||
|
||||
typedef WOLFSSL_METHOD* (*wolfSSL_method_func)(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_server_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_client_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_server_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_client_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_server_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_1_client_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_server_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_2_client_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_server_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfSSLv23_client_method_ex(void* heap);
|
||||
|
||||
#ifdef WOLFSSL_DTLS
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_client_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_server_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_client_method_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfDTLSv1_2_server_method_ex(void* heap);
|
||||
#endif
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_server_method(void);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfSSLv3_client_method(void);
|
||||
WOLFSSL_API WOLFSSL_METHOD *wolfTLSv1_server_method(void);
|
||||
@@ -237,6 +255,22 @@ WOLFSSL_API int wolfSSL_dtls_export(WOLFSSL* ssl, unsigned char* buf,
|
||||
#endif /* WOLFSSL_DTLS */
|
||||
#endif /* WOLFSSL_SESSION_EXPORT */
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
#ifndef WOLFSSL_MEM_GUARD
|
||||
#define WOLFSSL_MEM_GUARD
|
||||
typedef struct WOLFSSL_MEM_STATS WOLFSSL_MEM_STATS;
|
||||
typedef struct WOLFSSL_MEM_CONN_STATS WOLFSSL_MEM_CONN_STATS;
|
||||
#endif
|
||||
WOLFSSL_API int wolfSSL_CTX_load_static_memory(WOLFSSL_CTX** ctx,
|
||||
wolfSSL_method_func method,
|
||||
unsigned char* buf, unsigned int sz,
|
||||
int flag, int max);
|
||||
WOLFSSL_API int wolfSSL_CTX_is_static_memory(WOLFSSL_CTX* ctx,
|
||||
WOLFSSL_MEM_STATS* mem_stats);
|
||||
WOLFSSL_API int wolfSSL_is_static_memory(WOLFSSL* ssl,
|
||||
WOLFSSL_MEM_CONN_STATS* mem_stats);
|
||||
#endif
|
||||
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
|
||||
|
||||
WOLFSSL_API int wolfSSL_CTX_use_certificate_file(WOLFSSL_CTX*, const char*, int);
|
||||
@@ -302,6 +336,7 @@ WOLFSSL_API void wolfSSL_set_quiet_shutdown(WOLFSSL*, int);
|
||||
WOLFSSL_API int wolfSSL_get_error(WOLFSSL*, int);
|
||||
WOLFSSL_API int wolfSSL_get_alert_history(WOLFSSL*, WOLFSSL_ALERT_HISTORY *);
|
||||
|
||||
WOLFSSL_API int GetDeepCopySession(WOLFSSL*, WOLFSSL_SESSION*);
|
||||
WOLFSSL_API int wolfSSL_set_session(WOLFSSL* ssl,WOLFSSL_SESSION* session);
|
||||
WOLFSSL_API long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* session, long t);
|
||||
WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl);
|
||||
@@ -1033,7 +1068,6 @@ WOLFSSL_API void* wolfSSL_GetIOWriteCtx(WOLFSSL* ssl);
|
||||
WOLFSSL_API void wolfSSL_SetIOReadFlags( WOLFSSL* ssl, int flags);
|
||||
WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
|
||||
|
||||
|
||||
#ifndef WOLFSSL_USER_IO
|
||||
/* default IO callbacks */
|
||||
WOLFSSL_API int EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
@@ -1050,6 +1084,22 @@ WOLFSSL_API void wolfSSL_SetIOWriteFlags(WOLFSSL* ssl, int flags);
|
||||
WOLFSSL_API int EmbedSendTo(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
WOLFSSL_API int EmbedGenerateCookie(WOLFSSL* ssl, unsigned char* buf,
|
||||
int sz, void*);
|
||||
#ifdef WOLFSSL_SESSION_EXPORT
|
||||
WOLFSSL_API int EmbedGetPeer(WOLFSSL* ssl, char* ip, int* ipSz,
|
||||
unsigned short* port, int* fam);
|
||||
WOLFSSL_API int EmbedSetPeer(WOLFSSL* ssl, char* ip, int ipSz,
|
||||
unsigned short port, int fam);
|
||||
|
||||
typedef int (*CallbackGetPeer)(WOLFSSL* ssl, char* ip, int* ipSz,
|
||||
unsigned short* port, int* fam);
|
||||
typedef int (*CallbackSetPeer)(WOLFSSL* ssl, char* ip, int ipSz,
|
||||
unsigned short port, int fam);
|
||||
|
||||
WOLFSSL_API void wolfSSL_CTX_SetIOGetPeer(WOLFSSL_CTX*,
|
||||
CallbackGetPeer);
|
||||
WOLFSSL_API void wolfSSL_CTX_SetIOSetPeer(WOLFSSL_CTX*,
|
||||
CallbackSetPeer);
|
||||
#endif /* WOLFSSL_SESSION_EXPORT */
|
||||
#endif /* WOLFSSL_DTLS */
|
||||
#endif /* WOLFSSL_USER_IO */
|
||||
|
||||
@@ -1094,6 +1144,8 @@ enum {
|
||||
WOLFSSL_API int wolfSSL_CTX_SetMinVersion(WOLFSSL_CTX* ctx, int version);
|
||||
WOLFSSL_API int wolfSSL_SetMinVersion(WOLFSSL* ssl, int version);
|
||||
WOLFSSL_API int wolfSSL_GetObjectSize(void); /* object size based on build */
|
||||
WOLFSSL_API int wolfSSL_GetOutputSize(WOLFSSL*, int);
|
||||
WOLFSSL_API int wolfSSL_GetMaxOutputSize(WOLFSSL*);
|
||||
WOLFSSL_API int wolfSSL_SetVersion(WOLFSSL* ssl, int version);
|
||||
WOLFSSL_API int wolfSSL_KeyPemToDer(const unsigned char*, int,
|
||||
unsigned char*, int, const char*);
|
||||
@@ -1251,6 +1303,7 @@ WOLFSSL_API void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl);
|
||||
#ifndef NO_CERTS
|
||||
WOLFSSL_API void wolfSSL_CTX_SetCACb(WOLFSSL_CTX*, CallbackCACache);
|
||||
|
||||
WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew_ex(void* heap);
|
||||
WOLFSSL_API WOLFSSL_CERT_MANAGER* wolfSSL_CertManagerNew(void);
|
||||
WOLFSSL_API void wolfSSL_CertManagerFree(WOLFSSL_CERT_MANAGER*);
|
||||
|
||||
@@ -1293,6 +1346,8 @@ WOLFSSL_API void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl);
|
||||
WOLFSSL_API int wolfSSL_EnableCRL(WOLFSSL* ssl, int options);
|
||||
WOLFSSL_API int wolfSSL_DisableCRL(WOLFSSL* ssl);
|
||||
WOLFSSL_API int wolfSSL_LoadCRL(WOLFSSL*, const char*, int, int);
|
||||
WOLFSSL_API int wolfSSL_LoadCRLBuffer(WOLFSSL*,
|
||||
const unsigned char*, long sz, int);
|
||||
WOLFSSL_API int wolfSSL_SetCRL_Cb(WOLFSSL*, CbMissingCRL);
|
||||
WOLFSSL_API int wolfSSL_EnableOCSP(WOLFSSL*, int options);
|
||||
WOLFSSL_API int wolfSSL_DisableOCSP(WOLFSSL*);
|
||||
@@ -1302,6 +1357,8 @@ WOLFSSL_API void* wolfSSL_GetRsaDecCtx(WOLFSSL* ssl);
|
||||
WOLFSSL_API int wolfSSL_CTX_EnableCRL(WOLFSSL_CTX* ctx, int options);
|
||||
WOLFSSL_API int wolfSSL_CTX_DisableCRL(WOLFSSL_CTX* ctx);
|
||||
WOLFSSL_API int wolfSSL_CTX_LoadCRL(WOLFSSL_CTX*, const char*, int, int);
|
||||
WOLFSSL_API int wolfSSL_CTX_LoadCRLBuffer(WOLFSSL_CTX*,
|
||||
const unsigned char*, long sz, int);
|
||||
WOLFSSL_API int wolfSSL_CTX_SetCRL_Cb(WOLFSSL_CTX*, CbMissingCRL);
|
||||
WOLFSSL_API int wolfSSL_CTX_EnableOCSP(WOLFSSL_CTX*, int options);
|
||||
WOLFSSL_API int wolfSSL_CTX_DisableOCSP(WOLFSSL_CTX*);
|
||||
@@ -1402,6 +1459,7 @@ WOLFSSL_API int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name,
|
||||
|
||||
WOLFSSL_API int wolfSSL_ALPN_GetPeerProtocol(WOLFSSL* ssl, char **list,
|
||||
unsigned short *listSz);
|
||||
WOLFSSL_API int wolfSSL_ALPN_FreePeerProtocol(WOLFSSL* ssl, char **list);
|
||||
#endif /* HAVE_ALPN */
|
||||
|
||||
/* Maximum Fragment Length */
|
||||
|
||||
@@ -1599,6 +1599,31 @@ static INLINE void FreeAtomicUser(WOLFSSL* ssl)
|
||||
|
||||
#endif /* ATOMIC_USER */
|
||||
|
||||
#ifdef WOLFSSL_STATIC_MEMORY
|
||||
static INLINE int wolfSSL_PrintStats(WOLFSSL_MEM_STATS* stats)
|
||||
{
|
||||
word16 i;
|
||||
|
||||
if (stats == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* print to stderr so is on the same pipe as WOLFSSL_DEBUG */
|
||||
fprintf(stderr, "Total mallocs = %d\n", stats->totalAlloc);
|
||||
fprintf(stderr, "Total frees = %d\n", stats->totalFr);
|
||||
fprintf(stderr, "Current mallocs = %d\n", stats->curAlloc);
|
||||
fprintf(stderr, "Available IO = %d\n", stats->avaIO);
|
||||
fprintf(stderr, "Max con. handshakes = %d\n", stats->maxHa);
|
||||
fprintf(stderr, "Max con. IO = %d\n", stats->maxIO);
|
||||
fprintf(stderr, "State of memory blocks: size : available \n");
|
||||
for (i = 0; i < WOLFMEM_MAX_BUCKETS; i++) {
|
||||
fprintf(stderr, " : %d\t : %d\n", stats->blockSz[i],
|
||||
stats->avaBlock[i]);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* WOLFSSL_STATIC_MEMORY */
|
||||
|
||||
#ifdef HAVE_PK_CALLBACKS
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LIBWOLFSSL_VERSION_STRING "3.9.1"
|
||||
#define LIBWOLFSSL_VERSION_HEX 0x03009001
|
||||
#define LIBWOLFSSL_VERSION_STRING "3.9.6"
|
||||
#define LIBWOLFSSL_VERSION_HEX 0x03009006
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ typedef struct Aes {
|
||||
#ifdef WOLFSSL_TI_CRYPT
|
||||
int keylen ;
|
||||
#endif
|
||||
void* heap; /* memory hint to use */
|
||||
} Aes;
|
||||
|
||||
|
||||
@@ -129,6 +130,7 @@ typedef struct Gmac {
|
||||
#endif /* HAVE_AESGCM */
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
WOLFSSL_LOCAL int wc_InitAes_h(Aes* aes, void* h);
|
||||
WOLFSSL_API int wc_AesSetKey(Aes* aes, const byte* key, word32 len,
|
||||
const byte* iv, int dir);
|
||||
WOLFSSL_API int wc_AesSetIV(Aes* aes, const byte* iv);
|
||||
|
||||
@@ -763,13 +763,14 @@ struct OcspRequest {
|
||||
|
||||
byte nonce[MAX_OCSP_NONCE_SZ];
|
||||
int nonceSz;
|
||||
void* heap;
|
||||
};
|
||||
|
||||
|
||||
WOLFSSL_LOCAL void InitOcspResponse(OcspResponse*, CertStatus*, byte*, word32);
|
||||
WOLFSSL_LOCAL int OcspResponseDecode(OcspResponse*, void*);
|
||||
WOLFSSL_LOCAL int OcspResponseDecode(OcspResponse*, void*, void* heap);
|
||||
|
||||
WOLFSSL_LOCAL int InitOcspRequest(OcspRequest*, DecodedCert*, byte);
|
||||
WOLFSSL_LOCAL int InitOcspRequest(OcspRequest*, DecodedCert*, byte, void*);
|
||||
WOLFSSL_LOCAL void FreeOcspRequest(OcspRequest*);
|
||||
WOLFSSL_LOCAL int EncodeOcspRequest(OcspRequest*, byte*, word32);
|
||||
WOLFSSL_LOCAL word32 EncodeOcspRequestExtensions(OcspRequest*, byte*, word32);
|
||||
@@ -808,9 +809,10 @@ struct DecodedCRL {
|
||||
byte nextDateFormat; /* format of next date */
|
||||
RevokedCert* certs; /* revoked cert list */
|
||||
int totalCerts; /* number on list */
|
||||
void* heap;
|
||||
};
|
||||
|
||||
WOLFSSL_LOCAL void InitDecodedCRL(DecodedCRL*);
|
||||
WOLFSSL_LOCAL void InitDecodedCRL(DecodedCRL*, void* heap);
|
||||
WOLFSSL_LOCAL int ParseCRL(DecodedCRL*, const byte* buff, word32 sz, void* cm);
|
||||
WOLFSSL_LOCAL void FreeDecodedCRL(DecodedCRL*);
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ typedef struct Cert {
|
||||
#ifdef WOLFSSL_CERT_REQ
|
||||
char challengePw[CTC_NAME_SIZE];
|
||||
#endif
|
||||
void* heap; /* heap hint */
|
||||
} Cert;
|
||||
#endif /* WOLFSSL_CERT_GEN */
|
||||
|
||||
@@ -216,12 +217,6 @@ WOLFSSL_API int wc_SetSubjectKeyIdFromNtruPublicKey(Cert *cert, byte *ntruKey,
|
||||
*/
|
||||
WOLFSSL_API int wc_SetKeyUsage(Cert *cert, const char *value);
|
||||
|
||||
/* encode Certificate Policies, return total bytes written
|
||||
* each input value must be ITU-T X.690 formatted : a.b.c...
|
||||
* input must be an array of values with a NULL terminated for the latest
|
||||
* RFC5280 : non-critical */
|
||||
WOLFSSL_API int wc_SetCertificatePolicies(Cert *cert, const char **input);
|
||||
|
||||
#endif /* WOLFSSL_CERT_EXT */
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
@@ -274,6 +269,15 @@ WOLFSSL_API word32 wc_EncodeSignature(byte* out, const byte* digest,
|
||||
word32 digSz, int hashOID);
|
||||
WOLFSSL_API int wc_GetCTC_HashOID(int type);
|
||||
|
||||
/* Time */
|
||||
/* Returns seconds (Epoch/UTC)
|
||||
* timePtr: is "time_t", which is typically "long"
|
||||
* Example:
|
||||
long lTime;
|
||||
rc = wc_GetTime(&lTime, (word32)sizeof(lTime));
|
||||
*/
|
||||
WOLFSSL_API int wc_GetTime(void* timePtr, word32 timeSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
79
wolfssl/wolfcrypt/cmac.h
Normal file
79
wolfssl/wolfcrypt/cmac.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* cmac.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* wolfSSL 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.
|
||||
*
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WOLF_CRYPT_CMAC_H
|
||||
#define WOLF_CRYPT_CMAC_H
|
||||
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#include <wolfssl/wolfcrypt/aes.h>
|
||||
|
||||
#if !defined(NO_AES) && defined(WOLFSSL_CMAC)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct Cmac {
|
||||
Aes aes;
|
||||
byte buffer[AES_BLOCK_SIZE]; /* partially stored block */
|
||||
byte digest[AES_BLOCK_SIZE]; /* running digest */
|
||||
byte k1[AES_BLOCK_SIZE];
|
||||
byte k2[AES_BLOCK_SIZE];
|
||||
word32 bufferSz;
|
||||
word32 totalSz;
|
||||
} Cmac;
|
||||
|
||||
|
||||
typedef enum CmacType {
|
||||
WC_CMAC_AES = 1
|
||||
} CmacType;
|
||||
|
||||
|
||||
WOLFSSL_API
|
||||
int wc_InitCmac(Cmac* cmac,
|
||||
const byte* key, word32 keySz,
|
||||
int type, void* unused);
|
||||
WOLFSSL_API
|
||||
int wc_CmacUpdate(Cmac* cmac,
|
||||
const byte* in, word32 inSz);
|
||||
WOLFSSL_API
|
||||
int wc_CmacFinal(Cmac* cmac,
|
||||
byte* out, word32* outSz);
|
||||
|
||||
WOLFSSL_API
|
||||
int wc_AesCmacGenerate(byte* out, word32* outSz,
|
||||
const byte* in, word32 inSz,
|
||||
const byte* key, word32 keySz);
|
||||
|
||||
WOLFSSL_API
|
||||
int wc_AesCmacVerify(const byte* check, word32 checkSz,
|
||||
const byte* in, word32 inSz,
|
||||
const byte* key, word32 keySz);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* NO_AES && WOLFSSL_CMAC */
|
||||
#endif /* WOLF_CRYPT_CMAC_H */
|
||||
|
||||
@@ -53,9 +53,11 @@ enum {
|
||||
typedef struct DsaKey {
|
||||
mp_int p, q, g, y, x;
|
||||
int type; /* public or private */
|
||||
void* heap; /* memory hint */
|
||||
} DsaKey;
|
||||
|
||||
WOLFSSL_API void wc_InitDsaKey(DsaKey* key);
|
||||
WOLFSSL_API int wc_InitDsaKey_h(DsaKey* key, void* h);
|
||||
WOLFSSL_API void wc_FreeDsaKey(DsaKey* key);
|
||||
WOLFSSL_API int wc_DsaSign(const byte* digest, byte* out,
|
||||
DsaKey* key, WC_RNG* rng);
|
||||
|
||||
@@ -60,6 +60,8 @@ typedef struct {
|
||||
const char* Gy; /* y coordinate of the base point on curve (hex) */
|
||||
} ecc_set_type;
|
||||
|
||||
#define ECC_CUSTOM_IDX (-1)
|
||||
|
||||
|
||||
/* Determine max ECC bits based on enabled curves */
|
||||
#if defined(HAVE_ECC521) || defined(HAVE_ALL_CURVES)
|
||||
@@ -166,6 +168,7 @@ typedef struct {
|
||||
curves (idx >= 0) or user supplied */
|
||||
ecc_point pubkey; /* public key */
|
||||
mp_int k; /* private key */
|
||||
void* heap; /* heap hint */
|
||||
} ecc_key;
|
||||
|
||||
|
||||
@@ -176,6 +179,9 @@ extern const ecc_set_type ecc_sets[];
|
||||
WOLFSSL_API
|
||||
int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key,
|
||||
const ecc_set_type* dp);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_check_key(ecc_key* key);
|
||||
|
||||
#ifdef HAVE_ECC_DHE
|
||||
@@ -208,6 +214,8 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
||||
WOLFSSL_API
|
||||
int wc_ecc_init(ecc_key* key);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_init_h(ecc_key* key, void* heap);
|
||||
WOLFSSL_API
|
||||
void wc_ecc_free(ecc_key* key);
|
||||
WOLFSSL_API
|
||||
void wc_ecc_fp_free(void);
|
||||
@@ -215,8 +223,12 @@ void wc_ecc_fp_free(void);
|
||||
WOLFSSL_API
|
||||
ecc_point* wc_ecc_new_point(void);
|
||||
WOLFSSL_API
|
||||
ecc_point* wc_ecc_new_point_h(void* h);
|
||||
WOLFSSL_API
|
||||
void wc_ecc_del_point(ecc_point* p);
|
||||
WOLFSSL_API
|
||||
void wc_ecc_del_point_h(ecc_point* p, void* h);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_copy_point(ecc_point* p, ecc_point *r);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_cmp_point(ecc_point* a, ecc_point *b);
|
||||
@@ -226,8 +238,11 @@ WOLFSSL_API
|
||||
int wc_ecc_is_valid_idx(int n);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R,
|
||||
mp_int* modulus, int map);
|
||||
mp_int* a, mp_int* modulus, int map);
|
||||
|
||||
WOLFSSL_LOCAL
|
||||
int wc_ecc_mulmod_ex(mp_int* k, ecc_point *G, ecc_point *R,
|
||||
mp_int* a, mp_int* modulus, int map, void* heap);
|
||||
#ifdef HAVE_ECC_KEY_EXPORT
|
||||
/* ASN key helpers */
|
||||
WOLFSSL_API
|
||||
@@ -241,6 +256,9 @@ int wc_ecc_export_x963_ex(ecc_key*, byte* out, word32* outLen, int compressed);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key,
|
||||
const ecc_set_type* dp);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
|
||||
word32 pubSz, ecc_key* key);
|
||||
WOLFSSL_API
|
||||
@@ -248,6 +266,9 @@ int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy,
|
||||
const char* d, const char* curveName);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_import_raw_ex(ecc_key* key, const char* qx, const char* qy,
|
||||
const char* d, const ecc_set_type* dp);
|
||||
#endif /* HAVE_ECC_KEY_IMPORT */
|
||||
|
||||
#ifdef HAVE_ECC_KEY_EXPORT
|
||||
@@ -310,6 +331,8 @@ typedef struct ecEncCtx ecEncCtx;
|
||||
WOLFSSL_API
|
||||
ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng);
|
||||
WOLFSSL_API
|
||||
ecEncCtx* wc_ecc_ctx_new_ex(int flags, WC_RNG* rng, void* heap);
|
||||
WOLFSSL_API
|
||||
void wc_ecc_ctx_free(ecEncCtx*);
|
||||
WOLFSSL_API
|
||||
int wc_ecc_ctx_reset(ecEncCtx*, WC_RNG*); /* reset for use again w/o alloc/free */
|
||||
|
||||
@@ -59,6 +59,8 @@ enum {
|
||||
MP_ZERO_E = -121, /* got a mp zero result, not expected */
|
||||
|
||||
MEMORY_E = -125, /* out of memory error */
|
||||
VAR_STATE_CHANGE_E = -126, /* var state modified by different thread */
|
||||
|
||||
|
||||
RSA_WRONG_TYPE_E = -130, /* RSA wrong block type for RSA function */
|
||||
RSA_BUFFER_E = -131, /* RSA buffer error, output too small or
|
||||
|
||||
@@ -106,18 +106,11 @@ WOLFSSL_API int wc_Sha256Hash(const byte*, word32, byte*);
|
||||
#ifdef WOLFSSL_SHA512
|
||||
#include <wolfssl/wolfcrypt/sha512.h>
|
||||
WOLFSSL_API int wc_Sha512Hash(const byte*, word32, byte*);
|
||||
#if defined(WOLFSSL_TI_HASH)
|
||||
WOLFSSL_API void wc_Sha512Free(Sha512*);
|
||||
#else
|
||||
#define wc_Sha512Free(d)
|
||||
#endif
|
||||
#define wc_Sha512Free(d)
|
||||
|
||||
#if defined(WOLFSSL_SHA384)
|
||||
WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
|
||||
#if defined(WOLFSSL_TI_HASH)
|
||||
WOLFSSL_API void wc_Sha384Free(Sha384*);
|
||||
#else
|
||||
#define wc_Sha384Free(d)
|
||||
#endif
|
||||
#endif /* defined(WOLFSSL_SHA384) */
|
||||
#endif /* WOLFSSL_SHA512 */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user