1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

added versioning/fragmentation

git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@56 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
cameronrich
2007-02-01 08:31:32 +00:00
parent bb61a8921c
commit f616c74150
40 changed files with 611 additions and 545 deletions

View File

@ -63,11 +63,15 @@ int main(int argc, char *argv[])
signal(SIGPIPE, SIG_IGN); /* ignore pipe errors */
#endif
if (argc == 2 && strcmp(argv[1], "version") == 0)
{
printf("axssl %s\n", ssl_version());
exit(0);
}
if (argc < 2 || (
strcmp(argv[1], "s_server") && strcmp(argv[1], "s_client")))
{
print_options(argc > 1 ? argv[1] : "");
}
strcmp(argv[1], "s_server") ?
do_client(argc, argv) : do_server(argc, argv);
@ -733,7 +737,7 @@ static void do_client(int argc, char *argv[])
static void print_options(char *option)
{
printf("axssl: Error: '%s' is an invalid command.\n", option);
printf("usage: axssl [s_server|s_client] [args ...]\n");
printf("usage: axssl [s_server|s_client|version] [args ...]\n");
exit(1);
}

View File

@ -39,28 +39,28 @@ using axTLS;
public class axssl
{
/*
/*
* Main()
*/
public static void Main(string[] args)
{
if (args.Length == 1 && args[0] == "version")
{
Console.WriteLine("axssl.csharp " + SSLUtil.Version());
Environment.Exit(0);
}
axssl runner = new axssl();
if (args.Length < 1 || (args[0] != "s_server" && args[0] != "s_client"))
{
runner.print_options(args.Length > 0 ? args[0] : "");
}
int build_mode = SSLUtil.BuildMode();
if (args[0] == "s_server")
{
runner.do_server(build_mode, args);
}
else
{
runner.do_client(build_mode, args);
}
}
/*
@ -603,7 +603,8 @@ public class axssl
{
Console.WriteLine("axssl: Error: '" + option +
"' is an invalid command.");
Console.WriteLine("usage: axssl.cs.exe [s_server|s_client] [args ...]");
Console.WriteLine("usage: axssl.csharp [s_server|" +
"s_client|version] [args ...]");
Environment.Exit(1);
}

View File

@ -43,6 +43,12 @@ public class axssl
*/
public static void main(String[] args)
{
if (args.length == 1 && args[0].equals("version"))
{
System.out.println("axtls.jar " + SSLUtil.version());
System.exit(0);
}
axssl runner = new axssl();
try
@ -57,13 +63,9 @@ public class axssl
int build_mode = SSLUtil.buildMode();
if (args[0].equals("s_server"))
{
runner.do_server(build_mode, args);
}
else
{
runner.do_client(build_mode, args);
}
}
catch (Exception e)
{
@ -193,9 +195,7 @@ public class axssl
axtlsj.SSL_DEFAULT_SVR_SESS);
if (ssl_ctx == null)
{
throw new Exception("Error: Server context is invalid");
}
if (private_key_file != null)
{
@ -316,9 +316,7 @@ public class axssl
throws Exception
{
if (build_mode < axtlsj.SSL_BUILD_ENABLE_CLIENT)
{
print_client_options(build_mode, args[1]);
}
int i = 1, res;
int port = 4433;
@ -599,7 +597,7 @@ public class axssl
{
System.out.println("axssl: Error: '" + option +
"' is an invalid command.");
System.out.println("usage: axtlsj.jar [s_server|s_client] " +
System.out.println("usage: axtlsj.jar [s_server|s_client|version] " +
"[args ...]");
System.exit(1);
}
@ -701,25 +699,15 @@ public class axssl
byte ciph_id = ssl.getCipherId();
if (ciph_id == axtlsj.SSL_AES128_SHA)
{
System.out.println("AES128-SHA");
}
else if (ciph_id == axtlsj.SSL_AES256_SHA)
{
System.out.println("AES256-SHA");
}
else if (ciph_id == axtlsj.SSL_RC4_128_SHA)
{
System.out.println("RC4-SHA");
}
else if (ciph_id == axtlsj.SSL_RC4_128_MD5)
{
System.out.println("RC4-MD5");
}
else
{
System.out.println("Unknown - " + ssl.getCipherId());
}
}
public char toHexChar(int i)

View File

@ -62,6 +62,12 @@ sub get_native_sock
# Main entry point. Doesn't do much except works out whether we are a client
# or a server.
#
if ($#ARGV == 0 && $ARGV[0] eq "version")
{
printf("axssl.pl ".axtlsp::ssl_version()."\n");
exit 0;
}
print_options($#ARGV > -1 ? $ARGV[0] : "")
if ($#ARGV < 0 || ($ARGV[0] ne "s_server" && $ARGV[0] ne "s_client"));
@ -87,7 +93,7 @@ sub do_server
my $private_key_file = undef;
my $cert_size = axtlsp::ssl_get_config($axtlsp::SSL_MAX_CERT_CFG_OFFSET);
my $ca_cert_size = axtlsp::ssl_get_config(
$axtlsp::SSL_MAX_CA_CERT_CFG_OFFSET);
$axtlsp::SSL_MAX_CA_CERT_CFG_OFFSET);
my @cert;
my @ca_cert;

View File

@ -98,7 +98,8 @@ Public Class axssl
If args(i) = "-verify" Then
options = options Or axtls.SSL_CLIENT_AUTHENTICATION
ElseIf args(i) = "-CAfile"
If i >= args.Length-1 Or ca_cert_index >= ca_cert_size Then
If i >= args.Length-1 Or _
ca_cert_index >= ca_cert_size Then
print_server_options(build_mode, args(i))
End If
@ -553,7 +554,8 @@ Public Class axssl
Public Sub print_options(ByVal options As String)
Console.WriteLine("axssl: Error: '" & options & _
"' is an invalid command.")
Console.WriteLine("usage: axssl.vb.exe [s_server|s_client] [args ...]")
Console.WriteLine("usage: axssl.vbnet [s_server|s_client|" & _
"version] [args ...]")
Environment.Exit(1)
End Sub
@ -663,6 +665,11 @@ Public Module MyMain
Function Main(ByVal args() As String) As Integer
Dim runner As axssl = New axssl()
If args.Length = 1 And args(0) = "version" Then
Console.WriteLine("axssl.vbnet " & SSLUtil.Version())
Environment.Exit(0)
End If
If args.Length < 1
runner.print_options("")
ElseIf args(0) <> "s_server" And args(0) <> "s_client"