1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

fixed win32 build

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@117 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich 2007-08-29 13:22:46 +00:00
parent f9ee197cff
commit 2bbf4cfd92
15 changed files with 144 additions and 103 deletions

View File

@ -471,8 +471,10 @@ namespace axTLS
public SSL Connect(Socket s, byte[] session_id) public SSL Connect(Socket s, byte[] session_id)
{ {
int client_fd = s.Handle.ToInt32(); int client_fd = s.Handle.ToInt32();
return new SSL(axtls. ssl_client_new(m_ctx, client_fd, session_id, byte sess_id_size = (byte)(session_id != null ?
session_id ? null : session_id.Length)); session_id.Length : 0);
return new SSL(axtls.ssl_client_new(m_ctx, client_fd, session_id,
sess_id_size));
} }
} }
} }

View File

@ -177,13 +177,13 @@ print DATA_OUT << "END";
%apply signed char[] {signed char *}; %apply signed char[] {signed char *};
/* allow ssl_get_session_id() to return "byte[]" */ /* allow ssl_get_session_id() to return "byte[]" */
%typemap(out) unsigned char * ssl_get_session_id \"if (result) jresult = SWIG_JavaArrayOutSchar(jenv, result, SSL_SESSION_ID_SIZE);\" %typemap(out) unsigned char * ssl_get_session_id \"if (result) jresult = SWIG_JavaArrayOutSchar(jenv, result, ssl_get_session_id_size((SSL const *)arg1));\"
/* allow ssl_client_new() to have a null session_id input */ /* allow ssl_client_new() to have a null session_id input */
%typemap(in) const signed char session_id[] (jbyte *jarr) { %typemap(in) const signed char session_id[] (jbyte *jarr) {
if (jarg3 == NULL) if (jarg3 == NULL)
{ {
jresult = (jint)ssl_client_new(arg1,arg2,NULL); jresult = (jint)ssl_client_new(arg1,arg2,NULL,0);
return jresult; return jresult;
} }
@ -275,7 +275,7 @@ JNIEXPORT jint JNICALL Java_axTLSj_axtlsjJNI_getFd(JNIEnv *env, jclass jcls, job
/* for ssl_session_id() */ /* for ssl_session_id() */
%typemap(out) const unsigned char * { %typemap(out) const unsigned char * {
SV *svs = newSVpv((const char *)\$1, SSL_SESSION_ID_SIZE); SV *svs = newSVpv((unsigned char *)\$1, (int)ssl_get_session_id((SSL const *)arg1));
\$result = newRV(svs); \$result = newRV(svs);
sv_2mortal(\$result); sv_2mortal(\$result);
argvi++; argvi++;
@ -330,7 +330,7 @@ SWIG_TYPEMAP_NUM_ARR(uchar,unsigned char);
%typemap(out) const unsigned char * { %typemap(out) const unsigned char * {
int i; int i;
lua_newtable(L); lua_newtable(L);
for (i = 0; i < SSL_SESSION_ID_SIZE; i++){ for (i = 0; i < ssl_get_session_id((SSL const *)\$1); i++){
lua_pushnumber(L,(lua_Number)result[i]); lua_pushnumber(L,(lua_Number)result[i]);
lua_rawseti(L,-2,i+1); /* -1 is the number, -2 is the table */ lua_rawseti(L,-2,i+1); /* -1 is the number, -2 is the table */
} }
@ -359,7 +359,7 @@ SWIG_TYPEMAP_NUM_ARR(uchar,unsigned char);
if (lua_isnil(L,\$input)) if (lua_isnil(L,\$input))
\$1 = NULL; \$1 = NULL;
else else
\$1 = SWIG_get_uchar_num_array_fixed(L,\$input, SSL_SESSION_ID_SIZE); \$1 = SWIG_get_uchar_num_array_fixed(L,\$input, ssl_get_session_id((SSL const *)\$1));
} }
#endif #endif

View File

@ -90,6 +90,7 @@ sub transformSignature
$line =~ s/uint8_t \*\* ?(\w+)/ByRef $1 As IntPtr/g; $line =~ s/uint8_t \*\* ?(\w+)/ByRef $1 As IntPtr/g;
$line =~ s/const uint8_t \* ?(\w+)/ByVal $1() As Byte/g; $line =~ s/const uint8_t \* ?(\w+)/ByVal $1() As Byte/g;
$line =~ s/uint8_t \* ?(\w+)/ByVal $1() As Byte/g; $line =~ s/uint8_t \* ?(\w+)/ByVal $1() As Byte/g;
$line =~ s/uint8_t ?(\w+)/ByVal $1 As Byte/g;
$line =~ s/const char \* ?(\w+)/ByVal $1 As String/g; $line =~ s/const char \* ?(\w+)/ByVal $1 As String/g;
$line =~ s/const SSL_CTX \* ?(\w+)/ByVal $1 As IntPtr/g; $line =~ s/const SSL_CTX \* ?(\w+)/ByVal $1 As IntPtr/g;
$line =~ s/SSL_CTX \* ?(\w+)/ByVal $1 As IntPtr/g; $line =~ s/SSL_CTX \* ?(\w+)/ByVal $1 As IntPtr/g;

View File

@ -61,6 +61,9 @@ public class SSLClient extends SSLCTX
public SSL connect(Socket s, byte[] session_id) public SSL connect(Socket s, byte[] session_id)
{ {
int client_fd = axtlsj.getFd(s); int client_fd = axtlsj.getFd(s);
return new SSL(axtlsj.ssl_client_new(m_ctx, client_fd, session_id)); byte sess_id_size = (byte)(session_id != null ?
session_id.length : 0);
return new SSL(axtlsj.ssl_client_new(m_ctx, client_fd, session_id,
sess_id_size));
} }
} }

View File

@ -48,8 +48,7 @@ Namespace axTLSvb
Public Function GetSessionId() As Byte() Public Function GetSessionId() As Byte()
Dim ptr As IntPtr = axtls.ssl_get_session_id(m_ssl) Dim ptr As IntPtr = axtls.ssl_get_session_id(m_ssl)
Dim sess_id_size As Integer = axtls.ssl_get_session_id_size(m_ssl) Dim sess_id_size As Integer = axtls.ssl_get_session_id_size(m_ssl)
Dim result(sess_id_size-1) As Byte
Dim result(sess_id_size) As Byte
Marshal.Copy(ptr, result, 0, sess_id_size) Marshal.Copy(ptr, result, 0, sess_id_size)
Return result Return result
End Function End Function
@ -172,10 +171,16 @@ Namespace axTLSvb
End Sub End Sub
Public Function Connect(ByVal s As Socket, _ Public Function Connect(ByVal s As Socket, _
ByVal session_id As Byte(), _ ByVal session_id As Byte()) As SSL
ByVal sess_id_size As Integer) As SSL
Dim client_fd As Integer = s.Handle.ToInt32() Dim client_fd As Integer = s.Handle.ToInt32()
Return New SSL( axtls.ssl_client_new(m_ctx, client_fd, session_id, _ Dim sess_id_size As Byte
If session_id is Nothing Then
sess_id_size = 0
Else
sess_id_size = session_id.Length
End If
Return New SSL(axtls.ssl_client_new(m_ctx, client_fd, session_id, _
sess_id_size)) sess_id_size))
End Function End Function

View File

@ -54,7 +54,8 @@ endif
CC=cl.exe CC=cl.exe
LD=link.exe LD=link.exe
CFLAGS+=/nologo /W3 /D "WIN32" /D "_MBCS" /D "_CONSOLE" /FD /I"..\ssl" /I"..\config" /c AXTLS_INCLUDE=$(shell cygpath -w $(AXTLS_HOME))
CFLAGS+=/nologo /W3 /D "WIN32" /D "_MBCS" /D "_CONSOLE" /FD /I"$(AXTLS_INCLUDE)crypto" /I"$(AXTLS_INCLUDE)ssl" /I"$(AXTLS_INCLUDE)config" /c
LDFLAGS=/nologo /subsystem:console /machine:I386 LDFLAGS=/nologo /subsystem:console /machine:I386
LDSHARED = /dll LDSHARED = /dll
AR=lib /nologo AR=lib /nologo

View File

@ -28,6 +28,7 @@ OBJ=\
rc4.o \ rc4.o \
sha1.o sha1.o
include ../config/makefile.post
all: $(OBJ) all: $(OBJ)
include ../config/makefile.post

View File

@ -18,27 +18,27 @@
all : web_server lua all : web_server lua
include ../config/.config AXTLS_HOME=..
include ../config/makefile.conf
include $(AXTLS_HOME)/config/.config
include $(AXTLS_HOME)/config/makefile.conf
ifndef CONFIG_PLATFORM_WIN32 ifndef CONFIG_PLATFORM_WIN32
ifdef CONFIG_PLATFORM_CYGWIN ifdef CONFIG_PLATFORM_CYGWIN
TARGET=../$(STAGE)/axhttpd.exe TARGET=$(AXTLS_HOME)/$(STAGE)/axhttpd.exe
TARGET2=../$(STAGE)/htpasswd.exe TARGET2=$(AXTLS_HOME)/$(STAGE)/htpasswd.exe
else else
TARGET=../$(STAGE)/axhttpd TARGET=$(AXTLS_HOME)/$(STAGE)/axhttpd
TARGET2=../$(STAGE)/htpasswd TARGET2=$(AXTLS_HOME)/$(STAGE)/htpasswd
endif endif
ifdef CONFIG_HTTP_STATIC_BUILD ifdef CONFIG_HTTP_STATIC_BUILD
LIBS=../$(STAGE)/libaxtls.a LIBS=$(AXTLS_HOME)/$(STAGE)/libaxtls.a
else else
LIBS=-L../$(STAGE) -laxtls LIBS=-L$(AXTLS_HOME)/$(STAGE) -laxtls
endif endif
AXTLS_HOME=..
ifdef CONFIG_HTTP_BUILD_LUA ifdef CONFIG_HTTP_BUILD_LUA
lua: kepler-1.1 lua: kepler-1.1
@ -53,13 +53,13 @@ endif
else # win32 build else # win32 build
lua: lua:
TARGET=../$(STAGE)/axhttpd.exe TARGET=$(AXTLS_HOME)/$(STAGE)/axhttpd.exe
TARGET2=../$(STAGE)/htpasswd.exe TARGET2=$(AXTLS_HOME)/$(STAGE)/htpasswd.exe
ifdef CONFIG_HTTP_STATIC_BUILD ifdef CONFIG_HTTP_STATIC_BUILD
LIBS=../$(STAGE)/axtls.static.lib ..\\config\\axtls.res LIBS=$(AXTLS_HOME)/$(STAGE)/axtls.static.lib $(AXTLS_HOME)\\config\\axtls.res
else else
LIBS=../$(STAGE)/axtls.lib ..\\config\\axtls.res LIBS=$(AXTLS_HOME)/$(STAGE)/axtls.lib $(AXTLS_HOME)\\config\\axtls.res
endif endif
endif endif
@ -78,11 +78,11 @@ OBJ= \
proc.o \ proc.o \
tdate_parse.o tdate_parse.o
include ../config/makefile.post include $(AXTLS_HOME)/config/makefile.post
ifndef CONFIG_PLATFORM_WIN32 ifndef CONFIG_PLATFORM_WIN32
$(TARGET): $(OBJ) ../$(STAGE)/libaxtls.a $(TARGET): $(OBJ) $(AXTLS_HOME)/$(STAGE)/libaxtls.a
$(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
ifndef CONFIG_DEBUG ifndef CONFIG_DEBUG
ifndef CONFIG_PLATFORM_SOLARIS ifndef CONFIG_PLATFORM_SOLARIS
@ -90,7 +90,7 @@ ifndef CONFIG_PLATFORM_SOLARIS
endif endif
endif endif
$(TARGET2): htpasswd.o ../$(STAGE)/libaxtls.a $(TARGET2): htpasswd.o $(AXTLS_HOME)/$(STAGE)/libaxtls.a
$(LD) $(LDFLAGS) -o $@ htpasswd.o $(LIBS) $(LD) $(LDFLAGS) -o $@ htpasswd.o $(LIBS)
else # Win32 else # Win32
@ -100,13 +100,13 @@ OBJ:=$(OBJ:.o=.obj)
$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $<
htpasswd.obj : htpasswd.c htpasswd.obj : htpasswd.c
$(CC) $(CFLAGS) $< $(CC) $(CFLAGS) $?
$(TARGET): $(OBJ) $(TARGET): $(OBJ)
$(LD) $(LDFLAGS) $(LIBS) /out:$@ $(OBJ) $(LD) $(LDFLAGS) /out:$@ $(LIBS) $?
$(TARGET2): htpasswd.obj $(TARGET2): htpasswd.obj
$(LD) $(LDFLAGS) $(LIBS) /out:$@ $< $(LD) $(LDFLAGS) /out:$@ $(LIBS) $?
endif endif
endif # CONFIG_AXHTTPD endif # CONFIG_AXHTTPD

View File

@ -18,22 +18,22 @@
all : sample all : sample
include ../../config/.config AXTLS_HOME=../..
include ../../config/makefile.conf
include $(AXTLS_HOME)/config/.config
include $(AXTLS_HOME)/config/makefile.conf
ifndef CONFIG_PLATFORM_WIN32 ifndef CONFIG_PLATFORM_WIN32
ifdef CONFIG_PLATFORM_CYGWIN ifdef CONFIG_PLATFORM_CYGWIN
TARGET=../../$(STAGE)/axssl.exe TARGET=$(AXTLS_HOME)/$(STAGE)/axssl.exe
else else
TARGET=../../$(STAGE)/axssl TARGET=$(AXTLS_HOME)/$(STAGE)/axssl
endif # cygwin endif # cygwin
LIBS=../../$(STAGE) LIBS=$(AXTLS_HOME)/$(STAGE)
CFLAGS += -I../../crypto -I../../ssl -I../../config
else else
TARGET=../../$(STAGE)/axssl.exe TARGET=$(AXTLS_HOME)/$(STAGE)/axssl.exe
CFLAGS += /I"..\..\ssl" /I"..\..\config"
endif endif
ifndef CONFIG_C_SAMPLES ifndef CONFIG_C_SAMPLES
@ -42,12 +42,12 @@ sample:
else else
sample : $(TARGET) sample : $(TARGET)
OBJ= axssl.o OBJ= axssl.o
include ../../config/makefile.post include $(AXTLS_HOME)/config/makefile.post
ifndef CONFIG_PLATFORM_WIN32 ifndef CONFIG_PLATFORM_WIN32
$(TARGET): $(OBJ) $(LIBS)/libaxtls.a $(TARGET): $(OBJ) $(LIBS)/libaxtls.a
$(LD) $(LDFLAGS) -o $@ $< -L$(LIBS) -laxtls $(LD) $(LDFLAGS) -o $@ $(OBJ) -L$(LIBS) -laxtls
ifndef CONFIG_DEBUG ifndef CONFIG_DEBUG
ifndef CONFIG_PLATFORM_SOLARIS ifndef CONFIG_PLATFORM_SOLARIS
strip --remove-section=.comment $(TARGET) strip --remove-section=.comment $(TARGET)
@ -56,11 +56,11 @@ endif # CONFIG_DEBUG
else # Win32 else # Win32
$(TARGET): $(OBJ) $(TARGET): $(OBJ)
$(LD) $(LDFLAGS) ..\\..\\config\\axtls.res /out:$@ $^ /libpath:"../../$(STAGE)" axtls.lib $(LD) $(LDFLAGS) $(AXTLS_HOME)/config/axtls.res /out:$@ $^ /libpath:"$(AXTLS_HOME)/$(STAGE)" axtls.lib
endif endif
endif # CONFIG_C_SAMPLES endif # CONFIG_C_SAMPLES
clean:: clean::
-@rm -f ../../$(STAGE)/axssl* -@rm -f $(AXTLS_HOME)/$(STAGE)/axssl*

View File

@ -508,8 +508,7 @@ public class axssl
{ {
while (reconnect-- > 0) while (reconnect-- > 0)
{ {
ssl = ssl_ctx.Connect(client_sock, session_id, ssl = ssl_ctx.Connect(client_sock, session_id);
axtls.SSL_SESSION_ID_SIZE);
if ((res = ssl.HandshakeStatus()) != axtls.SSL_OK) if ((res = ssl.HandshakeStatus()) != axtls.SSL_OK)
{ {

View File

@ -16,8 +16,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
include ../config/.config AXTLS_HOME=..
include ../config/makefile.conf
include $(AXTLS_HOME)/config/.config
include $(AXTLS_HOME)/config/makefile.conf
all: libs all: libs
ifdef CONFIG_PERFORMANCE_TESTING ifdef CONFIG_PERFORMANCE_TESTING
@ -29,76 +31,79 @@ endif
endif endif
ifndef CONFIG_PLATFORM_WIN32 ifndef CONFIG_PLATFORM_WIN32
TARGET1=../$(STAGE)/libaxtls.a TARGET1=$(AXTLS_HOME)/$(STAGE)/libaxtls.a
BASETARGET=libaxtls.so BASETARGET=libaxtls.so
CRYPTO_PATH=$(AXTLS_HOME)/crypto/
ifdef CONFIG_PLATFORM_CYGWIN ifdef CONFIG_PLATFORM_CYGWIN
TARGET2=../$(STAGE)/libaxtls.dll.a TARGET2=$(AXTLS_HOME)/$(STAGE)/libaxtls.dll.a
else else
TARGET2=../$(STAGE)/$(LIBMINOR) TARGET2=$(AXTLS_HOME)/$(STAGE)/$(LIBMINOR)
endif endif
# shared library major/minor numbers # shared library major/minor numbers
LIBMAJOR=$(BASETARGET).1 LIBMAJOR=$(BASETARGET).1
LIBMINOR=$(BASETARGET).1.1 LIBMINOR=$(BASETARGET).1.1
else else
TARGET1=axtls.lib TARGET1=$(AXTLS_HOME)/axtls.lib
TARGET2=../$(STAGE)/axtls.dll TARGET2=$(AXTLS_HOME)/$(STAGE)/axtls.dll
STATIC_LIB=../$(STAGE)/axtls.static.lib STATIC_LIB=$(AXTLS_HOME)/$(STAGE)/axtls.static.lib
CRYPTO_PATH=$(AXTLS_HOME)\\crypto\\
endif endif
libs: $(TARGET1) $(TARGET2) libs: $(TARGET1) $(TARGET2)
AXTLS_HOME=.. CRYPTO_OBJ=\
$(CRYPTO_PATH)aes.o \
$(CRYPTO_PATH)hmac.o \
$(CRYPTO_PATH)md5.o \
$(CRYPTO_PATH)rc4.o \
$(CRYPTO_PATH)sha1.o
OBJ=\ OBJ=\
../crypto/aes.o \
asn1.o \ asn1.o \
x509.o \ x509.o \
bigint.o \ bigint.o \
crypto_misc.o \ crypto_misc.o \
../crypto/hmac.o \
os_port.o \ os_port.o \
loader.o \ loader.o \
../crypto/md5.o \
openssl.o \ openssl.o \
p12.o \ p12.o \
rsa.o \ rsa.o \
../crypto/rc4.o \
../crypto/sha1.o \
tls1.o \ tls1.o \
tls1_svr.o \ tls1_svr.o \
tls1_clnt.o tls1_clnt.o
include ../config/makefile.post include $(AXTLS_HOME)/config/makefile.post
ifndef CONFIG_PLATFORM_WIN32 # Linux/Unix/Cygwin ifndef CONFIG_PLATFORM_WIN32 # Linux/Unix/Cygwin
$(TARGET1) : $(OBJ) $(TARGET1) : $(OBJ)
$(AR) -r $@ $(OBJ) $(AR) -r $@ $(CRYPTO_OBJ) $(OBJ)
$(TARGET2) : $(OBJ) $(TARGET2) : $(OBJ)
ifndef CONFIG_PLATFORM_CYGWIN ifndef CONFIG_PLATFORM_CYGWIN
$(LD) $(LDFLAGS) $(LDSHARED) -Wl,-soname,$(LIBMAJOR) -o ../$(STAGE)/$(LIBMINOR) $(OBJ) $(LD) $(LDFLAGS) $(LDSHARED) -Wl,-soname,$(LIBMAJOR) -o $(AXTLS_HOME)/$(STAGE)/$(LIBMINOR) $(CRYPTO_OBJ) $(OBJ)
cd ../$(STAGE); ln -sf $(LIBMINOR) $(LIBMAJOR); ln -sf $(LIBMAJOR) $(BASETARGET); cd - cd $(AXTLS_HOME)/$(STAGE); ln -sf $(LIBMINOR) $(LIBMAJOR); ln -sf $(LIBMAJOR) $(BASETARGET); cd -
else else
$(LD) $(LDFLAGS) $(LDSHARED) -o ../$(STAGE)/cygaxtls.dll \ $(LD) $(LDFLAGS) $(LDSHARED) -o $(AXTLS_HOME)/$(STAGE)/cygaxtls.dll \
-Wl,--out-implib=../$(STAGE)/libaxtls.dll.a \ -Wl,--out-implib=$(AXTLS_HOME)/$(STAGE)/libaxtls.dll.a \
-Wl,--export-all-symbols \ -Wl,--export-all-symbols \
-Wl,--enable-auto-import $(OBJ) -Wl,--enable-auto-import $(CRYPTO_OBJ) $(OBJ)
endif endif
else # Win32 else # Win32
CRYPTO_OBJ:=$(CRYPTO_OBJ:.o=.obj)
$(TARGET1) : $(OBJ) $(TARGET1) : $(OBJ)
$(AR) /out:$@ $(OBJ) $(AR) /out:$@ $(CRYPTO_OBJ) $(OBJ)
$(TARGET2) : $(OBJ) $(TARGET2) : $(OBJ)
cp $(TARGET1) $(STATIC_LIB) cp $(TARGET1) $(STATIC_LIB)
$(LD) $(LDFLAGS) $(LDSHARED) /out:$@ $(OBJ) $(LD) $(LDFLAGS) $(LDSHARED) /out:$@ $(CRYPTO_OBJ) $(OBJ)
endif endif
clean:: clean::
$(MAKE) -C test clean $(MAKE) -C test clean
-@rm -f ../$(STAGE)/* *.a *.lib -@rm -f $(AXTLS_HOME)/$(STAGE)/* *.a $(TARGET1) $(TARGET2)

View File

@ -18,8 +18,10 @@
all: all:
include ../../config/.config AXTLS_HOME=../..
include ../../config/makefile.conf
include $(AXTLS_HOME)/config/.config
include $(AXTLS_HOME)/config/makefile.conf
ifdef CONFIG_PERFORMANCE_TESTING ifdef CONFIG_PERFORMANCE_TESTING
all: performance all: performance
@ -29,37 +31,53 @@ ifdef CONFIG_SSL_TEST
all: ssltesting all: ssltesting
endif endif
ifndef CONFIG_PLATFORM_WIN32 include $(AXTLS_HOME)/config/makefile.post
performance: ../../$(STAGE)/perf_bigint
ssltesting: ../../$(STAGE)/ssltest
LIBS=../../$(STAGE)
CFLAGS += -I../../ssl -I../../config -I../../crypto
../../$(STAGE)/perf_bigint: perf_bigint.o $(LIBS)/libaxtls.a ifndef CONFIG_PLATFORM_WIN32
performance: $(AXTLS_HOME)/$(STAGE)/perf_bigint
ssltesting: $(AXTLS_HOME)/$(STAGE)/ssltest
LIBS=$(AXTLS_HOME)/$(STAGE)
$(AXTLS_HOME)/$(STAGE)/perf_bigint: perf_bigint.o $(LIBS)/libaxtls.a
$(CC) $(LDFLAGS) -o $@ $^ -L $(LIBS) -laxtls $(CC) $(LDFLAGS) -o $@ $^ -L $(LIBS) -laxtls
../../$(STAGE)/ssltest: ssltest.o $(LIBS)/libaxtls.a $(AXTLS_HOME)/$(STAGE)/ssltest: ssltest.o $(LIBS)/libaxtls.a
$(CC) $(LDFLAGS) -o $@ $^ -lpthread -L $(LIBS) -laxtls $(CC) $(LDFLAGS) -o $@ $^ -lpthread -L $(LIBS) -laxtls
else else
performance: ../../$(STAGE)/perf_bigint.exe performance: $(AXTLS_HOME)/$(STAGE)/perf_bigint.exe
ssltesting: ../../$(STAGE)/ssltest.exe ssltesting: $(AXTLS_HOME)/$(STAGE)/ssltest.exe
CFLAGS += /I".." /I"../../config"
%.obj : %.c CRYPTO_PATH="$(AXTLS_INCLUDE)crypto\\"
$(CC) $(CFLAGS) $< AXTLS_SSL_PATH="$(AXTLS_INCLUDE)ssl\\"
OBJLIST=..\aes.obj ..\asn1.obj ..\bigint.obj ..\crypto_misc.obj ..\hmac.obj \ CRYPTO_OBJ=\
..\md5.obj ..\loader.obj ..\p12.obj ..\os_port.obj ..\rc4.obj \ $(CRYPTO_PATH)aes.obj \
..\rsa.obj ..\sha1.obj ..\tls1.obj ..\tls1_clnt.obj ..\tls1_svr.obj $(CRYPTO_PATH)hmac.obj \
$(CRYPTO_PATH)md5.obj \
$(CRYPTO_PATH)rc4.obj \
$(CRYPTO_PATH)sha1.obj
../../$(STAGE)/perf_bigint.exe: perf_bigint.obj $(OBJLIST) OBJ=\
$(LD) $(LDFLAGS) /out:$@ $^ $(AXTLS_SSL_PATH)asn1.obj \
$(AXTLS_SSL_PATH)x509.obj \
$(AXTLS_SSL_PATH)bigint.obj \
$(AXTLS_SSL_PATH)crypto_misc.obj \
$(AXTLS_SSL_PATH)os_port.obj \
$(AXTLS_SSL_PATH)loader.obj \
$(AXTLS_SSL_PATH)openssl.obj \
$(AXTLS_SSL_PATH)p12.obj \
$(AXTLS_SSL_PATH)rsa.obj \
$(AXTLS_SSL_PATH)tls1.obj \
$(AXTLS_SSL_PATH)tls1_svr.obj \
$(AXTLS_SSL_PATH)tls1_clnt.obj
../../$(STAGE)/ssltest.exe: ssltest.obj $(OBJLIST) $(AXTLS_HOME)/$(STAGE)/perf_bigint.exe: perf_bigint.obj
$(LD) $(LDFLAGS) /out:$@ $^ $(LD) $(LDFLAGS) /out:$@ $? $(CRYPTO_OBJ) $(OBJ)
$(AXTLS_HOME)/$(STAGE)/ssltest.exe: ssltest.obj
$(LD) $(LDFLAGS) /out:$@ $? $(CRYPTO_OBJ) $(OBJ)
endif endif
clean:: clean::
-@rm -f ../../$(STAGE)/perf_bigint* ../../$(STAGE)/ssltest* -@rm -f $(AXTLS_HOME)/$(STAGE)/perf_bigint* $(AXTLS_HOME)/$(STAGE)/ssltest*
include ../../config/makefile.post

View File

@ -106,6 +106,8 @@ fi
if [ -x ./axssl.vbnet.exe ]; then if [ -x ./axssl.vbnet.exe ]; then
echo "######################## VB.NET SAMPLE ###########################" echo "######################## VB.NET SAMPLE ###########################"
echo $SERVER_ARGS
echo $CLIENT_ARGS
./axssl.vbnet $SERVER_ARGS & ./axssl.vbnet $SERVER_ARGS &
echo "VB.NET Test passed" | ./axssl.vbnet.exe $CLIENT_ARGS echo "VB.NET Test passed" | ./axssl.vbnet.exe $CLIENT_ARGS
kill %1 kill %1

View File

@ -88,7 +88,9 @@ int do_clnt_handshake(SSL *ssl, int handshake_type, uint8_t *buf, int hs_len)
if ((ret = send_certificate(ssl)) == SSL_OK && if ((ret = send_certificate(ssl)) == SSL_OK &&
(ret = send_client_key_xchg(ssl)) == SSL_OK) (ret = send_client_key_xchg(ssl)) == SSL_OK)
{ {
ret = send_cert_verify(ssl); ret = (ssl->chain_length == 0) ?
SSL_ERROR_INVALID_HANDSHAKE :
send_cert_verify(ssl);
} }
} }
else else

View File

@ -302,36 +302,38 @@ static int send_server_hello(SSL *ssl)
memcpy(ssl->server_random, &buf[6], SSL_RANDOM_SIZE); memcpy(ssl->server_random, &buf[6], SSL_RANDOM_SIZE);
offset = 6 + SSL_RANDOM_SIZE; offset = 6 + SSL_RANDOM_SIZE;
/* send a session id - and put it into the cache */
buf[offset++] = SSL_SESSION_ID_SIZE;
#ifndef CONFIG_SSL_SKELETON_MODE #ifndef CONFIG_SSL_SKELETON_MODE
if (IS_SET_SSL_FLAG(SSL_SESSION_RESUME)) if (IS_SET_SSL_FLAG(SSL_SESSION_RESUME))
{ {
/* retrieve id from session cache */ /* retrieve id from session cache */
buf[offset++] = SSL_SESSION_ID_SIZE;
memcpy(&buf[offset], ssl->session->session_id, SSL_SESSION_ID_SIZE); memcpy(&buf[offset], ssl->session->session_id, SSL_SESSION_ID_SIZE);
memcpy(ssl->session_id, ssl->session->session_id, SSL_SESSION_ID_SIZE); memcpy(ssl->session_id, ssl->session->session_id, SSL_SESSION_ID_SIZE);
ssl->sess_id_size = SSL_SESSION_ID_SIZE; ssl->sess_id_size = SSL_SESSION_ID_SIZE;
offset += SSL_SESSION_ID_SIZE;
} }
else /* generate our own session id */ else /* generate our own session id */
#endif #endif
{ {
#ifndef CONFIG_SSL_SKELETON_MODE
buf[offset++] = SSL_SESSION_ID_SIZE;
get_random(SSL_SESSION_ID_SIZE, &buf[offset]); get_random(SSL_SESSION_ID_SIZE, &buf[offset]);
memcpy(ssl->session_id, &buf[offset], SSL_SESSION_ID_SIZE); memcpy(ssl->session_id, &buf[offset], SSL_SESSION_ID_SIZE);
ssl->sess_id_size = SSL_SESSION_ID_SIZE; ssl->sess_id_size = SSL_SESSION_ID_SIZE;
#ifndef CONFIG_SSL_SKELETON_MODE
/* store id in session cache */ /* store id in session cache */
if (ssl->ssl_ctx->num_sessions) if (ssl->ssl_ctx->num_sessions)
{ {
memcpy(ssl->session->session_id, memcpy(ssl->session->session_id,
ssl->session_id, SSL_SESSION_ID_SIZE); ssl->session_id, SSL_SESSION_ID_SIZE);
} }
offset += SSL_SESSION_ID_SIZE;
#else
buf[offset++] = 0; /* don't bother with session id in skelton mode */
#endif #endif
} }
offset += SSL_SESSION_ID_SIZE;
buf[offset++] = 0; /* cipher we are using */ buf[offset++] = 0; /* cipher we are using */
buf[offset++] = ssl->cipher; buf[offset++] = ssl->cipher;
buf[offset++] = 0; /* no compression */ buf[offset++] = 0; /* no compression */