mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-13 13:01:55 +03:00
fixed some of the bindings for the new API changes
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@120 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
1
Makefile
1
Makefile
@ -85,6 +85,7 @@ ifdef CONFIG_PERL_BINDINGS
|
|||||||
install -m 755 $(STAGE)/axtlsp.pm `perl -e 'use Config; print $$Config{installarchlib};'`
|
install -m 755 $(STAGE)/axtlsp.pm `perl -e 'use Config; print $$Config{installarchlib};'`
|
||||||
endif
|
endif
|
||||||
@mkdir -p -m 755 $(PREFIX)/include/axTLS
|
@mkdir -p -m 755 $(PREFIX)/include/axTLS
|
||||||
|
install -m 644 crypto/*.h $(PREFIX)/include/axTLS
|
||||||
install -m 644 ssl/*.h $(PREFIX)/include/axTLS
|
install -m 644 ssl/*.h $(PREFIX)/include/axTLS
|
||||||
-rm $(PREFIX)/include/axTLS/cert.h
|
-rm $(PREFIX)/include/axTLS/cert.h
|
||||||
-rm $(PREFIX)/include/axTLS/private_key.h
|
-rm $(PREFIX)/include/axTLS/private_key.h
|
||||||
|
@ -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((unsigned char *)\$1, (int)ssl_get_session_id((SSL const *)arg1));
|
SV *svs = newSVpv((unsigned char *)\$1, ssl_get_session_id_size((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_get_session_id((SSL const *)\$1); i++){
|
for (i = 0; i < ssl_get_session_id_size((SSL const *)arg1); 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 */
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ all: lib
|
|||||||
ifdef CONFIG_PLATFORM_WIN32
|
ifdef CONFIG_PLATFORM_WIN32
|
||||||
TARGET=$(AXTLS_HOME)/$(STAGE)/axtlsl.dll
|
TARGET=$(AXTLS_HOME)/$(STAGE)/axtlsl.dll
|
||||||
else
|
else
|
||||||
TARGET=$(AXTLS_HOME)/$(STAGE)/axtlsl.so
|
TARGET=$(CONFIG_LUA_CORE)/lib/lua/5.1/axtlsl.so
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS), clean)
|
ifneq ($(MAKECMDGOALS), clean)
|
||||||
|
@ -857,11 +857,15 @@ static void display_session_id(SSL *ssl)
|
|||||||
const uint8_t *session_id = ssl_get_session_id(ssl);
|
const uint8_t *session_id = ssl_get_session_id(ssl);
|
||||||
int sess_id_size = ssl_get_session_id_size(ssl);
|
int sess_id_size = ssl_get_session_id_size(ssl);
|
||||||
|
|
||||||
|
if (sess_id_size > 0)
|
||||||
|
{
|
||||||
printf("-----BEGIN SSL SESSION PARAMETERS-----\n");
|
printf("-----BEGIN SSL SESSION PARAMETERS-----\n");
|
||||||
for (i = 0; i < sess_id_size; i++)
|
for (i = 0; i < sess_id_size; i++)
|
||||||
{
|
{
|
||||||
printf("%02x", session_id[i]);
|
printf("%02x", session_id[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n-----END SSL SESSION PARAMETERS-----\n");
|
printf("\n-----END SSL SESSION PARAMETERS-----\n");
|
||||||
TTY_FLUSH();
|
TTY_FLUSH();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -732,6 +732,8 @@ public class axssl
|
|||||||
{
|
{
|
||||||
byte[] session_id = ssl.GetSessionId();
|
byte[] session_id = ssl.GetSessionId();
|
||||||
|
|
||||||
|
if (session_id.Length > 0)
|
||||||
|
{
|
||||||
Console.WriteLine("-----BEGIN SSL SESSION PARAMETERS-----");
|
Console.WriteLine("-----BEGIN SSL SESSION PARAMETERS-----");
|
||||||
foreach (byte b in session_id)
|
foreach (byte b in session_id)
|
||||||
{
|
{
|
||||||
@ -741,3 +743,4 @@ public class axssl
|
|||||||
Console.WriteLine("\n-----END SSL SESSION PARAMETERS-----");
|
Console.WriteLine("\n-----END SSL SESSION PARAMETERS-----");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -737,10 +737,12 @@ public class axssl
|
|||||||
private void display_session_id(SSL ssl)
|
private void display_session_id(SSL ssl)
|
||||||
{
|
{
|
||||||
byte[] session_id = ssl.getSessionId();
|
byte[] session_id = ssl.getSessionId();
|
||||||
int i;
|
|
||||||
|
|
||||||
|
if (session_id.length > 0)
|
||||||
|
{
|
||||||
System.out.println("-----BEGIN SSL SESSION PARAMETERS-----");
|
System.out.println("-----BEGIN SSL SESSION PARAMETERS-----");
|
||||||
bytesToHex(session_id);
|
bytesToHex(session_id);
|
||||||
System.out.println("-----END SSL SESSION PARAMETERS-----");
|
System.out.println("-----END SSL SESSION PARAMETERS-----");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -527,12 +527,14 @@ function display_session_id(ssl)
|
|||||||
local session_id = axtlsl.ssl_get_session_id(ssl)
|
local session_id = axtlsl.ssl_get_session_id(ssl)
|
||||||
local v
|
local v
|
||||||
|
|
||||||
|
if #session_id > 0 then
|
||||||
print("-----BEGIN SSL SESSION PARAMETERS-----")
|
print("-----BEGIN SSL SESSION PARAMETERS-----")
|
||||||
for _, v in ipairs(session_id) do
|
for _, v in ipairs(session_id) do
|
||||||
io.write(string.format("%02x", v))
|
io.write(string.format("%02x", v))
|
||||||
end
|
end
|
||||||
print("\n-----END SSL SESSION PARAMETERS-----")
|
print("\n-----END SSL SESSION PARAMETERS-----")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Main entry point. Doesn't do much except works out whether we are a client
|
-- Main entry point. Doesn't do much except works out whether we are a client
|
||||||
|
@ -235,7 +235,7 @@ sub do_server
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
($res, $buf) = axtlsp::ssl_read($ssl, undef);
|
($res, $buf) = axtlsp::ssl_read($ssl, undef);
|
||||||
last if $res != $axtlsp::SSL_OK;
|
last if $res < $axtlsp::SSL_OK;
|
||||||
|
|
||||||
if ($res == $axtlsp::SSL_OK) # connection established and ok
|
if ($res == $axtlsp::SSL_OK) # connection established and ok
|
||||||
{
|
{
|
||||||
@ -255,7 +255,7 @@ sub do_server
|
|||||||
{
|
{
|
||||||
printf($$buf);
|
printf($$buf);
|
||||||
}
|
}
|
||||||
else if ($res < $axtlsp::SSL_OK)
|
elsif ($res < $axtlsp::SSL_OK)
|
||||||
{
|
{
|
||||||
axtlsp::ssl_display_error($res) if not $quiet;
|
axtlsp::ssl_display_error($res) if not $quiet;
|
||||||
last;
|
last;
|
||||||
@ -613,8 +613,10 @@ sub display_session_id
|
|||||||
{
|
{
|
||||||
my ($ssl) = @_;
|
my ($ssl) = @_;
|
||||||
my $session_id = axtlsp::ssl_get_session_id($ssl);
|
my $session_id = axtlsp::ssl_get_session_id($ssl);
|
||||||
|
if (length($$session_id) > 0)
|
||||||
|
{
|
||||||
printf("-----BEGIN SSL SESSION PARAMETERS-----\n");
|
printf("-----BEGIN SSL SESSION PARAMETERS-----\n");
|
||||||
printf(unpack("H*", $$session_id));
|
printf(unpack("H*", $$session_id));
|
||||||
printf("\n-----END SSL SESSION PARAMETERS-----\n");
|
printf("\n-----END SSL SESSION PARAMETERS-----\n");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -538,6 +538,7 @@ Public Class axssl
|
|||||||
Private Sub display_session_id(ByVal ssl As SSL)
|
Private Sub display_session_id(ByVal ssl As SSL)
|
||||||
Dim session_id As Byte() = ssl.GetSessionId()
|
Dim session_id As Byte() = ssl.GetSessionId()
|
||||||
|
|
||||||
|
If session_id.Length > 0 Then
|
||||||
Console.WriteLine("-----BEGIN SSL SESSION PARAMETERS-----")
|
Console.WriteLine("-----BEGIN SSL SESSION PARAMETERS-----")
|
||||||
Dim b As Byte
|
Dim b As Byte
|
||||||
For Each b In session_id
|
For Each b In session_id
|
||||||
@ -546,6 +547,7 @@ Public Class axssl
|
|||||||
|
|
||||||
Console.WriteLine()
|
Console.WriteLine()
|
||||||
Console.WriteLine("-----END SSL SESSION PARAMETERS-----")
|
Console.WriteLine("-----END SSL SESSION PARAMETERS-----")
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
'
|
'
|
||||||
|
@ -1504,7 +1504,6 @@ int send_certificate(SSL *ssl)
|
|||||||
buf[0] = HS_CERTIFICATE;
|
buf[0] = HS_CERTIFICATE;
|
||||||
buf[1] = 0;
|
buf[1] = 0;
|
||||||
buf[4] = 0;
|
buf[4] = 0;
|
||||||
buf[7] = 0;
|
|
||||||
|
|
||||||
while (i < ssl->chain_length)
|
while (i < ssl->chain_length)
|
||||||
{
|
{
|
||||||
|
@ -88,8 +88,6 @@ 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 = (ssl->chain_length == 0) ?
|
|
||||||
SSL_ERROR_INVALID_HANDSHAKE :
|
|
||||||
send_cert_verify(ssl);
|
send_cert_verify(ssl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user