summaryrefslogtreecommitdiff
path: root/extra/yassl
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2006-09-27 14:36:12 +0200
committermsvensson@neptunus.(none) <>2006-09-27 14:36:12 +0200
commite4676ef60a6a8e1d8130d6131a6aad9ce11d6769 (patch)
treebc28e105c32f8bda36e5c2a0aca8d193afc62831 /extra/yassl
parent64a64d0fbf29443cd0229bba0d7b2dfdf9624306 (diff)
downloadmariadb-git-e4676ef60a6a8e1d8130d6131a6aad9ce11d6769.tar.gz
Import yaSSL version 1.4.3
Diffstat (limited to 'extra/yassl')
-rw-r--r--extra/yassl/examples/echoserver/echoserver.cpp41
-rw-r--r--extra/yassl/examples/server/server.cpp27
-rw-r--r--extra/yassl/include/openssl/ssl.h2
-rw-r--r--extra/yassl/src/template_instnt.cpp1
-rw-r--r--extra/yassl/taocrypt/src/crypto.cpp39
-rw-r--r--extra/yassl/taocrypt/src/misc.cpp1
-rw-r--r--extra/yassl/testsuite/test.hpp2
7 files changed, 72 insertions, 41 deletions
diff --git a/extra/yassl/examples/echoserver/echoserver.cpp b/extra/yassl/examples/echoserver/echoserver.cpp
index de39d79d7ed..cd31fedddd8 100644
--- a/extra/yassl/examples/echoserver/echoserver.cpp
+++ b/extra/yassl/examples/echoserver/echoserver.cpp
@@ -23,6 +23,18 @@
#endif // NO_MAIN_DRIVER
+
+void EchoError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& s1, SOCKET_T& s2,
+ const char* msg)
+{
+ SSL_CTX_free(ctx);
+ SSL_free(ssl);
+ tcp_close(s1);
+ tcp_close(s2);
+ err_sys(msg);
+}
+
+
THREAD_RETURN YASSL_API echoserver_test(void* args)
{
#ifdef _WIN32
@@ -65,10 +77,9 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
while (!shutdown) {
sockaddr_in client;
socklen_t client_len = sizeof(client);
- int clientfd = accept(sockfd, (sockaddr*)&client,
+ SOCKET_T clientfd = accept(sockfd, (sockaddr*)&client,
(ACCEPT_THIRD_T)&client_len);
- if (clientfd == -1)
- {
+ if (clientfd == -1) {
SSL_CTX_free(ctx);
tcp_close(sockfd);
err_sys("tcp accept failed");
@@ -77,13 +88,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
SSL* ssl = SSL_new(ctx);
SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- tcp_close(clientfd);
- err_sys("SSL_accept failed");
- }
+ EchoError(ctx, ssl, sockfd, clientfd, "SSL_accept failed");
char command[1024];
int echoSz(0);
@@ -112,13 +117,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
echoSz += sizeof(footer);
if (SSL_write(ssl, command, echoSz) != echoSz)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- tcp_close(clientfd);
- err_sys("SSL_write failed");
- }
+ EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
break;
}
@@ -129,13 +128,7 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
#endif
if (SSL_write(ssl, command, echoSz) != echoSz)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- tcp_close(clientfd);
- err_sys("SSL_write failed");
- }
+ EchoError(ctx, ssl, sockfd, clientfd, "SSL_write failed");
}
SSL_free(ssl);
tcp_close(clientfd);
diff --git a/extra/yassl/examples/server/server.cpp b/extra/yassl/examples/server/server.cpp
index 43028e13382..d0bf70cd634 100644
--- a/extra/yassl/examples/server/server.cpp
+++ b/extra/yassl/examples/server/server.cpp
@@ -4,6 +4,15 @@
#include "../../testsuite/test.hpp"
+void ServerError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
+{
+ SSL_CTX_free(ctx);
+ SSL_free(ssl);
+ tcp_close(sockfd);
+ err_sys(msg);
+}
+
+
THREAD_RETURN YASSL_API server_test(void* args)
{
#ifdef _WIN32
@@ -12,7 +21,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
#endif
SOCKET_T sockfd = 0;
- int clientfd = 0;
+ SOCKET_T clientfd = 0;
int argc = 0;
char** argv = 0;
@@ -33,13 +42,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
SSL_set_fd(ssl, clientfd);
if (SSL_accept(ssl) != SSL_SUCCESS)
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- tcp_close(clientfd);
- err_sys("SSL_accept failed");
- }
+ ServerError(ctx, ssl, clientfd, "SSL_accept failed");
showPeer(ssl);
printf("Using Cipher Suite: %s\n", SSL_get_cipher(ssl));
@@ -50,13 +53,7 @@ THREAD_RETURN YASSL_API server_test(void* args)
char msg[] = "I hear you, fa shizzle!";
if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
- {
- SSL_CTX_free(ctx);
- SSL_free(ssl);
- tcp_close(sockfd);
- tcp_close(clientfd);
- err_sys("SSL_write failed");
- }
+ ServerError(ctx, ssl, clientfd, "SSL_write failed");
DH_free(dh);
SSL_CTX_free(ctx);
diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h
index f328a0049b7..5e7290d2a7a 100644
--- a/extra/yassl/include/openssl/ssl.h
+++ b/extra/yassl/include/openssl/ssl.h
@@ -41,7 +41,7 @@
#include "rsa.h"
-#define YASSL_VERSION "1.4.2"
+#define YASSL_VERSION "1.4.3"
#if defined(__cplusplus)
diff --git a/extra/yassl/src/template_instnt.cpp b/extra/yassl/src/template_instnt.cpp
index 0a3c4c64392..fb488e47672 100644
--- a/extra/yassl/src/template_instnt.cpp
+++ b/extra/yassl/src/template_instnt.cpp
@@ -109,6 +109,7 @@ template void ysArrayDelete<char>(char*);
template int min<int>(int, int);
template unsigned int min<unsigned int>(unsigned int, unsigned int);
+template unsigned long min<unsigned long>(unsigned long, unsigned long);
}
#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
diff --git a/extra/yassl/taocrypt/src/crypto.cpp b/extra/yassl/taocrypt/src/crypto.cpp
new file mode 100644
index 00000000000..95238100f5d
--- /dev/null
+++ b/extra/yassl/taocrypt/src/crypto.cpp
@@ -0,0 +1,39 @@
+/* crypto.cpp
+ *
+ * Copyright (C) 2003 Sawtooth Consulting Ltd.
+ *
+ * This file is part of yaSSL.
+ *
+ * yaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * There are special exceptions to the terms and conditions of the GPL as it
+ * is applied to yaSSL. View the full text of the exception in the file
+ * FLOSS-EXCEPTIONS in the directory of this software distribution.
+ *
+ * yaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+/* put features that other apps expect from OpenSSL type crypto */
+
+
+
+extern "C" {
+
+ // for libcurl configure test, these are the signatures they use
+ // locking handled internally by library
+ char CRYPTO_lock() { return 0;}
+ char CRYPTO_add_lock() { return 0;}
+} // extern "C"
+
+
+
diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp
index c66377b917d..084a263a4ae 100644
--- a/extra/yassl/taocrypt/src/misc.cpp
+++ b/extra/yassl/taocrypt/src/misc.cpp
@@ -29,6 +29,7 @@
#include "runtime.hpp"
#include "misc.hpp"
+
#ifdef YASSL_PURE_C
void* operator new(size_t sz, TaoCrypt::new_t)
diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp
index 1279bc7f9d4..0266c802657 100644
--- a/extra/yassl/testsuite/test.hpp
+++ b/extra/yassl/testsuite/test.hpp
@@ -312,7 +312,7 @@ inline void tcp_listen(SOCKET_T& sockfd)
}
-inline void tcp_accept(SOCKET_T& sockfd, int& clientfd, func_args& args)
+inline void tcp_accept(SOCKET_T& sockfd, SOCKET_T& clientfd, func_args& args)
{
tcp_listen(sockfd);