diff options
Diffstat (limited to 'extra/yassl/include')
-rw-r--r-- | extra/yassl/include/buffer.hpp | 10 | ||||
-rw-r--r-- | extra/yassl/include/cert_wrapper.hpp | 5 | ||||
-rw-r--r-- | extra/yassl/include/openssl/ssl.h | 56 | ||||
-rw-r--r-- | extra/yassl/include/socket_wrapper.hpp | 4 | ||||
-rw-r--r-- | extra/yassl/include/yassl_error.hpp | 5 | ||||
-rw-r--r-- | extra/yassl/include/yassl_imp.hpp | 5 | ||||
-rw-r--r-- | extra/yassl/include/yassl_int.hpp | 73 | ||||
-rw-r--r-- | extra/yassl/include/yassl_types.hpp | 35 |
8 files changed, 101 insertions, 92 deletions
diff --git a/extra/yassl/include/buffer.hpp b/extra/yassl/include/buffer.hpp index a51bca9a630..2d7817a7ca2 100644 --- a/extra/yassl/include/buffer.hpp +++ b/extra/yassl/include/buffer.hpp @@ -46,12 +46,6 @@ typedef unsigned int uint; const uint AUTO = 0xFEEDBEEF; -// Checking Policy should implement a check function that tests whether the -// index is within the size limit of the array -struct Check { - void check(uint i, uint limit); -}; - struct NoCheck { void check(uint, uint); @@ -66,7 +60,7 @@ struct NoCheck { * write to the buffer bulk wise and have the correct size */ -class input_buffer : public Check { +class input_buffer : public NoCheck { uint size_; // number of elements in buffer uint current_; // current offset position in buffer byte* buffer_; // storage for buffer @@ -132,7 +126,7 @@ private: * Not using vector because need checked []access and the ability to * write to the buffer bulk wise and retain correct size */ -class output_buffer : public Check { +class output_buffer : public NoCheck { uint current_; // current offset and elements in buffer byte* buffer_; // storage for buffer byte* end_; // end of storage marker diff --git a/extra/yassl/include/cert_wrapper.hpp b/extra/yassl/include/cert_wrapper.hpp index 755a3925c8e..d07e5b627b0 100644 --- a/extra/yassl/include/cert_wrapper.hpp +++ b/extra/yassl/include/cert_wrapper.hpp @@ -12,8 +12,9 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 9ffd4c0328e..0d99888da88 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc. + Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -12,8 +12,9 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ /* ssl.h defines openssl compatibility layer @@ -29,12 +30,12 @@ #include "prefix_ssl.h" #endif -#include <stdio.h> /* ERR_print fp */ +#include <stdio.h> /* ERR_print fp */ #include "opensslv.h" /* for version number */ #include "rsa.h" -#define YASSL_VERSION "1.7.2" +#define YASSL_VERSION "2.2.0" #if defined(__cplusplus) @@ -42,9 +43,9 @@ extern "C" { #endif void yaSSL_CleanUp(); /* call once at end of application use to - free static singleton memory holders, - not a leak per se, but helpful when - looking for them */ + free static singleton memory holders, + not a leak per se, but helpful when + looking for them */ #if defined(__cplusplus) } // extern @@ -69,11 +70,11 @@ extern "C" { class X509; class X509_NAME; #else - typedef struct SSL SSL; + typedef struct SSL SSL; typedef struct SSL_SESSION SSL_SESSION; - typedef struct SSL_METHOD SSL_METHOD; - typedef struct SSL_CTX SSL_CTX; - typedef struct SSL_CIPHER SSL_CIPHER; + typedef struct SSL_METHOD SSL_METHOD; + typedef struct SSL_CTX SSL_CTX; + typedef struct SSL_CIPHER SSL_CIPHER; typedef struct RSA RSA; @@ -106,6 +107,15 @@ RSA* RSA_generate_key(int, unsigned long, void(*)(int, int, void*), void*); /* X509 stuff, different file? */ +/* because mySQL dereferences to use error and current_cert, even after calling + * get functions for local references */ +typedef struct X509_STORE_CTX { + int error; + int error_depth; + X509* current_cert; +} X509_STORE_CTX; + + typedef struct X509_STORE X509_STORE; typedef struct X509_LOOKUP X509_LOOKUP; typedef struct X509_OBJECT { char c; } X509_OBJECT; @@ -124,16 +134,6 @@ typedef struct BIO BIO; -/* because mySQL dereferences to use error and current_cert, even after calling - * get functions for local references */ -typedef struct X509_STORE_CTX { - int error; - int error_depth; - X509* current_cert; -} X509_STORE_CTX; - - - X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX*); int X509_STORE_CTX_get_error(X509_STORE_CTX*); int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*); @@ -204,7 +204,7 @@ SSL* SSL_new(SSL_CTX*); int SSL_set_fd (SSL*, YASSL_SOCKET_T); YASSL_SOCKET_T SSL_get_fd(const SSL*); int SSL_connect(SSL*); /* if you get an error from connect - see note at top of REAMDE */ + see note at top of README */ int SSL_write(SSL*, const void*, int); int SSL_read(SSL*, void*, int); int SSL_accept(SSL*); @@ -350,11 +350,11 @@ enum { /* ssl Constants */ SSL_ERROR_ZERO_RETURN = 84, SSL_ERROR_SSL = 85, - SSL_SENT_SHUTDOWN = 90, - SSL_RECEIVED_SHUTDOWN = 91, + SSL_ST_CONNECT = 90, + SSL_ST_ACCEPT = 91, SSL_CB_LOOP = 92, - SSL_ST_CONNECT = 93, - SSL_ST_ACCEPT = 94, + SSL_SENT_SHUTDOWN = 93, + SSL_RECEIVED_SHUTDOWN = 94, SSL_CB_ALERT = 95, SSL_CB_READ = 96, SSL_CB_HANDSHAKE_DONE = 97 @@ -365,7 +365,7 @@ enum { /* ssl Constants */ SSL_METHOD *SSLv3_method(void); SSL_METHOD *SSLv3_server_method(void); SSL_METHOD *SSLv3_client_method(void); -SSL_METHOD *TLSv1_server_method(void); +SSL_METHOD *TLSv1_server_method(void); SSL_METHOD *TLSv1_client_method(void); SSL_METHOD *TLSv1_1_server_method(void); SSL_METHOD *TLSv1_1_client_method(void); diff --git a/extra/yassl/include/socket_wrapper.hpp b/extra/yassl/include/socket_wrapper.hpp index 308704c2af0..2372e64e56c 100644 --- a/extra/yassl/include/socket_wrapper.hpp +++ b/extra/yassl/include/socket_wrapper.hpp @@ -26,7 +26,6 @@ #ifndef yaSSL_SOCKET_WRAPPER_HPP #define yaSSL_SOCKET_WRAPPER_HPP -#include <assert.h> #ifdef _WIN32 #include <winsock2.h> @@ -73,7 +72,8 @@ public: uint get_ready() const; socket_t get_fd() const; - uint send(const byte* buf, unsigned int len, int flags = 0) const; + uint send(const byte* buf, unsigned int len, unsigned int& sent, + int flags = 0); uint receive(byte* buf, unsigned int len, int flags = 0); bool wait(); diff --git a/extra/yassl/include/yassl_error.hpp b/extra/yassl/include/yassl_error.hpp index d9bbbc2dc69..87bb4c55e96 100644 --- a/extra/yassl/include/yassl_error.hpp +++ b/extra/yassl/include/yassl_error.hpp @@ -12,8 +12,9 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ diff --git a/extra/yassl/include/yassl_imp.hpp b/extra/yassl/include/yassl_imp.hpp index ee29d89332a..04e85c16a04 100644 --- a/extra/yassl/include/yassl_imp.hpp +++ b/extra/yassl/include/yassl_imp.hpp @@ -12,8 +12,9 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ /* yaSSL implementation header defines all strucutres from the SSL.v3 diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index adb9f5ea67a..686e958d7e1 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -1,6 +1,5 @@ /* - Copyright (c) 2005-2007 MySQL AB, 2008, 2009 Sun Microsystems, Inc. - Use is subject to license terms. + Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,8 +11,9 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ @@ -34,9 +34,8 @@ #include "openssl/ssl.h" // ASN1_STRING and DH // Check if _POSIX_THREADS should be forced -#if !defined(_POSIX_THREADS) && (defined(__NETWARE__) || defined(__hpux)) +#if !defined(_POSIX_THREADS) && defined(__hpux) // HPUX does not define _POSIX_THREADS as it's not _fully_ implemented -// Netware supports pthreads but does not announce it #define _POSIX_THREADS #endif @@ -169,7 +168,7 @@ private: // openSSL X509 names class X509_NAME { - char* name_; + char* name_; size_t sz_; ASN1_STRING entry_; public: @@ -247,11 +246,11 @@ public: SSL_SESSION(const SSL&, RandomPool&); ~SSL_SESSION(); - const opaque* GetID() const; - const opaque* GetSecret() const; - const Cipher* GetSuite() const; - uint GetBornOn() const; - uint GetTimeOut() const; + const opaque* GetID() const; + const opaque* GetSecret() const; + const Cipher* GetSuite() const; + uint GetBornOn() const; + uint GetTimeOut() const; X509* GetPeerX509() const; void SetTimeOut(uint); @@ -418,33 +417,33 @@ class SSL_CTX { public: typedef STL::list<x509*> CertList; private: - SSL_METHOD* method_; - x509* certificate_; - x509* privateKey_; - CertList caList_; - Ciphers ciphers_; - DH_Parms dhParms_; + SSL_METHOD* method_; + x509* certificate_; + x509* privateKey_; + CertList caList_; + Ciphers ciphers_; + DH_Parms dhParms_; pem_password_cb passwordCb_; void* userData_; bool sessionCacheOff_; bool sessionCacheFlushOff_; - Stats stats_; - Mutex mutex_; // for Stats + Stats stats_; + Mutex mutex_; // for Stats VerifyCallback verifyCallback_; public: explicit SSL_CTX(SSL_METHOD* meth); ~SSL_CTX(); - const x509* getCert() const; - const x509* getKey() const; - const SSL_METHOD* getMethod() const; - const Ciphers& GetCiphers() const; - const DH_Parms& GetDH_Parms() const; - const Stats& GetStats() const; - VerifyCallback getVerifyCallback() const; + const x509* getCert() const; + const x509* getKey() const; + const SSL_METHOD* getMethod() const; + const Ciphers& GetCiphers() const; + const DH_Parms& GetDH_Parms() const; + const Stats& GetStats() const; + const VerifyCallback getVerifyCallback() const; pem_password_cb GetPasswordCb() const; void* GetUserData() const; - bool GetSessionCacheOff() const; + bool GetSessionCacheOff() const; bool GetSessionCacheFlushOff() const; void setVerifyPeer(); @@ -533,10 +532,13 @@ class Buffers { public: typedef STL::list<input_buffer*> inputList; typedef STL::list<output_buffer*> outputList; + int prevSent; // previous plain text bytes sent when got WANT_WRITE + int plainSz; // plain text bytes in buffer to send when got WANT_WRITE private: - inputList dataList_; // list of users app data / handshake - outputList handShakeList_; // buffered handshake msgs - input_buffer* rawInput_; // buffered raw input yet to process + inputList dataList_; // list of users app data / handshake + outputList handShakeList_; // buffered handshake msgs + input_buffer* rawInput_; // buffered raw input yet to process + output_buffer* output_; // WANT_WRITE buffered output public: Buffers(); ~Buffers(); @@ -547,11 +549,13 @@ public: inputList& useData(); outputList& useHandShake(); - void SetRawInput(input_buffer*); // takes ownership - input_buffer* TakeRawInput(); // takes ownership + void SetRawInput(input_buffer*); // takes ownership + input_buffer* TakeRawInput(); // takes ownership + void SetOutput(output_buffer*); // takes ownership + output_buffer* TakeOutput(); // takes ownership private: Buffers(const Buffers&); // hide copy - Buffers& operator=(const Buffers&); // and assign + Buffers& operator=(const Buffers&); // and assign }; @@ -653,6 +657,7 @@ public: void deriveKeys(); void deriveTLSKeys(); void Send(const byte*, uint); + void SendWriteBuffered(); uint bufferedData(); uint get_SEQIncrement(bool); diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp index e898befda3a..a9e22833eb1 100644 --- a/extra/yassl/include/yassl_types.hpp +++ b/extra/yassl/include/yassl_types.hpp @@ -12,8 +12,9 @@ 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ /* yaSSL types header defines all constants, enums, and typedefs @@ -25,7 +26,6 @@ #define yaSSL_TYPES_HPP #include <stddef.h> -#include <assert.h> #include "type_traits.hpp" @@ -36,6 +36,13 @@ #endif +#ifdef _MSC_VER + // disable conversion warning + // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy + #pragma warning(disable:4244 4996) +#endif + + namespace yaSSL { #define YASSL_LIB @@ -62,29 +69,29 @@ namespace yaSSL { template<typename T> void ysDelete(T* ptr) { - if (ptr) ptr->~T(); - ::operator delete(ptr, yaSSL::ys); + if (ptr) ptr->~T(); + ::operator delete(ptr, yaSSL::ys); } template<typename T> void ysArrayDelete(T* ptr) { - // can't do array placement destruction since not tracking size in - // allocation, only allow builtins to use array placement since they - // don't need destructors called - typedef char builtin[TaoCrypt::IsFundamentalType<T>::Yes ? 1 : -1]; - (void)sizeof(builtin); + // can't do array placement destruction since not tracking size in + // allocation, only allow builtins to use array placement since they + // don't need destructors called + typedef char builtin[TaoCrypt::IsFundamentalType<T>::Yes ? 1 : -1]; + (void)sizeof(builtin); - ::operator delete[](ptr, yaSSL::ys); + ::operator delete[](ptr, yaSSL::ys); } #define NEW_YS new (yaSSL::ys) // to resolve compiler generated operator delete on base classes with - // virtual destructors (when on stack), make sure doesn't get called + // virtual destructors (when on stack) class virtual_base { public: - static void operator delete(void*) { assert(0); } + static void operator delete(void*) { } }; @@ -123,7 +130,7 @@ typedef opaque byte; typedef unsigned int uint; - + #ifdef USE_SYS_STL // use system STL #define STL_VECTOR_FILE <vector> |