2011-08-25 23:41:19 +04:00
|
|
|
/* settings.h
|
2011-02-05 22:14:47 +03:00
|
|
|
*
|
2014-04-12 01:58:58 +04:00
|
|
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
2011-02-05 22:14:47 +03:00
|
|
|
*
|
|
|
|
* This file is part of CyaSSL.
|
|
|
|
*
|
|
|
|
* CyaSSL is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* CyaSSL is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2014-04-12 01:58:58 +04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
2011-02-05 22:14:47 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Place OS specific preprocessor flags, defines, includes here, will be
|
2011-08-25 23:41:19 +04:00
|
|
|
included into every file because types.h includes it */
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2011-08-05 02:42:55 +04:00
|
|
|
|
2011-06-10 02:55:58 +04:00
|
|
|
#ifndef CTAO_CRYPT_SETTINGS_H
|
|
|
|
#define CTAO_CRYPT_SETTINGS_H
|
2011-02-05 22:14:47 +03:00
|
|
|
|
|
|
|
#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 */
|
|
|
|
|
2011-11-10 05:32:24 +04:00
|
|
|
/* Uncomment next line if using Microchip PIC32 ethernet starter kit */
|
2014-03-11 06:22:39 +04:00
|
|
|
/* #define MICROCHIP_PIC32 */
|
2011-11-10 05:32:24 +04:00
|
|
|
|
2013-05-17 20:59:18 +04:00
|
|
|
/* 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 */
|
2013-04-10 19:16:11 +04:00
|
|
|
/* #define MICROCHIP_TCPIP */
|
|
|
|
|
2014-03-11 06:32:16 +04:00
|
|
|
/* Uncomment next line if using PIC32MZ Crypto Engine */
|
|
|
|
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
|
|
|
|
2011-05-24 03:10:36 +04:00
|
|
|
/* Uncomment next line if using FreeRTOS */
|
|
|
|
/* #define FREERTOS */
|
|
|
|
|
2012-08-02 19:54:41 +04:00
|
|
|
/* Uncomment next line if using FreeRTOS Windows Simulator */
|
|
|
|
/* #define FREERTOS_WINSIM */
|
|
|
|
|
2012-08-14 03:10:05 +04:00
|
|
|
/* Uncomment next line if using RTIP */
|
|
|
|
/* #define EBSNET */
|
|
|
|
|
2011-05-24 23:38:42 +04:00
|
|
|
/* Uncomment next line if using lwip */
|
|
|
|
/* #define CYASSL_LWIP */
|
|
|
|
|
2011-07-12 23:25:28 +04:00
|
|
|
/* Uncomment next line if building CyaSSL for a game console */
|
|
|
|
/* #define CYASSL_GAME_BUILD */
|
|
|
|
|
2012-08-16 04:00:11 +04:00
|
|
|
/* Uncomment next line if building CyaSSL for LSR */
|
|
|
|
/* #define CYASSL_LSR */
|
|
|
|
|
2012-11-01 21:23:42 +04:00
|
|
|
/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */
|
|
|
|
/* #define FREESCALE_MQX */
|
|
|
|
|
2012-12-27 21:06:29 +04:00
|
|
|
/* Uncomment next line if using STM32F2 */
|
|
|
|
/* #define CYASSL_STM32F2 */
|
|
|
|
|
2013-06-27 21:28:58 +04:00
|
|
|
/* Uncomment next line if using Comverge settings */
|
|
|
|
/* #define COMVERGE */
|
|
|
|
|
2013-11-20 02:44:55 +04:00
|
|
|
/* Uncomment next line if using QL SEP settings */
|
|
|
|
/* #define CYASSL_QL */
|
|
|
|
|
2014-04-04 22:35:41 +04:00
|
|
|
/* Uncomment next line if building for EROAD */
|
|
|
|
/* #define CYASSL_EROAD */
|
2014-05-01 09:29:09 +04:00
|
|
|
|
|
|
|
/* Uncomment next line if building for IAR EWARM */
|
|
|
|
/* #define CYASSL_IAR_ARM */
|
2014-04-04 22:35:41 +04:00
|
|
|
|
2011-08-25 23:41:19 +04:00
|
|
|
#include <cyassl/ctaocrypt/visibility.h>
|
2011-04-27 02:41:16 +04:00
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef IPHONE
|
|
|
|
#define SIZEOF_LONG_LONG 8
|
|
|
|
#endif
|
|
|
|
|
2013-06-25 01:00:48 +04:00
|
|
|
|
2014-04-05 02:10:08 +04:00
|
|
|
#ifdef CYASSL_USER_SETTINGS
|
|
|
|
#include <user_settings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-06-25 01:00:48 +04:00
|
|
|
#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
|
2013-06-27 04:05:30 +04:00
|
|
|
#define NO_RSA
|
2013-06-27 21:28:58 +04:00
|
|
|
#define NO_SESSION_CACHE
|
2013-06-27 04:05:30 +04:00
|
|
|
#define HAVE_ECC
|
2013-06-25 01:00:48 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef THREADX
|
|
|
|
#define SIZEOF_LONG_LONG 8
|
|
|
|
#endif
|
|
|
|
|
2013-06-25 01:00:48 +04:00
|
|
|
#ifdef HAVE_NETX
|
|
|
|
#include "nx_api.h"
|
|
|
|
#endif
|
|
|
|
|
2014-03-11 06:32:16 +04:00
|
|
|
#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
|
2014-05-01 09:29:09 +04:00
|
|
|
|
|
|
|
#if defined(CYASSL_IAR_ARM)
|
|
|
|
#define NO_MAIN_DRIVER
|
|
|
|
#define SINGLE_THREADED
|
|
|
|
#define USE_CERT_BUFFERS_1024
|
|
|
|
#define BENCH_EMBEDDED
|
2014-05-01 12:03:01 +04:00
|
|
|
#define NO_FILESYSTEM
|
|
|
|
#define NO_WRITEV
|
|
|
|
#define CYASSL_USER_IO
|
2014-05-02 04:31:22 +04:00
|
|
|
#define BENCH_EMBEDDED
|
2014-05-01 09:29:09 +04:00
|
|
|
#endif
|
|
|
|
|
2011-11-10 05:32:24 +04:00
|
|
|
#ifdef MICROCHIP_PIC32
|
2014-03-11 06:32:16 +04:00
|
|
|
/* #define CYASSL_MICROCHIP_PIC32MZ */
|
2013-01-31 05:02:18 +04:00
|
|
|
#define SIZEOF_LONG_LONG 8
|
|
|
|
#define SINGLE_THREADED
|
2013-05-23 02:50:13 +04:00
|
|
|
#define CYASSL_USER_IO
|
2013-01-31 05:02:18 +04:00
|
|
|
#define NO_WRITEV
|
|
|
|
#define NO_DEV_RANDOM
|
2011-11-10 05:32:24 +04:00
|
|
|
#define NO_FILESYSTEM
|
2013-01-31 05:02:18 +04:00
|
|
|
#define USE_FAST_MATH
|
|
|
|
#define TFM_TIMING_RESISTANT
|
2011-11-10 05:32:24 +04:00
|
|
|
#endif
|
|
|
|
|
2014-03-11 06:32:16 +04:00
|
|
|
#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
|
|
|
|
|
2013-05-17 20:59:18 +04:00
|
|
|
#ifdef MICROCHIP_TCPIP_V5
|
|
|
|
/* include timer functions */
|
2013-04-10 19:16:11 +04:00
|
|
|
#include "TCPIP Stack/TCPIP.h"
|
|
|
|
#endif
|
|
|
|
|
2013-05-17 20:59:18 +04:00
|
|
|
#ifdef MICROCHIP_TCPIP
|
|
|
|
/* include timer, NTP functions */
|
2013-10-28 22:03:50 +04:00
|
|
|
#ifdef MICROCHIP_MPLAB_HARMONY
|
|
|
|
#include "tcpip/tcpip.h"
|
|
|
|
#else
|
2014-03-11 06:32:16 +04:00
|
|
|
#include "system/system_services.h"
|
2013-10-28 22:03:50 +04:00
|
|
|
#include "tcpip/sntp.h"
|
|
|
|
#endif
|
2013-05-17 20:59:18 +04:00
|
|
|
#endif
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef MBED
|
|
|
|
#define CYASSL_USER_IO
|
2014-03-25 22:39:07 +04:00
|
|
|
#define NO_FILESYSTEM
|
|
|
|
#define NO_CERT
|
|
|
|
#define USE_CERT_BUFFERS_1024
|
2011-02-05 22:14:47 +03:00
|
|
|
#define NO_WRITEV
|
|
|
|
#define NO_DEV_RANDOM
|
|
|
|
#define NO_SHA512
|
|
|
|
#define NO_DH
|
|
|
|
#define NO_DSA
|
|
|
|
#define NO_HC128
|
2014-03-25 22:39:07 +04:00
|
|
|
#define HAVE_ECC
|
|
|
|
#define NO_SESSION_CACHE
|
|
|
|
#define CYASSL_CMSIS_RTOS
|
|
|
|
#endif
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2013-09-20 21:36:05 +04:00
|
|
|
|
2014-03-15 01:54:21 +04:00
|
|
|
#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
|
|
|
|
|
2012-08-02 19:54:41 +04:00
|
|
|
#ifdef FREERTOS_WINSIM
|
|
|
|
#define FREERTOS
|
|
|
|
#define USE_WINDOWS_API
|
|
|
|
#endif
|
|
|
|
|
2012-12-01 03:41:01 +04:00
|
|
|
|
2013-09-10 00:48:28 +04:00
|
|
|
/* Micrium will use Visual Studio for compilation but not the Win32 API */
|
|
|
|
#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \
|
2014-04-04 22:35:41 +04:00
|
|
|
&& !defined(EBSNET) && !defined(CYASSL_EROAD)
|
2013-09-10 00:48:28 +04:00
|
|
|
#define USE_WINDOWS_API
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-03-08 05:44:40 +04:00
|
|
|
#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER)
|
2012-12-01 03:41:01 +04:00
|
|
|
#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
|
|
|
|
|
2013-03-08 05:44:40 +04:00
|
|
|
#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL)
|
|
|
|
#undef XMALLOC
|
|
|
|
#define XMALLOC yaXMALLOC
|
|
|
|
#undef XFREE
|
|
|
|
#define XFREE yaXFREE
|
|
|
|
#undef XREALLOC
|
|
|
|
#define XREALLOC yaXREALLOC
|
|
|
|
#endif
|
|
|
|
|
2014-07-01 18:24:48 +04:00
|
|
|
#ifdef CYASSL_SMALL_STACK
|
|
|
|
#define DECLARE_ARRAY(type, var, size) \
|
|
|
|
type* var = NULL
|
|
|
|
|
|
|
|
#define CREATE_ARRAY(type, var, size) \
|
|
|
|
(var = (type*)XMALLOC(sizeof(type) * size, NULL, \
|
|
|
|
DYNAMIC_TYPE_TMP_BUFFER))
|
|
|
|
|
|
|
|
#define DESTROY_ARRAY(var) \
|
|
|
|
XFREE(var, NULL, DYNAMIC_TYPE_TMP_BUFFER)
|
|
|
|
#else
|
|
|
|
#define DECLARE_ARRAY(type, var, size) type var[size]
|
|
|
|
#define CREATE_ARRAY(type, var, size) 1
|
|
|
|
#define DESTROY_ARRAY(var)
|
|
|
|
#endif
|
2012-12-01 03:41:01 +04:00
|
|
|
|
2014-07-01 23:53:28 +04:00
|
|
|
#define DECLARE_VAR(type, var) DECLARE_ARRAY(type, var, 1)
|
|
|
|
#define CREATE_VAR(type, var) CREATE_ARRAY(type, var, 1)
|
|
|
|
#define DESTROY_VAR(var) DESTROY_ARRAY(var)
|
|
|
|
|
2012-08-02 19:54:41 +04:00
|
|
|
#ifdef FREERTOS
|
2013-03-14 00:14:01 +04:00
|
|
|
#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
|
2012-08-02 19:54:41 +04:00
|
|
|
|
|
|
|
#ifndef SINGLE_THREADED
|
|
|
|
#include "FreeRTOS.h"
|
|
|
|
#include "semphr.h"
|
|
|
|
#endif
|
2011-05-24 03:10:36 +04:00
|
|
|
#endif
|
2011-02-05 22:14:47 +03:00
|
|
|
|
2012-08-14 03:10:05 +04:00
|
|
|
#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 */
|
|
|
|
|
2011-07-12 23:25:28 +04:00
|
|
|
#ifdef CYASSL_GAME_BUILD
|
|
|
|
#define SIZEOF_LONG_LONG 8
|
2011-07-13 08:30:24 +04:00
|
|
|
#if defined(__PPU) || defined(__XENON)
|
|
|
|
#define BIG_ENDIAN_ORDER
|
|
|
|
#endif
|
2011-07-12 23:25:28 +04:00
|
|
|
#endif
|
|
|
|
|
2012-08-16 04:00:11 +04:00
|
|
|
#ifdef CYASSL_LSR
|
2012-10-17 21:04:44 +04:00
|
|
|
#define HAVE_WEBSERVER
|
2012-08-22 22:07:40 +04:00
|
|
|
#define SIZEOF_LONG_LONG 8
|
|
|
|
#define CYASSL_LOW_MEMORY
|
2012-08-16 04:00:11 +04:00
|
|
|
#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
|
2012-08-18 00:45:31 +04:00
|
|
|
#ifndef NO_FILESYSTEM
|
|
|
|
#define LSR_FS
|
2012-08-22 22:07:40 +04:00
|
|
|
#include "inc/hw_types.h"
|
2012-08-18 00:45:31 +04:00
|
|
|
#include "fs.h"
|
|
|
|
#endif
|
2012-08-16 04:00:11 +04:00
|
|
|
#define CYASSL_LWIP
|
2012-08-23 20:45:23 +04:00
|
|
|
#include <errno.h> /* for tcp errno */
|
2012-08-16 04:00:11 +04:00
|
|
|
#define CYASSL_SAFERTOS
|
2012-08-21 03:58:11 +04:00
|
|
|
#if defined(__IAR_SYSTEMS_ICC__)
|
|
|
|
/* enum uses enum */
|
|
|
|
#pragma diag_suppress=Pa089
|
|
|
|
#endif
|
2012-08-18 00:45:31 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CYASSL_SAFERTOS
|
2012-08-16 04:00:11 +04:00
|
|
|
#ifndef SINGLE_THREADED
|
|
|
|
#include "SafeRTOS/semphr.h"
|
|
|
|
#endif
|
2012-08-21 03:38:43 +04:00
|
|
|
|
|
|
|
#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))
|
2012-08-16 04:00:11 +04:00
|
|
|
#endif
|
|
|
|
|
2012-08-22 22:07:40 +04:00
|
|
|
#ifdef CYASSL_LOW_MEMORY
|
2013-03-28 22:38:27 +04:00
|
|
|
#undef RSA_LOW_MEM
|
2012-08-22 22:07:40 +04:00
|
|
|
#define RSA_LOW_MEM
|
2013-03-28 22:38:27 +04:00
|
|
|
#undef CYASSL_SMALL_STACK
|
2012-08-22 22:07:40 +04:00
|
|
|
#define CYASSL_SMALL_STACK
|
2013-03-28 22:38:27 +04:00
|
|
|
#undef TFM_TIMING_RESISTANT
|
2012-08-22 22:07:40 +04:00
|
|
|
#define TFM_TIMING_RESISTANT
|
|
|
|
#endif
|
|
|
|
|
2012-11-01 21:23:42 +04:00
|
|
|
#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
|
2012-11-03 03:49:30 +04:00
|
|
|
#define FREESCALE_K70_RNGA
|
2013-09-17 01:48:36 +04:00
|
|
|
/* #define FREESCALE_K53_RNGB */
|
|
|
|
#include "mqx.h"
|
2012-11-01 21:23:42 +04:00
|
|
|
#ifndef NO_FILESYSTEM
|
|
|
|
#include "mfs.h"
|
|
|
|
#include "fio.h"
|
|
|
|
#endif
|
|
|
|
#ifndef SINGLE_THREADED
|
|
|
|
#include "mutex.h"
|
|
|
|
#endif
|
|
|
|
|
2014-01-28 21:28:19 +04:00
|
|
|
#define XMALLOC(s, h, t) (void *)_mem_alloc_system((s))
|
|
|
|
#define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));}
|
2012-11-01 21:23:42 +04:00
|
|
|
/* Note: MQX has no realloc, using fastmath above */
|
|
|
|
#endif
|
|
|
|
|
2012-12-27 21:06:29 +04:00
|
|
|
#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
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
#ifdef MICRIUM
|
|
|
|
|
2011-03-02 21:15:07 +03:00
|
|
|
#include "stdlib.h"
|
2011-02-05 22:14:47 +03:00
|
|
|
#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 */
|
|
|
|
|
2011-04-16 03:43:00 +04:00
|
|
|
|
2013-11-20 02:44:55 +04:00
|
|
|
#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 */
|
|
|
|
|
|
|
|
|
2012-12-01 03:41:01 +04:00
|
|
|
#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \
|
2013-03-13 00:31:14 +04:00
|
|
|
!defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY)
|
2011-04-16 03:43:00 +04:00
|
|
|
#define USE_CYASSL_MEMORY
|
|
|
|
#endif
|
|
|
|
|
2013-03-19 23:18:52 +04:00
|
|
|
|
|
|
|
#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS)
|
|
|
|
#undef KEEP_PEER_CERT
|
|
|
|
#define KEEP_PEER_CERT
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2013-03-28 02:11:49 +04:00
|
|
|
/* stream ciphers except arc4 need 32bit alignment, intel ok without */
|
2013-03-28 03:58:27 +04:00
|
|
|
#ifndef XSTREAM_ALIGNMENT
|
|
|
|
#if defined(__x86_64__) || defined(__ia64__) || defined(__i386__)
|
|
|
|
#define NO_XSTREAM_ALIGNMENT
|
|
|
|
#else
|
|
|
|
#define XSTREAM_ALIGNMENT
|
|
|
|
#endif
|
2013-03-28 02:11:49 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-05-14 02:51:35 +04:00
|
|
|
/* FreeScale MMCAU hardware crypto has 4 byte alignment */
|
|
|
|
#ifdef FREESCALE_MMCAU
|
|
|
|
#define CYASSL_MMCAU_ALIGNMENT 4
|
|
|
|
#endif
|
|
|
|
|
2013-03-28 02:11:49 +04:00
|
|
|
/* if using hardware crypto and have alignment requirements, specify the
|
|
|
|
requirement here. The record header of SSL/TLS will prvent easy alignment.
|
2013-03-28 03:58:27 +04:00
|
|
|
This hint tries to help as much as possible. */
|
2013-03-28 02:11:49 +04:00
|
|
|
#ifndef CYASSL_GENERAL_ALIGNMENT
|
|
|
|
#ifdef CYASSL_AESNI
|
|
|
|
#define CYASSL_GENERAL_ALIGNMENT 16
|
|
|
|
#elif defined(XSTREAM_ALIGNMENT)
|
2013-03-28 03:58:27 +04:00
|
|
|
#define CYASSL_GENERAL_ALIGNMENT 4
|
2014-05-14 02:51:35 +04:00
|
|
|
#elif defined(FREESCALE_MMCAU)
|
|
|
|
#define CYASSL_GENERAL_ALIGNMENT CYASSL_MMCAU_ALIGNMENT
|
2013-03-28 02:11:49 +04:00
|
|
|
#else
|
|
|
|
#define CYASSL_GENERAL_ALIGNMENT 0
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-06-18 01:48:51 +04:00
|
|
|
#ifdef HAVE_CRL
|
|
|
|
/* not widely supported yet */
|
|
|
|
#undef NO_SKID
|
|
|
|
#define NO_SKID
|
|
|
|
#endif
|
|
|
|
|
2014-05-29 04:36:21 +04:00
|
|
|
|
|
|
|
#ifdef __INTEL_COMPILER
|
|
|
|
#pragma warning(disable:2259) /* explicit casts to smaller sizes, disable */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2011-02-05 22:14:47 +03:00
|
|
|
/* Place any other flags or defines here */
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2011-06-10 02:55:58 +04:00
|
|
|
#endif /* CTAO_CRYPT_SETTINGS_H */
|
2011-02-05 22:14:47 +03:00
|
|
|
|