mirror of https://github.com/wolfSSL/wolfssl.git
Implement peer feedback
parent
cfadc7e25a
commit
89b97a0fbf
|
@ -1,6 +0,0 @@
|
|||
# vim:ft=automake
|
||||
# included from Top Level Makefile.am
|
||||
# All paths should be given relative to the root
|
||||
|
||||
EXTRA_DIST+= IDE/VisualDSP++/user_settings.h
|
||||
EXTRA_DIST+= IDE/VisualDSP++/wolf-tasks.c
|
|
@ -30,6 +30,11 @@ extern "C" {
|
|||
|
||||
#include "fusioncfg.h"
|
||||
|
||||
/* Previously was included in ssl.c but for the sake of portability and existing
|
||||
* projects, moved to IDE specific user_settings.h (stdarg.h include)
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Platform */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
@ -95,6 +100,12 @@ extern "C" {
|
|||
#undef NO_THREAD_LS
|
||||
#define NO_THREAD_LS
|
||||
#endif
|
||||
|
||||
#define NO_ATTRIBUTE_CONSTRUCTOR /* Required on ADSP BLACKFIN where memory
|
||||
* is zeroized after
|
||||
* __attribute__((constructor)) and before
|
||||
* main();
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -515,8 +526,6 @@ extern "C" {
|
|||
#define USE_WOLF_STRTOK
|
||||
#define XSTRTOK(s1,d,ptr) wc_strtok((s1),(d),(ptr))
|
||||
|
||||
// TBD drowe: add a new FCL_STRNSTR and implement the new fclStrnstr code in common/clib/string/fclstrstr.c
|
||||
// For now use the unsafe version
|
||||
#define XSTRNSTR(s1,s2,n) FCL_STRSTR((s1),(s2))
|
||||
|
||||
#define XMEMCPY(d,s,l) FCL_MEMCPY((d),(s),(l))
|
||||
|
@ -696,13 +705,7 @@ extern "C" {
|
|||
|
||||
#define printf FCL_PRINTF
|
||||
|
||||
/* CAVP TESTING */
|
||||
#define NO_WOLFCAVP_MAIN_DRIVER
|
||||
#define WOLFSSL_BASE16
|
||||
#define USE_UART_READ_LINE
|
||||
#define USE_NORMAL_PRINTF
|
||||
#define VERIFY_GENERATED_PSS_SIGS
|
||||
#define NO_ATTRIBUTE_CONSTRUCTOR
|
||||
|
||||
extern int aes_test_for_fips_hash(void);
|
||||
int wolfcrypt_test_taskEnter(void *args);
|
||||
|
@ -716,16 +719,13 @@ extern "C" {
|
|||
#define USE_CERT_BUFFERS_256
|
||||
//#define NO_FILESYSTEM
|
||||
|
||||
// #define HAVE_FORCE_FIPS_FAILURE
|
||||
|
||||
#define OPENSSL_EXTRA //to test if iprgw project need it. AES_xxx wolfSSL_AES_xxx Aes_EncryptDirect
|
||||
#define OPENSSL_EXTRA
|
||||
#define OPENSSL_ALL
|
||||
#define HAVE_EX_DATA
|
||||
#define WOLFSSL_EVP_DECRYPT_LEGACY
|
||||
|
||||
|
||||
/* TLS 1.3 support */
|
||||
|
||||
#define WOLFSSL_TLS13
|
||||
#define HAVE_TLS_EXTENSIONS
|
||||
#define HAVE_SUPPORTED_CURVES
|
||||
|
|
|
@ -77,11 +77,10 @@
|
|||
#if defined(DEBUG_WOLFSSL) || defined(SHOW_SECRETS) || \
|
||||
defined(CHACHA_AEAD_TEST) || defined(WOLFSSL_SESSION_EXPORT_DEBUG)
|
||||
#ifndef NO_STDIO_FILESYSTEM
|
||||
#ifndef FUSION_RTOS
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef FUSION_RTOS
|
||||
#include <fclstdio.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,10 @@
|
|||
|
||||
/* only in this file, to avoid confusing future ports leave
|
||||
* these defines here. Do not move to wc_port.h */
|
||||
#ifdef FUSION_RTOS
|
||||
#ifdef USER_CUSTOM_SNIFFX
|
||||
/* To be implemented in user_settings.h */
|
||||
#warning "Please implement Sniffer porting in user_settings.h"
|
||||
#elif defined(FUSION_RTOS)
|
||||
#include <fcl_network.h>
|
||||
#define XINET_NTOA FNS_INET_NTOA
|
||||
#define XINET_ATON FNS_INET_ATON
|
||||
|
@ -47,6 +50,7 @@
|
|||
#define XNTOHL FNS_NTOHL
|
||||
#define XINADDR_NONE FNS_INADDR_NONE
|
||||
#else
|
||||
/* default */
|
||||
#define XINET_NTOA inet_ntoa
|
||||
#define XINET_ATON inet_aton
|
||||
#define XINET_PTON(a,b,c) inet_pton((a),(b),(c))
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
/* turn on GNU extensions for XVASPRINTF with wolfSSL_BIO_printf */
|
||||
#undef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if !defined(WOLFCRYPT_ONLY) || defined(OPENSSL_EXTRA) || \
|
||||
|
|
25
src/tls13.c
25
src/tls13.c
|
@ -1361,6 +1361,23 @@ end:
|
|||
return (word32)(ktime_get_real_ns() / (ktime_t)1000000);
|
||||
#endif
|
||||
}
|
||||
#elif defined(FUSION_RTOS)
|
||||
/* The time in milliseconds.
|
||||
* Used for tickets to represent difference between when first seen and when
|
||||
* sending.
|
||||
*
|
||||
* returns the time in milliseconds as a 32-bit value.
|
||||
*/
|
||||
word32 TimeNowInMilliseconds(void)
|
||||
{
|
||||
struct timeval now;
|
||||
if (FCL_GETTIMEOFDAY(&now, 0) < 0)
|
||||
return (word32)GETTIME_ERROR;
|
||||
|
||||
/* Convert to milliseconds number. */
|
||||
return (word32)(now.tv_sec * 1000 + now.tv_usec / 1000);
|
||||
}
|
||||
|
||||
#else
|
||||
/* The time in milliseconds.
|
||||
* Used for tickets to represent difference between when first seen and when
|
||||
|
@ -1371,14 +1388,10 @@ end:
|
|||
word32 TimeNowInMilliseconds(void)
|
||||
{
|
||||
struct timeval now;
|
||||
#ifdef FUSION_RTOS
|
||||
if (FCL_GETTIMEOFDAY(&now, 0) < 0)
|
||||
return (word32)GETTIME_ERROR;
|
||||
//TODO research why negative error code returns as word32
|
||||
#else
|
||||
|
||||
if (gettimeofday(&now, 0) < 0)
|
||||
return (word32)GETTIME_ERROR;
|
||||
#endif
|
||||
|
||||
/* Convert to milliseconds number. */
|
||||
return (word32)(now.tv_sec * 1000 + now.tv_usec / 1000);
|
||||
}
|
||||
|
|
41
src/wolfio.c
41
src/wolfio.c
|
@ -697,24 +697,7 @@ int wolfIO_Recv(SOCKET_T sd, char *buf, int sz, int rdFlags)
|
|||
{
|
||||
int recvd;
|
||||
|
||||
#ifdef FUSION_RTOS
|
||||
int err;
|
||||
retry:
|
||||
recvd = (int)RECV_FUNCTION(sd, buf, sz, rdFlags, &err);
|
||||
|
||||
if(recvd < 0) {
|
||||
if(err==63)
|
||||
{
|
||||
UARTF("FUSION IO RETRY %d\r\n", err);
|
||||
fclThreadSleep(10);
|
||||
goto retry;
|
||||
}
|
||||
UARTF("FUSION IO ERROR %d\r\n", err);
|
||||
}
|
||||
//TODO handle return value in err
|
||||
#else
|
||||
recvd = (int)RECV_FUNCTION(sd, buf, sz, rdFlags);
|
||||
#endif
|
||||
recvd = TranslateReturnCode(recvd, sd);
|
||||
|
||||
return recvd;
|
||||
|
@ -723,22 +706,8 @@ retry:
|
|||
int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
|
||||
{
|
||||
int sent;
|
||||
#ifdef FUSION_RTOS
|
||||
int err;
|
||||
retry:
|
||||
sent = (int)SEND_FUNCTION(sd, buf, sz, wrFlags, &err);
|
||||
if(sent < 0) {
|
||||
if(err==63)
|
||||
{
|
||||
UARTF("FUSION IO SEND RETRY %d\r\n", err);
|
||||
fclThreadSleep(10);
|
||||
goto retry;
|
||||
}
|
||||
UARTF("FUSION IO SEND ERROR %d\r\n", err);
|
||||
}
|
||||
#else
|
||||
|
||||
sent = (int)SEND_FUNCTION(sd, buf, sz, wrFlags);
|
||||
#endif
|
||||
sent = TranslateReturnCode(sent, sd);
|
||||
|
||||
return sent;
|
||||
|
@ -1498,14 +1467,8 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
|
|||
ret = wolfIO_HttpProcessResponseOcsp(sfd, ocspRespBuf, httpBuf,
|
||||
HTTP_SCRATCH_BUFFER_SIZE, ctx);
|
||||
}
|
||||
if (sfd != SOCKET_INVALID) {
|
||||
#ifdef FUSION_RTOS
|
||||
int err;
|
||||
CloseSocket(sfd, &err);
|
||||
#else
|
||||
if (sfd != SOCKET_INVALID)
|
||||
CloseSocket(sfd);
|
||||
#endif
|
||||
}
|
||||
XFREE(httpBuf, ctx, DYNAMIC_TYPE_OCSP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -491,10 +491,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END VSEEK_END
|
||||
#define XBADFILE -1
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(LSR_FS)
|
||||
#include <fs.h>
|
||||
|
@ -509,10 +505,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END 0
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(FREESCALE_MQX) || defined(FREESCALE_KSDK_MQX)
|
||||
#define XFILE MQX_FILE_PTR
|
||||
|
@ -526,19 +518,11 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END IO_SEEK_END
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS fgets
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(WOLFSSL_DEOS)
|
||||
#define NO_FILESYSTEM
|
||||
#warning "TODO - DDC-I Certifiable Fast File System for Deos is not integrated"
|
||||
/* #define XFILE bfd * */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(MICRIUM)
|
||||
#include <fs_api.h>
|
||||
|
@ -553,10 +537,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END FS_SEEK_END
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(WOLFSSL_NUCLEUS_1_2)
|
||||
#include "fal/inc/fal.h"
|
||||
|
@ -570,10 +550,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XFCLOSE fclose
|
||||
#define XSEEK_END PSEEK_END
|
||||
#define XBADFILE NULL
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(WOLFSSL_APACHE_MYNEWT)
|
||||
#include <fs/fs.h>
|
||||
|
@ -589,10 +565,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END 2
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(WOLFSSL_ZEPHYR)
|
||||
#include <fs.h>
|
||||
|
@ -614,10 +586,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END FS_SEEK_END
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(WOLFSSL_TELIT_M2MB)
|
||||
#define XFILE INT32
|
||||
|
@ -631,10 +599,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END M2MB_SEEK_END
|
||||
#define XBADFILE -1
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined (WOLFSSL_XILINX)
|
||||
#include "xsdps.h"
|
||||
|
@ -652,10 +616,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XSEEK_END 0
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS(b,s,f) f_gets((b), (s), (f))
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#elif defined(FUSION_RTOS)
|
||||
#include <fclstdio.h>
|
||||
|
@ -689,6 +649,9 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define dirent fclDirent
|
||||
#define strncasecmp FCL_STRNCASECMP
|
||||
|
||||
/* FUSION SPECIFIC ERROR CODE */
|
||||
#define FUSION_IO_SEND_E 63
|
||||
|
||||
#elif defined(WOLFSSL_USER_FILESYSTEM)
|
||||
/* To be defined in user_settings.h */
|
||||
#else
|
||||
|
@ -712,10 +675,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#define XBADFILE NULL
|
||||
#define XFGETS fgets
|
||||
#define XFPRINTF fprintf
|
||||
#define XVFPRINTF vfprintf
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#define XFPUTS fputs
|
||||
#define XSPRINTF sprintf
|
||||
|
||||
#if !defined(USE_WINDOWS_API) && !defined(NO_WOLFSSL_DIR)\
|
||||
&& !defined(WOLFSSL_NUCLEUS) && !defined(WOLFSSL_NUCLEUS_1_2)
|
||||
|
@ -728,6 +687,22 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
/* Defaults, user may over-ride with user_settings.h or in a porting section
|
||||
* above
|
||||
*/
|
||||
#ifndef XVFPRINTF
|
||||
#define XVFPRINTF vfprintf
|
||||
#endif
|
||||
#ifndef XVSNPRINTF
|
||||
#define XVSNPRINTF vsnprintf
|
||||
#endif
|
||||
#ifndef XFPUTS
|
||||
#define XFPUTS fputs
|
||||
#endif
|
||||
#ifndef XSPRINTF
|
||||
#define XSPRINTF sprintf
|
||||
#endif
|
||||
|
||||
#ifndef MAX_FILENAME_SZ
|
||||
#define MAX_FILENAME_SZ 256 /* max file name length */
|
||||
#endif
|
||||
|
|
|
@ -389,7 +389,10 @@ WOLFSSL_API int wolfIO_Recv(SOCKET_T sd, char *buf, int sz, int rdFlags);
|
|||
#define StartTCP()
|
||||
#elif defined(FUSION_RTOS)
|
||||
#ifndef CloseSocket
|
||||
#define CloseSocket FNS_CLOSE
|
||||
#define CloseSocket(s) do { \
|
||||
int err; \
|
||||
FNS_CLOSE(s, &err); \
|
||||
} while(0)
|
||||
#endif
|
||||
#else
|
||||
#ifndef CloseSocket
|
||||
|
|
Loading…
Reference in New Issue