mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Added Visual Studio 2010 support and fixed some VS compilation issues.
Removed code to force blocking mode. git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@196 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
parent
e68581f0c2
commit
529d87ba09
@ -58,7 +58,7 @@ depends on CONFIG_PLATFORM_WIN32
|
|||||||
choice
|
choice
|
||||||
prompt "Compiler"
|
prompt "Compiler"
|
||||||
depends on CONFIG_PLATFORM_WIN32
|
depends on CONFIG_PLATFORM_WIN32
|
||||||
default CONFIG_VISUAL_STUDIO_7_0
|
default CONFIG_VISUAL_STUDIO_10_0
|
||||||
|
|
||||||
config CONFIG_VISUAL_STUDIO_7_0
|
config CONFIG_VISUAL_STUDIO_7_0
|
||||||
bool "Visual Studio 7.0 (2003)"
|
bool "Visual Studio 7.0 (2003)"
|
||||||
@ -70,6 +70,10 @@ config CONFIG_VISUAL_STUDIO_8_0
|
|||||||
help
|
help
|
||||||
Use Microsoft's Visual Studio 2005 platform.
|
Use Microsoft's Visual Studio 2005 platform.
|
||||||
|
|
||||||
|
config CONFIG_VISUAL_STUDIO_10_0
|
||||||
|
bool "Visual Studio 10.0 (2010)"
|
||||||
|
help
|
||||||
|
Use Microsoft's Visual Studio 2010 platform.
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config CONFIG_VISUAL_STUDIO_7_0_BASE
|
config CONFIG_VISUAL_STUDIO_7_0_BASE
|
||||||
@ -82,6 +86,10 @@ config CONFIG_VISUAL_STUDIO_8_0_BASE
|
|||||||
depends on CONFIG_VISUAL_STUDIO_8_0
|
depends on CONFIG_VISUAL_STUDIO_8_0
|
||||||
default "c:\\Program Files\\Microsoft Visual Studio 8"
|
default "c:\\Program Files\\Microsoft Visual Studio 8"
|
||||||
|
|
||||||
|
config CONFIG_VISUAL_STUDIO_10_0_BASE
|
||||||
|
string "Base"
|
||||||
|
depends on CONFIG_VISUAL_STUDIO_10_0
|
||||||
|
default "c:\\Program Files\\Microsoft Visual Studio 10.0"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
config CONFIG_EXTRA_CFLAGS_OPTIONS
|
config CONFIG_EXTRA_CFLAGS_OPTIONS
|
||||||
|
@ -48,16 +48,21 @@ CONFIG_VISUAL_STUDIO_7_0_BASE_UNIX:=$(shell cygpath -u $(CONFIG_VISUAL_STUDIO_7_
|
|||||||
export INCLUDE=$(shell echo "$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\include;$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\platformsdk\include")
|
export INCLUDE=$(shell echo "$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\include;$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\platformsdk\include")
|
||||||
export LIB=$(shell echo "$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\\platformsdk\lib;$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\lib")
|
export LIB=$(shell echo "$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\\platformsdk\lib;$(CONFIG_VISUAL_STUDIO_7_0_BASE)\vc7\lib")
|
||||||
PATH:=$(CONFIG_VISUAL_STUDIO_7_0_BASE_UNIX)/vc7/bin:$(CONFIG_VISUAL_STUDIO_7_0_BASE_UNIX)/common7/ide:$(PATH)
|
PATH:=$(CONFIG_VISUAL_STUDIO_7_0_BASE_UNIX)/vc7/bin:$(CONFIG_VISUAL_STUDIO_7_0_BASE_UNIX)/common7/ide:$(PATH)
|
||||||
else
|
endif
|
||||||
ifdef CONFIG_VISUAL_STUDIO_8_0
|
ifdef CONFIG_VISUAL_STUDIO_8_0
|
||||||
CONFIG_VISUAL_STUDIO_8_0_BASE_UNIX:=$(shell cygpath -u $(CONFIG_VISUAL_STUDIO_8_0_BASE))
|
CONFIG_VISUAL_STUDIO_8_0_BASE_UNIX:=$(shell cygpath -u $(CONFIG_VISUAL_STUDIO_8_0_BASE))
|
||||||
export INCLUDE=$(shell echo "$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\include;$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\platformsdk\include")
|
export INCLUDE=$(shell echo "$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\include;$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\platformsdk\include")
|
||||||
export LIB=$(shell echo "$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\platformsdk\lib;$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\lib")
|
export LIB=$(shell echo "$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\platformsdk\lib;$(CONFIG_VISUAL_STUDIO_8_0_BASE)\vc\lib")
|
||||||
PATH:=$(CONFIG_VISUAL_STUDIO_8_0_BASE_UNIX)/vc/bin:$(CONFIG_VISUAL_STUDIO_8_0_BASE_UNIX)/common7/ide:$(PATH)
|
PATH:=$(CONFIG_VISUAL_STUDIO_8_0_BASE_UNIX)/vc/bin:$(CONFIG_VISUAL_STUDIO_8_0_BASE_UNIX)/common7/ide:$(PATH)
|
||||||
|
endif
|
||||||
|
ifdef CONFIG_VISUAL_STUDIO_10_0
|
||||||
|
CONFIG_VISUAL_STUDIO_10_0_BASE_UNIX:=$(shell cygpath -u $(CONFIG_VISUAL_STUDIO_10_0_BASE))
|
||||||
|
export INCLUDE=$(shell echo "$(CONFIG_VISUAL_STUDIO_10_0_BASE)\vc\include;$(CONFIG_VISUAL_STUDIO_10_0_BASE)\..\Microsoft SDKs\Windows\v7.0A\include")
|
||||||
|
export LIB=$(shell echo "$(CONFIG_VISUAL_STUDIO_10_0_BASE)\vc\lib;$(CONFIG_VISUAL_STUDIO_10_0_BASE)\..\Microsoft SDKs\Windows\v7.0A\lib")
|
||||||
|
PATH:=$(CONFIG_VISUAL_STUDIO_10_0_BASE_UNIX)/vc/bin:$(CONFIG_VISUAL_STUDIO_10_0_BASE_UNIX)/common7/ide:$(PATH)
|
||||||
stuff:
|
stuff:
|
||||||
@echo $(INCLUDE)
|
@echo $(INCLUDE)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
CC=cl.exe
|
CC=cl.exe
|
||||||
LD=link.exe
|
LD=link.exe
|
||||||
|
@ -826,6 +826,7 @@ static bigint *regular_multiply(BI_CTX *ctx, bigint *bia, bigint *bib,
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
long_comp tmp;
|
||||||
comp carry = 0;
|
comp carry = 0;
|
||||||
int r_index = i;
|
int r_index = i;
|
||||||
j = 0;
|
j = 0;
|
||||||
@ -843,7 +844,7 @@ static bigint *regular_multiply(BI_CTX *ctx, bigint *bia, bigint *bib,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
long_comp tmp = sr[r_index] + ((long_comp)sa[j])*sb[i] + carry;
|
tmp = sr[r_index] + ((long_comp)sa[j])*sb[i] + carry;
|
||||||
sr[r_index++] = (comp)tmp; /* downsize */
|
sr[r_index++] = (comp)tmp; /* downsize */
|
||||||
carry = tmp >> COMP_BIT_SIZE;
|
carry = tmp >> COMP_BIT_SIZE;
|
||||||
} while (++j < n);
|
} while (++j < n);
|
||||||
|
@ -177,11 +177,12 @@ EXP_FUNC void STDCALL get_random(int num_rand_bytes, uint8_t *rand_data)
|
|||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
MD5_CTX rng_digest_ctx;
|
MD5_CTX rng_digest_ctx;
|
||||||
uint8_t digest[MD5_SIZE];
|
uint8_t digest[MD5_SIZE];
|
||||||
|
uint64_t *ep;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* A proper implementation would use counters etc for entropy */
|
/* A proper implementation would use counters etc for entropy */
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
uint64_t *ep = (uint64_t *)entropy_pool;
|
ep = (uint64_t *)entropy_pool;
|
||||||
ep[0] ^= ENTROPY_COUNTER1;
|
ep[0] ^= ENTROPY_COUNTER1;
|
||||||
ep[1] ^= ENTROPY_COUNTER2;
|
ep[1] ^= ENTROPY_COUNTER2;
|
||||||
|
|
||||||
|
@ -82,8 +82,6 @@ extern "C" {
|
|||||||
#define SOCKET_READ(A,B,C) recv(A,B,C,0)
|
#define SOCKET_READ(A,B,C) recv(A,B,C,0)
|
||||||
#define SOCKET_WRITE(A,B,C) send(A,B,C,0)
|
#define SOCKET_WRITE(A,B,C) send(A,B,C,0)
|
||||||
#define SOCKET_CLOSE(A) closesocket(A)
|
#define SOCKET_CLOSE(A) closesocket(A)
|
||||||
#define SOCKET_BLOCK(A) u_long argp = 0; \
|
|
||||||
ioctlsocket(A, FIONBIO, &argp)
|
|
||||||
#define srandom(A) srand(A)
|
#define srandom(A) srand(A)
|
||||||
#define random() rand()
|
#define random() rand()
|
||||||
#define getpid() _getpid()
|
#define getpid() _getpid()
|
||||||
@ -143,6 +141,7 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size);
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -153,8 +152,6 @@ EXP_FUNC int STDCALL getdomainname(char *buf, int buf_size);
|
|||||||
#define SOCKET_READ(A,B,C) read(A,B,C)
|
#define SOCKET_READ(A,B,C) read(A,B,C)
|
||||||
#define SOCKET_WRITE(A,B,C) write(A,B,C)
|
#define SOCKET_WRITE(A,B,C) write(A,B,C)
|
||||||
#define SOCKET_CLOSE(A) if (A >= 0) close(A)
|
#define SOCKET_CLOSE(A) if (A >= 0) close(A)
|
||||||
#define SOCKET_BLOCK(A) int fd = fcntl(A, F_GETFL, NULL); \
|
|
||||||
fcntl(A, F_SETFL, fd & ~O_NONBLOCK)
|
|
||||||
#define TTY_FLUSH()
|
#define TTY_FLUSH()
|
||||||
|
|
||||||
#endif /* Not Win32 */
|
#endif /* Not Win32 */
|
||||||
|
@ -197,7 +197,8 @@ extern "C" {
|
|||||||
* are passed during a handshake.
|
* are passed during a handshake.
|
||||||
* - SSL_DISPLAY_RSA (full mode build only): Display the RSA key details that
|
* - SSL_DISPLAY_RSA (full mode build only): Display the RSA key details that
|
||||||
* are passed during a handshake.
|
* are passed during a handshake.
|
||||||
*
|
* - SSL_CLIENT_NON_BLOCKING (client only): Use non-blocking version of
|
||||||
|
* ssl_client_new.
|
||||||
* @param num_sessions [in] The number of sessions to be used for session
|
* @param num_sessions [in] The number of sessions to be used for session
|
||||||
* caching. If this value is 0, then there is no session caching. This option
|
* caching. If this value is 0, then there is no session caching. This option
|
||||||
* is not used in skeleton mode.
|
* is not used in skeleton mode.
|
||||||
@ -231,8 +232,9 @@ EXP_FUNC SSL * STDCALL ssl_server_new(SSL_CTX *ssl_ctx, int client_fd);
|
|||||||
* It is up to the application to establish the initial logical connection
|
* It is up to the application to establish the initial logical connection
|
||||||
* (whether it is a socket, serial connection etc).
|
* (whether it is a socket, serial connection etc).
|
||||||
*
|
*
|
||||||
* This is a blocking call - it will finish when the handshake is complete (or
|
* This is a normall a blocking call - it will finish when the handshake is
|
||||||
* has failed).
|
* complete (or has failed). To use in non-blocking mode, set
|
||||||
|
* SSL_CLIENT_NON_BLOCKING in ssl_ctx_new.
|
||||||
* @param ssl_ctx [in] The client context.
|
* @param ssl_ctx [in] The client context.
|
||||||
* @param client_fd [in] The client's file descriptor.
|
* @param client_fd [in] The client's file descriptor.
|
||||||
* @param session_id [in] A 32 byte session id for session resumption. This
|
* @param session_id [in] A 32 byte session id for session resumption. This
|
||||||
|
@ -287,6 +287,7 @@ EXP_FUNC int STDCALL ssl_read(SSL *ssl, uint8_t **in_data)
|
|||||||
int ret = basic_read(ssl, in_data);
|
int ret = basic_read(ssl, in_data);
|
||||||
|
|
||||||
/* check for return code so we can send an alert */
|
/* check for return code so we can send an alert */
|
||||||
|
|
||||||
if (ret < SSL_OK && ret != SSL_CLOSE_NOTIFY)
|
if (ret < SSL_OK && ret != SSL_CLOSE_NOTIFY)
|
||||||
{
|
{
|
||||||
if (ret != SSL_ERROR_CONN_LOST)
|
if (ret != SSL_ERROR_CONN_LOST)
|
||||||
@ -1159,6 +1160,14 @@ int basic_read(SSL *ssl, uint8_t **in_data)
|
|||||||
read_len = SOCKET_READ(ssl->client_fd, &buf[ssl->bm_read_index],
|
read_len = SOCKET_READ(ssl->client_fd, &buf[ssl->bm_read_index],
|
||||||
ssl->need_bytes-ssl->got_bytes);
|
ssl->need_bytes-ssl->got_bytes);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
#ifdef WIN32
|
||||||
|
if (GetLastError() == WSAEWOULDBLOCK)
|
||||||
|
#else
|
||||||
|
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* connection has gone, so die */
|
/* connection has gone, so die */
|
||||||
if (read_len <= 0)
|
if (read_len <= 0)
|
||||||
{
|
{
|
||||||
|
@ -50,10 +50,7 @@ static int send_cert_verify(SSL *ssl);
|
|||||||
EXP_FUNC SSL * STDCALL ssl_client_new(SSL_CTX *ssl_ctx, int client_fd, const
|
EXP_FUNC SSL * STDCALL ssl_client_new(SSL_CTX *ssl_ctx, int client_fd, const
|
||||||
uint8_t *session_id, uint8_t sess_id_size)
|
uint8_t *session_id, uint8_t sess_id_size)
|
||||||
{
|
{
|
||||||
SSL *ssl;
|
SSL *ssl = ssl_new(ssl_ctx, client_fd);
|
||||||
|
|
||||||
SOCKET_BLOCK(client_fd); /* ensure blocking mode */
|
|
||||||
ssl = ssl_new(ssl_ctx, client_fd);
|
|
||||||
|
|
||||||
if (session_id && ssl_ctx->num_sessions)
|
if (session_id && ssl_ctx->num_sessions)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user