diff options
Diffstat (limited to 'extra/yassl')
23 files changed, 291 insertions, 379 deletions
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index cf64f2d9dc8..41408b01281 100644 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -20,25 +20,13 @@ INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) ADD_DEFINITIONS(${SSL_DEFINES}) -IF(CMAKE_COMPILER_IS_GNUXX) - #Remove -fno-implicit-templates - #(yassl sources cannot be compiled with it) - STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS -${CMAKE_CXX_FLAGS}) -ENDIF() +#Remove -fno-implicit-templates +#(yassl sources cannot be compiled with it) +STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp src/handshake.cpp src/lock.cpp src/log.cpp src/socket_wrapper.cpp src/ssl.cpp src/timer.cpp src/yassl_error.cpp src/yassl_imp.cpp src/yassl_int.cpp) -IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) - SET(YASSL_SOURCES ${YASSL_SOURCES} src/template_instnt.cpp) -ENDIF() - ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES}) RESTRICT_SYMBOL_EXPORTS(yassl) -IF(MSVC) - INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - - diff --git a/extra/yassl/include/cert_wrapper.hpp b/extra/yassl/include/cert_wrapper.hpp index a3a52828cc6..d32870fcfc1 100644 --- a/extra/yassl/include/cert_wrapper.hpp +++ b/extra/yassl/include/cert_wrapper.hpp @@ -78,6 +78,7 @@ class CertManager { CertList peerList_; // peer input_buffer peerPublicKey_; X509* peerX509_; // peer's openSSL X509 + X509* selfX509_; // our own openSSL X509 SignatureAlgorithm keyType_; // self key type SignatureAlgorithm peerKeyType_; // peer's key type @@ -105,6 +106,7 @@ public: const opaque* get_peerKey() const; const opaque* get_privateKey() const; X509* get_peerX509() const; + X509* get_selfX509() const; SignatureAlgorithm get_keyType() const; SignatureAlgorithm get_peerKeyType() const; diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h index 0f2f2dcded2..7698dcf73b5 100644 --- a/extra/yassl/include/openssl/prefix_ssl.h +++ b/extra/yassl/include/openssl/prefix_ssl.h @@ -178,6 +178,7 @@ #define SSL_get1_session yaSSL_get1_session #define X509_get_notBefore yaX509_get_notBefore #define X509_get_notAfter yaX509_get_notAfter +#define yaSSL_ASN1_TIME_to_string ya_SSL_ASN1_TIME_to_string #define MD4_Init yaMD4_Init #define MD4_Update yaMD4_Update #define MD4_Final yaMD4_Final diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h index 81d201b28a6..d9850b51c76 100644 --- a/extra/yassl/include/openssl/ssl.h +++ b/extra/yassl/include/openssl/ssl.h @@ -539,11 +539,23 @@ void MD5_Final(unsigned char*, MD5_CTX*); #define SSL_DEFAULT_CIPHER_LIST "" /* default all */ -/* yaSSL adds */ +/* yaSSL extensions */ int SSL_set_compression(SSL*); /* turn on yaSSL zlib compression */ +char *yaSSL_ASN1_TIME_to_string(ASN1_TIME *time, char *buf, size_t len); +#include "transport_types.h" +/* + Set functions for yaSSL to use in order to send and receive data. + + These hooks are offered in order to enable non-blocking I/O. If + not set, yaSSL defaults to using send() and recv(). + @todo Remove hooks and accompanying code when yaSSL is fixed. +*/ +void yaSSL_transport_set_ptr(SSL *, void *); +void yaSSL_transport_set_recv_function(SSL *, yaSSL_recv_func_t); +void yaSSL_transport_set_send_function(SSL *, yaSSL_send_func_t); #if defined(__cplusplus) && !defined(YASSL_MYSQL_COMPATIBLE) } /* namespace */ diff --git a/extra/yassl/include/openssl/transport_types.h b/extra/yassl/include/openssl/transport_types.h new file mode 100644 index 00000000000..3c31eb3d822 --- /dev/null +++ b/extra/yassl/include/openssl/transport_types.h @@ -0,0 +1,26 @@ +/* + Copyright (c) 2011, 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 + the Free Software Foundation; version 2 of the License. + + This program 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; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1335 USA. +*/ + +#ifndef yaSSL_transport_types_h__ +#define yaSSL_transport_types_h__ + +/* Type of transport functions used for sending and receiving data. */ +typedef long (*yaSSL_recv_func_t) (void *, void *, size_t, int); +typedef long (*yaSSL_send_func_t) (void *, const void *, size_t, int); + +#endif diff --git a/extra/yassl/include/socket_wrapper.hpp b/extra/yassl/include/socket_wrapper.hpp index 32fd8ab2a07..3fc9c7ee95a 100644 --- a/extra/yassl/include/socket_wrapper.hpp +++ b/extra/yassl/include/socket_wrapper.hpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates. 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 @@ -54,7 +54,9 @@ typedef unsigned int uint; const int SOCKET_ERROR = -1; #endif - + extern "C" { + #include "openssl/transport_types.h" + } typedef unsigned char byte; @@ -64,6 +66,9 @@ class Socket { socket_t socket_; // underlying socket descriptor bool wouldBlock_; // if non-blocking data, for last read bool nonBlocking_; // is option set + void *ptr_; // Argument to transport function + yaSSL_send_func_t send_func_; // Function to send data + yaSSL_recv_func_t recv_func_; // Function to receive data public: explicit Socket(socket_t s = INVALID_SOCKET); ~Socket(); @@ -72,11 +77,15 @@ public: uint get_ready() const; socket_t get_fd() const; + void set_transport_ptr(void *ptr); + void set_transport_recv_function(yaSSL_recv_func_t recv_func); + void set_transport_send_function(yaSSL_send_func_t send_func); + 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(); + bool WouldBlock() const; bool IsNonBlocking() const; diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp index e844bbb5fcd..15fd99450f7 100644 --- a/extra/yassl/include/yassl_int.hpp +++ b/extra/yassl/include/yassl_int.hpp @@ -212,7 +212,7 @@ private: class StringHolder { ASN1_STRING asnString_; public: - StringHolder(const char* str, int sz); + StringHolder(const char* str, int sz, byte type= 0); ~StringHolder(); ASN1_STRING* GetString(); @@ -230,7 +230,7 @@ class X509 { StringHolder afterDate_; // not valid after public: X509(const char* i, size_t, const char* s, size_t, - const char* b, int, const char* a, int, int, int, int, int); + ASN1_STRING *b, ASN1_STRING *a, int, int, int, int); ~X509() {} X509_NAME* GetIssuer(); diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp index b7599a22897..bb2ab2953e1 100644 --- a/extra/yassl/src/cert_wrapper.cpp +++ b/extra/yassl/src/cert_wrapper.cpp @@ -90,7 +90,7 @@ opaque* x509::use_buffer() //CertManager CertManager::CertManager() - : peerX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false), + : peerX509_(0), selfX509_(0), verifyPeer_(false), verifyNone_(false), failNoCert_(false), sendVerify_(false), sendBlankCert_(false), verifyCallback_(0) {} @@ -98,6 +98,7 @@ CertManager::CertManager() CertManager::~CertManager() { ysDelete(peerX509_); + ysDelete(selfX509_); STL::for_each(signers_.begin(), signers_.end(), del_ptr_zero()) ; @@ -219,6 +220,12 @@ X509* CertManager::get_peerX509() const } +X509* CertManager::get_selfX509() const +{ + return selfX509_; +} + + SignatureAlgorithm CertManager::get_peerKeyType() const { return peerKeyType_; @@ -289,14 +296,18 @@ int CertManager::Validate() size_t iSz = strlen(cert.GetIssuer()) + 1; size_t sSz = strlen(cert.GetCommonName()) + 1; - int bSz = (int)strlen(cert.GetBeforeDate()) + 1; - int aSz = (int)strlen(cert.GetAfterDate()) + 1; + ASN1_STRING beforeDate, afterDate; + beforeDate.data= (unsigned char *) cert.GetBeforeDate(); + beforeDate.type= cert.GetBeforeDateType(); + beforeDate.length= strlen((char *) beforeDate.data) + 1; + afterDate.data= (unsigned char *) cert.GetAfterDate(); + afterDate.type= cert.GetAfterDateType(); + afterDate.length= strlen((char *) afterDate.data) + 1; peerX509_ = NEW_YS X509(cert.GetIssuer(), iSz, cert.GetCommonName(), - sSz, cert.GetBeforeDate(), bSz, - cert.GetAfterDate(), aSz, - cert.GetIssuerCnStart(), cert.GetIssuerCnLength(), - cert.GetSubjectCnStart(), cert.GetSubjectCnLength() - ); + sSz, &beforeDate, &afterDate, + cert.GetIssuerCnStart(), cert.GetIssuerCnLength(), + cert.GetSubjectCnStart(), cert.GetSubjectCnLength() + ); if (err == TaoCrypt::SIG_OTHER_E && verifyCallback_) { X509_STORE_CTX store; @@ -331,6 +342,20 @@ int CertManager::SetPrivateKey(const x509& key) keyType_ = rsa_sa_algo; else keyType_ = dsa_sa_algo; + + size_t iSz = strlen(cd.GetIssuer()) + 1; + size_t sSz = strlen(cd.GetCommonName()) + 1; + ASN1_STRING beforeDate, afterDate; + beforeDate.data= (unsigned char *) cd.GetBeforeDate(); + beforeDate.type= cd.GetBeforeDateType(); + beforeDate.length= strlen((char *) beforeDate.data) + 1; + afterDate.data= (unsigned char *) cd.GetAfterDate(); + afterDate.type= cd.GetAfterDateType(); + afterDate.length= strlen((char *) afterDate.data) + 1; + selfX509_ = NEW_YS X509(cd.GetIssuer(), iSz, cd.GetCommonName(), + sSz, &beforeDate, &afterDate, + cd.GetIssuerCnStart(), cd.GetIssuerCnLength(), + cd.GetSubjectCnStart(), cd.GetSubjectCnLength()); } return 0; } @@ -347,8 +372,7 @@ void CertManager::setPeerX509(X509* x) ASN1_STRING* after = x->GetAfter(); peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), - subject->GetName(), subject->GetLength(), (const char*) before->data, - before->length, (const char*) after->data, after->length, + subject->GetName(), subject->GetLength(), before, after, issuer->GetCnPosition(), issuer->GetCnLength(), subject->GetCnPosition(), subject->GetCnLength()); } diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp index e027c507b37..acafea5005e 100644 --- a/extra/yassl/src/crypto_wrapper.cpp +++ b/extra/yassl/src/crypto_wrapper.cpp @@ -995,25 +995,4 @@ x509* PemToDer(FILE* file, CertType type, EncryptedInfo* info) } // namespace - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -namespace yaSSL { -template void ysDelete<DiffieHellman::DHImpl>(DiffieHellman::DHImpl*); -template void ysDelete<Integer::IntegerImpl>(Integer::IntegerImpl*); -template void ysDelete<RSA::RSAImpl>(RSA::RSAImpl*); -template void ysDelete<DSS::DSSImpl>(DSS::DSSImpl*); -template void ysDelete<RandomPool::RandomImpl>(RandomPool::RandomImpl*); -template void ysDelete<AES::AESImpl>(AES::AESImpl*); -template void ysDelete<RC4::RC4Impl>(RC4::RC4Impl*); -template void ysDelete<DES_EDE::DES_EDEImpl>(DES_EDE::DES_EDEImpl*); -template void ysDelete<DES::DESImpl>(DES::DESImpl*); -template void ysDelete<HMAC_RMD::HMAC_RMDImpl>(HMAC_RMD::HMAC_RMDImpl*); -template void ysDelete<HMAC_SHA::HMAC_SHAImpl>(HMAC_SHA::HMAC_SHAImpl*); -template void ysDelete<HMAC_MD5::HMAC_MD5Impl>(HMAC_MD5::HMAC_MD5Impl*); -template void ysDelete<RMD::RMDImpl>(RMD::RMDImpl*); -template void ysDelete<SHA::SHAImpl>(SHA::SHAImpl*); -template void ysDelete<MD5::MD5Impl>(MD5::MD5Impl*); -} -#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION - #endif // !USE_CRYPTOPP_LIB diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp index 5e7d5cd9019..91d3d6b5914 100644 --- a/extra/yassl/src/handshake.cpp +++ b/extra/yassl/src/handshake.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, Oracle and/or its affiliates. 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 @@ -747,7 +747,8 @@ int DoProcessReply(SSL& ssl) return 0; } uint ready = ssl.getSocket().get_ready(); - if (!ready) return 1; + if (!ready) + ready= 64; // add buffered data if its there input_buffer* buffered = ssl.useBuffers().TakeRawInput(); diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp index 315f88bb491..759a96600fe 100644 --- a/extra/yassl/src/socket_wrapper.cpp +++ b/extra/yassl/src/socket_wrapper.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2012, Oracle and/or its affiliates. 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 @@ -52,11 +52,33 @@ #endif // _WIN32 +namespace { + + +extern "C" long system_recv(void *ptr, void *buf, size_t count, int flags) +{ + yaSSL::socket_t *socket = (yaSSL::socket_t *) ptr; + return ::recv(*socket, reinterpret_cast<char *>(buf), count, flags); +} + + +extern "C" long system_send(void *ptr, const void *buf, size_t count, + int flags) +{ + yaSSL::socket_t *socket = (yaSSL::socket_t *) ptr; + return ::send(*socket, reinterpret_cast<const char *>(buf), count, flags); +} + + +} + + namespace yaSSL { Socket::Socket(socket_t s) - : socket_(s), wouldBlock_(false), nonBlocking_(false) + : socket_(s), wouldBlock_(false), nonBlocking_(false), + ptr_(&socket_), send_func_(system_send), recv_func_(system_recv) {} @@ -108,8 +130,25 @@ uint Socket::get_ready() const return ready; } +void Socket::set_transport_ptr(void *ptr) +{ + ptr_ = ptr; +} + + +void Socket::set_transport_recv_function(yaSSL_recv_func_t recv_func) +{ + recv_func_ = recv_func; +} + + +void Socket::set_transport_send_function(yaSSL_send_func_t send_func) +{ + send_func_ = send_func; +} + -uint Socket::send(const byte* buf, unsigned int sz, unsigned int& written, +uint Socket::send(const byte* buf, unsigned int sz, unsigned int &written, int flags) { const byte* pos = buf; @@ -117,22 +156,23 @@ uint Socket::send(const byte* buf, unsigned int sz, unsigned int& written, wouldBlock_ = false; - while (pos != end) { - int sent = ::send(socket_, reinterpret_cast<const char *>(pos), - static_cast<int>(end - pos), flags); - if (sent == -1) { - if (get_lastError() == SOCKET_EWOULDBLOCK || - get_lastError() == SOCKET_EAGAIN) { - wouldBlock_ = true; // would have blocked this time only - nonBlocking_ = true; // nonblocking, win32 only way to tell - return 0; - } - return static_cast<uint>(-1); + while (pos != end) + { + int sent = send_func_(ptr_, pos, static_cast<int>(end - pos), flags); + if (sent == -1) + { + if (get_lastError() == SOCKET_EWOULDBLOCK || + get_lastError() == SOCKET_EAGAIN) + { + wouldBlock_ = true; // would have blocked this time only + nonBlocking_ = true; // nonblocking, win32 only way to tell + return 0; } - pos += sent; - written += sent; + return static_cast<uint>(-1); + } + pos += sent; + written += sent; } - return sz; } @@ -141,7 +181,7 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) { wouldBlock_ = false; - int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags); + int recvd = recv_func_(ptr_, buf, sz, flags); // idea to seperate error from would block by arnetheduck@gmail.com if (recvd == -1) { @@ -162,8 +202,22 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) // wait if blocking for input, return false for error bool Socket::wait() { - byte b; - return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1); + char b; + int recvd = ::recv(socket_, &b, 1, MSG_PEEK); + + if (recvd == -1) { + if (get_lastError() == SOCKET_EWOULDBLOCK || + get_lastError() == SOCKET_EAGAIN) { + wouldBlock_ = true; // would have blocked this time only + nonBlocking_ = true; // socket nonblocking, win32 only way to tell + return 1; + } + } + else if (recvd == 0) + return 0; // Non blocking & no data + + return 1; // Data can be read + } diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index fa1a65fafd1..b09a952dd81 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2014, Oracle and/or its affiliates. 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 @@ -40,6 +40,7 @@ #include "rsa.hpp" // for TaoCrypt RSA key decode #include "dsa.hpp" // for TaoCrypt DSA key decode #include <stdio.h> +#include <time.h> #ifdef _WIN32 #include <windows.h> // FindFirstFile etc.. @@ -773,7 +774,6 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file, const char* path) { int ret = SSL_FAILURE; - const int HALF_PATH = 128; if (file) ret = read_file(ctx, file, SSL_FILETYPE_PEM, CA); @@ -1006,7 +1006,7 @@ void OpenSSL_add_all_algorithms() // compatibility only {} -int SSL_library_init() // compatiblity only +int SSL_library_init() // compatibility only { return 1; } @@ -1252,8 +1252,7 @@ void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX* ctx, void* userdata) X509* SSL_get_certificate(SSL* ssl) { - // only used to pass to get_privatekey which isn't used - return 0; + return ssl->getCrypto().get_certManager().get_selfX509(); } @@ -1721,7 +1720,6 @@ unsigned long ERR_get_error() // TODO: } - SSL_CIPHER* SSL_get_current_cipher(SSL*) { // TODO: @@ -1735,10 +1733,41 @@ unsigned long ERR_get_error() return 0; } + // end stunnel needs + + char *yaSSL_ASN1_TIME_to_string(ASN1_TIME *time, char *buf, size_t len) + { + tm t; + static const char *month_names[12]= + { + "Jan","Feb","Mar","Apr","May","Jun", + "Jul","Aug","Sep","Oct","Nov","Dec" + }; + + TaoCrypt::ASN1_TIME_extract(time->data, time->type, &t); + snprintf(buf, len, "%s %2d %02d:%02d:%02d %d GMT", + month_names[t.tm_mon], t.tm_mday, t.tm_hour, t.tm_min, + t.tm_sec, t.tm_year + 1900); + return buf; + } - // end stunnel needs + void yaSSL_transport_set_ptr(SSL *ssl, void *ptr) + { + ssl->useSocket().set_transport_ptr(ptr); + } + + + void yaSSL_transport_set_recv_function(SSL *ssl, yaSSL_recv_func_t func) + { + ssl->useSocket().set_transport_recv_function(func); + } + + void yaSSL_transport_set_send_function(SSL *ssl, yaSSL_send_func_t func) + { + ssl->useSocket().set_transport_send_function(func); + } } // extern "C" } // namespace diff --git a/extra/yassl/src/template_instnt.cpp b/extra/yassl/src/template_instnt.cpp deleted file mode 100644 index bc228e4b948..00000000000 --- a/extra/yassl/src/template_instnt.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2000-2008 MySQL AB - Use is subject to license terms - - 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 - the Free Software Foundation; version 2 of the License. - - This program 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; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1335 USA. -*/ - - -/* Explicit template instantiation requests - */ - - -#include "runtime.hpp" -#include "handshake.hpp" -#include "yassl_int.hpp" -#include "crypto_wrapper.hpp" -#include "hmac.hpp" -#include "md5.hpp" -#include "sha.hpp" -#include "ripemd.hpp" -#include "openssl/ssl.h" - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION - -namespace mySTL { -template class list<unsigned char*>; -template yaSSL::del_ptr_zero for_each(mySTL::list<unsigned char*>::iterator, mySTL::list<unsigned char*>::iterator, yaSSL::del_ptr_zero); -template pair<int, yaSSL::Message* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*>(mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*); -template pair<int, yaSSL::HandShakeBase* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*>(mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*); -template void destroy<mySTL::pair<int, yaSSL::Message* (*)()>*>(mySTL::pair<int, yaSSL::Message* (*)()>*, mySTL::pair<int, yaSSL::Message* (*)()>*); -template void destroy<mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*>(mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*, mySTL::pair<int, yaSSL::HandShakeBase* (*)()>*); -template pair<int, yaSSL::ServerKeyBase* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*); -template void destroy<mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ServerKeyBase* (*)()>*); -template pair<int, yaSSL::ClientKeyBase* (*)()>* uninit_copy<mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*); -template class list<TaoCrypt::Signer*>; -template class list<yaSSL::SSL_SESSION*>; -template class list<yaSSL::input_buffer*>; -template class list<yaSSL::output_buffer*>; -template class list<yaSSL::x509*>; -template class list<yaSSL::Digest*>; -template class list<yaSSL::BulkCipher*>; -template void destroy<mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*>(mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*, mySTL::pair<int, yaSSL::ClientKeyBase* (*)()>*); -template yaSSL::del_ptr_zero for_each<mySTL::list<TaoCrypt::Signer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<TaoCrypt::Signer*>::iterator, mySTL::list<TaoCrypt::Signer*>::iterator, yaSSL::del_ptr_zero); -template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::SSL_SESSION*>::iterator, mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::del_ptr_zero); -template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::del_ptr_zero); -template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::del_ptr_zero); -template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::x509*>::iterator, mySTL::list<yaSSL::x509*>::iterator, yaSSL::del_ptr_zero); -template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::Digest*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::Digest*>::iterator, mySTL::list<yaSSL::Digest*>::iterator, yaSSL::del_ptr_zero); -template yaSSL::del_ptr_zero for_each<mySTL::list<yaSSL::BulkCipher*>::iterator, yaSSL::del_ptr_zero>(mySTL::list<yaSSL::BulkCipher*>::iterator, mySTL::list<yaSSL::BulkCipher*>::iterator, yaSSL::del_ptr_zero); -template bool list<yaSSL::ThreadError>::erase(list<yaSSL::ThreadError>::iterator); -template void list<yaSSL::ThreadError>::push_back(yaSSL::ThreadError); -template void list<yaSSL::ThreadError>::pop_front(); -template void list<yaSSL::ThreadError>::pop_back(); -template list<yaSSL::ThreadError>::~list(); -template pair<int, yaSSL::Message* (*)()>* GetArrayMemory<pair<int, yaSSL::Message* (*)()> >(size_t); -template void FreeArrayMemory<pair<int, yaSSL::Message* (*)()> >(pair<int, yaSSL::Message* (*)()>*); -template pair<int, yaSSL::HandShakeBase* (*)()>* GetArrayMemory<pair<int, yaSSL::HandShakeBase* (*)()> >(size_t); -template void FreeArrayMemory<pair<int, yaSSL::HandShakeBase* (*)()> >(pair<int, yaSSL::HandShakeBase* (*)()>*); -template pair<int, yaSSL::ServerKeyBase* (*)()>* GetArrayMemory<pair<int, yaSSL::ServerKeyBase* (*)()> >(size_t); -template void FreeArrayMemory<pair<int, yaSSL::ServerKeyBase* (*)()> >(pair<int, yaSSL::ServerKeyBase* (*)()>*); -template pair<int, yaSSL::ClientKeyBase* (*)()>* GetArrayMemory<pair<int, yaSSL::ClientKeyBase* (*)()> >(size_t); -template void FreeArrayMemory<pair<int, yaSSL::ClientKeyBase* (*)()> >(pair<int, yaSSL::ClientKeyBase* (*)()>*); -} - -namespace yaSSL { -template void ysDelete<SSL_CTX>(yaSSL::SSL_CTX*); -template void ysDelete<SSL>(yaSSL::SSL*); -template void ysDelete<BIGNUM>(yaSSL::BIGNUM*); -template void ysDelete<unsigned char>(unsigned char*); -template void ysDelete<DH>(yaSSL::DH*); -template void ysDelete<TaoCrypt::Signer>(TaoCrypt::Signer*); -template void ysDelete<SSL_SESSION>(yaSSL::SSL_SESSION*); -template void ysDelete<input_buffer>(input_buffer*); -template void ysDelete<output_buffer>(output_buffer*); -template void ysDelete<x509>(x509*); -template void ysDelete<Auth>(Auth*); -template void ysDelete<HandShakeBase>(HandShakeBase*); -template void ysDelete<ServerKeyBase>(ServerKeyBase*); -template void ysDelete<ClientKeyBase>(ClientKeyBase*); -template void ysDelete<SSL_METHOD>(SSL_METHOD*); -template void ysDelete<DiffieHellman>(DiffieHellman*); -template void ysDelete<BulkCipher>(BulkCipher*); -template void ysDelete<Digest>(Digest*); -template void ysDelete<X509>(X509*); -template void ysDelete<Message>(Message*); -template void ysDelete<sslFactory>(sslFactory*); -template void ysDelete<Sessions>(Sessions*); -template void ysDelete<Errors>(Errors*); -template void ysArrayDelete<unsigned char>(unsigned char*); -template void ysArrayDelete<char>(char*); - -template int min<int>(int, int); -template uint16 min<uint16>(uint16, uint16); -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/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index 5ced3893523..bb3825ca972 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -121,11 +121,11 @@ void SetErrorString(YasslError error, char* buffer) break; case certificate_error : - strncpy(buffer, "unable to proccess cerificate", max); + strncpy(buffer, "unable to process cerificate", max); break; case privateKey_error : - strncpy(buffer, "unable to proccess private key, bad format", max); + strncpy(buffer, "unable to process private key, bad format", max); break; case badVersion_error : diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp index fbf43de8cb6..a4b1b50e10f 100644 --- a/extra/yassl/src/yassl_imp.cpp +++ b/extra/yassl/src/yassl_imp.cpp @@ -24,7 +24,7 @@ #include "handshake.hpp" #include "asn.hpp" // provide crypto wrapper?? - +#include <my_attribute.h> namespace yaSSL { @@ -963,7 +963,7 @@ void Alert::Process(input_buffer& input, SSL& ssl) if (ssl.getSecurity().get_parms().cipher_type_ == block) { int ivExtra = 0; - opaque fill; + opaque fill __attribute__((unused)); if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); @@ -2422,7 +2422,7 @@ void Finished::Process(input_buffer& input, SSL& ssl) if (ssl.isTLSv1_1()) ivExtra = ssl.getCrypto().get_cipher().get_blockSize(); - opaque fill; + opaque fill __attribute__((unused)); int padSz = ssl.getSecurity().get_parms().encrypt_size_ - ivExtra - HANDSHAKE_HEADER - finishedSz - digestSz; for (int i = 0; i < padSz; i++) diff --git a/extra/yassl/src/yassl_int.cpp b/extra/yassl/src/yassl_int.cpp index 2c1b57fa846..78e54139471 100644 --- a/extra/yassl/src/yassl_int.cpp +++ b/extra/yassl/src/yassl_int.cpp @@ -1555,12 +1555,11 @@ void SSL_SESSION::CopyX509(X509* x) X509_NAME* issuer = x->GetIssuer(); X509_NAME* subject = x->GetSubject(); - ASN1_STRING* before = x->GetBefore(); - ASN1_STRING* after = x->GetAfter(); + ASN1_TIME* before = x->GetBefore(); + ASN1_TIME* after = x->GetAfter(); peerX509_ = NEW_YS X509(issuer->GetName(), issuer->GetLength(), - subject->GetName(), subject->GetLength(), (const char*) before->data, - before->length, (const char*) after->data, after->length, + subject->GetName(), subject->GetLength(), before, after, issuer->GetCnPosition(), issuer->GetCnLength(), subject->GetCnPosition(), subject->GetCnLength()); } @@ -2510,10 +2509,12 @@ size_t X509_NAME::GetLength() const X509::X509(const char* i, size_t iSz, const char* s, size_t sSz, - const char* b, int bSz, const char* a, int aSz, int issPos, - int issLen, int subPos, int subLen) + ASN1_STRING *b, ASN1_STRING *a, + int issPos, int issLen, + int subPos, int subLen) : issuer_(i, iSz, issPos, issLen), subject_(s, sSz, subPos, subLen), - beforeDate_(b, bSz), afterDate_(a, aSz) + beforeDate_((char *) b->data, b->length, b->type), + afterDate_((char *) a->data, a->length, a->type) {} @@ -2529,13 +2530,13 @@ X509_NAME* X509::GetSubject() } -ASN1_STRING* X509::GetBefore() +ASN1_TIME* X509::GetBefore() { return beforeDate_.GetString(); } -ASN1_STRING* X509::GetAfter() +ASN1_TIME* X509::GetAfter() { return afterDate_.GetString(); } @@ -2565,12 +2566,12 @@ ASN1_STRING* X509_NAME::GetEntry(int i) } -StringHolder::StringHolder(const char* str, int sz) +StringHolder::StringHolder(const char* str, int sz, byte type) { asnString_.length = sz; asnString_.data = NEW_YS byte[sz + 1]; memcpy(asnString_.data, str, sz); - asnString_.type = 0; // not used for now + asnString_.type = type; } @@ -2701,13 +2702,3 @@ extern "C" void yaSSL_CleanUp() yaSSL::sessionsInstance = 0; yaSSL::errorsInstance = 0; } - - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -namespace mySTL { -template yaSSL::yassl_int_cpp_local1::SumData for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData); -template yaSSL::yassl_int_cpp_local1::SumBuffer for_each<mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer>(mySTL::list<yaSSL::output_buffer*>::iterator, mySTL::list<yaSSL::output_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumBuffer); -template mySTL::list<yaSSL::SSL_SESSION*>::iterator find_if<mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::yassl_int_cpp_local2::sess_match>(mySTL::list<yaSSL::SSL_SESSION*>::iterator, mySTL::list<yaSSL::SSL_SESSION*>::iterator, yaSSL::yassl_int_cpp_local2::sess_match); -template mySTL::list<yaSSL::ThreadError>::iterator find_if<mySTL::list<yaSSL::ThreadError>::iterator, yaSSL::yassl_int_cpp_local2::thr_match>(mySTL::list<yaSSL::ThreadError>::iterator, mySTL::list<yaSSL::ThreadError>::iterator, yaSSL::yassl_int_cpp_local2::thr_match); -} -#endif diff --git a/extra/yassl/taocrypt/CMakeLists.txt b/extra/yassl/taocrypt/CMakeLists.txt index eb5531fec51..ebfa70e8799 100644 --- a/extra/yassl/taocrypt/CMakeLists.txt +++ b/extra/yassl/taocrypt/CMakeLists.txt @@ -29,14 +29,6 @@ SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp include/rabbit.hpp include/hc128.hpp) -IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) - SET(TAOCRYPT_SOURCES ${TAOCRYPT_SOURCES} src/template_instnt.cpp) -ENDIF() - ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES}) RESTRICT_SYMBOL_EXPORTS(taocrypt) -IF(MSVC) - INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp index 21b694f8bd4..e8a8820ed1a 100644 --- a/extra/yassl/taocrypt/include/asn.hpp +++ b/extra/yassl/taocrypt/include/asn.hpp @@ -32,7 +32,7 @@ #else #include "list.hpp" #endif - +#include <time.h> namespace STL = STL_NAMESPACE; @@ -282,7 +282,9 @@ public: const char* GetCommonName() const { return subject_; } const byte* GetHash() const { return subjectHash_; } const char* GetBeforeDate() const { return beforeDate_; } + byte GetBeforeDateType() const { return beforeDateType_; } const char* GetAfterDate() const { return afterDate_; } + byte GetAfterDateType() const { return afterDateType_; } int GetSubjectCnStart() const { return subCnPos_; } int GetIssuerCnStart() const { return issCnPos_; } int GetSubjectCnLength() const { return subCnLen_; } @@ -306,7 +308,9 @@ private: char issuer_[ASN_NAME_MAX]; // Names char subject_[ASN_NAME_MAX]; // Names char beforeDate_[MAX_DATE_SZ+1]; // valid before date, +null term + byte beforeDateType_; // beforeDate time type char afterDate_[MAX_DATE_SZ+1]; // valid after date, +null term + byte afterDateType_; // afterDate time type bool verify_; // Default to yes, but could be off void ReadHeader(); @@ -379,6 +383,9 @@ int GetCert(Source&); // Get Cert in PEM format from pkcs12 file int GetPKCS_Cert(const char* password, Source&); +void ASN1_TIME_extract(const unsigned char* date, unsigned char format, + tm *parsed_time); + } // namespace diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp index e0167d7f855..ebfb02a7190 100644 --- a/extra/yassl/taocrypt/include/misc.hpp +++ b/extra/yassl/taocrypt/include/misc.hpp @@ -143,13 +143,9 @@ void CleanUp(); // Turn on ia32 ASM for Big Integer // CodeWarrior defines _MSC_VER -// -// Do not use assembler with GCC, as the implementation for it is broken; -// it does not use proper GCC asm contraints and makes assumptions about -// frame pointers and so on, which breaks depending on GCC version and -// optimization level. #if !defined(TAOCRYPT_DISABLE_X86ASM) && ((defined(_MSC_VER) && \ - !defined(__MWERKS__) && defined(_M_IX86))) + !defined(__MWERKS__) && defined(_M_IX86)) || \ + (defined(__GNUC__) && defined(__i386__))) #define TAOCRYPT_X86ASM_AVAILABLE #endif @@ -754,7 +750,11 @@ private: byte *m_block; }; -template <class T, class B, bool A=true> +/* + XXX MYSQL: Setting A (assumeAligned) to false, + keeping it true might trigger segfault on SPARC. +*/ +template <class T, class B, bool A= false> struct BlockGetAndPut { // function needed because of C++ grammatical ambiguity between diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index e2257701ae8..b24333befc9 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -325,13 +325,3 @@ void AbstractRing::SimultaneousExponentiate(Integer *results, } // namespace - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -namespace mySTL { -template TaoCrypt::WindowSlider* uninit_copy<TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); -template void destroy<TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); -template TaoCrypt::WindowSlider* GetArrayMemory<TaoCrypt::WindowSlider>(size_t); -template void FreeArrayMemory<TaoCrypt::WindowSlider>(TaoCrypt::WindowSlider*); -} -#endif - diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 8cb9aee15fd..0a677c4b0f8 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -32,10 +32,55 @@ #include "coding.hpp" #include <time.h> // gmtime(); #include "memory.hpp" // some auto_ptr don't have reset, also need auto_array - +#include <assert.h> namespace TaoCrypt { +// like atoi but only use first byte +word32 btoi(byte b) +{ + return b - 0x30; +} + + +// two byte date/time, add to value +void GetTime(int *value, const byte* date, int& i) +{ + *value += btoi(date[i++]) * 10; + *value += btoi(date[i++]); +} + + +void ASN1_TIME_extract(const unsigned char* date, unsigned char format, + tm *t) +{ + int i = 0; + memset(t, 0, sizeof (tm)); + + assert(format == UTC_TIME || format == GENERALIZED_TIME); + + if (format == UTC_TIME) { + if (btoi(date[0]) >= 5) + t->tm_year = 1900; + else + t->tm_year = 2000; + } + else { // format == GENERALIZED_TIME + t->tm_year += btoi(date[i++]) * 1000; + t->tm_year += btoi(date[i++]) * 100; + } + + GetTime(&t->tm_year, date, i); t->tm_year -= 1900; // adjust + GetTime(&t->tm_mon, date, i); t->tm_mon -= 1; // adjust + GetTime(&t->tm_mday, date, i); + GetTime(&t->tm_hour, date, i); + GetTime(&t->tm_min, date, i); + GetTime(&t->tm_sec, date, i); + + assert(date[i] == 'Z'); // only Zulu supported for this profile +} + + namespace { // locals @@ -75,52 +120,15 @@ bool operator<(tm& a, tm&b) } -// like atoi but only use first byte -word32 btoi(byte b) -{ - return b - 0x30; -} - - -// two byte date/time, add to value -void GetTime(int& value, const byte* date, int& i) -{ - value += btoi(date[i++]) * 10; - value += btoi(date[i++]); -} - - // Make sure before and after dates are valid bool ValidateDate(const byte* date, byte format, CertDecoder::DateType dt) { tm certTime; - memset(&certTime, 0, sizeof(certTime)); - int i = 0; - - if (format == UTC_TIME) { - if (btoi(date[0]) >= 5) - certTime.tm_year = 1900; - else - certTime.tm_year = 2000; - } - else { // format == GENERALIZED_TIME - certTime.tm_year += btoi(date[i++]) * 1000; - certTime.tm_year += btoi(date[i++]) * 100; - } - - GetTime(certTime.tm_year, date, i); certTime.tm_year -= 1900; // adjust - GetTime(certTime.tm_mon, date, i); certTime.tm_mon -= 1; // adjust - GetTime(certTime.tm_mday, date, i); - GetTime(certTime.tm_hour, date, i); - GetTime(certTime.tm_min, date, i); - GetTime(certTime.tm_sec, date, i); - - if (date[i] != 'Z') // only Zulu supported for this profile - return false; - time_t ltime = time(0); tm* localTime = gmtime(<ime); + ASN1_TIME_extract(date, format, &certTime); + if (dt == CertDecoder::BEFORE) { if (*localTime < certTime) return false; @@ -895,10 +903,12 @@ void CertDecoder::GetDate(DateType dt) if (dt == BEFORE) { memcpy(beforeDate_, date, length); beforeDate_[length] = 0; + beforeDateType_= b; } else { // after memcpy(afterDate_, date, length); afterDate_[length] = 0; + afterDateType_= b; } } diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp index 82c09a95765..432a0ad20af 100644 --- a/extra/yassl/taocrypt/src/integer.cpp +++ b/extra/yassl/taocrypt/src/integer.cpp @@ -193,8 +193,9 @@ DWord() {} "a" (a), "rm" (b) : "cc"); #elif defined(__mips64) - __asm__("dmultu %2,%3" : "=d" (r.halfs_.high), "=l" (r.halfs_.low) - : "r" (a), "r" (b)); + unsigned __int128 t = (unsigned __int128) a * b; + r.halfs_.high = t >> 64; + r.halfs_.low = (word) t; #elif defined(_M_IX86) // for testing @@ -3887,17 +3888,5 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, return p * (u * (xq-xp) % q) + xp; } - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -#ifndef TAOCRYPT_NATIVE_DWORD_AVAILABLE -template hword DivideThreeWordsByTwo<hword, Word>(hword*, hword, hword, Word*); -#endif -template word DivideThreeWordsByTwo<word, DWord>(word*, word, word, DWord*); -#ifdef SSE2_INTRINSICS_AVAILABLE -template class AlignedAllocator<word>; -#endif -#endif - - } // namespace diff --git a/extra/yassl/taocrypt/src/template_instnt.cpp b/extra/yassl/taocrypt/src/template_instnt.cpp deleted file mode 100644 index 8bb0c35aa57..00000000000 --- a/extra/yassl/taocrypt/src/template_instnt.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (c) 2000, 2012, 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 - the Free Software Foundation; version 2 of the License. - - This program 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; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - MA 02110-1335 USA. -*/ - - -/* Explicit template instantiation requests - */ - - -#include "runtime.hpp" -#include "integer.hpp" -#include "rsa.hpp" -#include "sha.hpp" -#include "md5.hpp" -#include "hmac.hpp" -#include "ripemd.hpp" -#include "pwdbased.hpp" -#include "algebra.hpp" -#include "vector.hpp" -#include "hash.hpp" - -#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION -namespace TaoCrypt { - -#if defined(SSE2_INTRINSICS_AVAILABLE) -template AlignedAllocator<unsigned int>::pointer StdReallocate<unsigned int, AlignedAllocator<unsigned int> >(AlignedAllocator<unsigned int>&, unsigned int*, AlignedAllocator<unsigned int>::size_type, AlignedAllocator<unsigned int>::size_type, bool); -#endif - -template class RSA_Decryptor<RSA_BlockType2>; -template class RSA_Encryptor<RSA_BlockType1>; -template class RSA_Encryptor<RSA_BlockType2>; -template void tcDelete<HASH>(HASH*); -template void tcDelete<Integer>(Integer*); -template void tcArrayDelete<byte>(byte*); -template AllocatorWithCleanup<byte>::pointer StdReallocate<byte, AllocatorWithCleanup<byte> >(AllocatorWithCleanup<byte>&, byte*, AllocatorWithCleanup<byte>::size_type, AllocatorWithCleanup<byte>::size_type, bool); -template void tcArrayDelete<word>(word*); -template AllocatorWithCleanup<word>::pointer StdReallocate<word, AllocatorWithCleanup<word> >(AllocatorWithCleanup<word>&, word*, AllocatorWithCleanup<word>::size_type, AllocatorWithCleanup<word>::size_type, bool); - -#ifndef TAOCRYPT_SLOW_WORD64 // defined when word != word32 -template void tcArrayDelete<word32>(word32*); -template AllocatorWithCleanup<word32>::pointer StdReallocate<word32, AllocatorWithCleanup<word32> >(AllocatorWithCleanup<word32>&, word32*, AllocatorWithCleanup<word32>::size_type, AllocatorWithCleanup<word32>::size_type, bool); -#endif - -template void tcArrayDelete<char>(char*); - -template class PBKDF2_HMAC<SHA>; -template class HMAC<MD5>; -template class HMAC<SHA>; -template class HMAC<RIPEMD160>; -} - -namespace mySTL { -template vector<TaoCrypt::Integer>* uninit_fill_n<vector<TaoCrypt::Integer>*, size_t, vector<TaoCrypt::Integer> >(vector<TaoCrypt::Integer>*, size_t, vector<TaoCrypt::Integer> const&); -template void destroy<vector<TaoCrypt::Integer>*>(vector<TaoCrypt::Integer>*, vector<TaoCrypt::Integer>*); -template TaoCrypt::Integer* uninit_copy<TaoCrypt::Integer*, TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*, TaoCrypt::Integer*); -template TaoCrypt::Integer* uninit_fill_n<TaoCrypt::Integer*, size_t, TaoCrypt::Integer>(TaoCrypt::Integer*, size_t, TaoCrypt::Integer const&); -template void destroy<TaoCrypt::Integer*>(TaoCrypt::Integer*, TaoCrypt::Integer*); -template TaoCrypt::byte* GetArrayMemory<TaoCrypt::byte>(size_t); -template void FreeArrayMemory<TaoCrypt::byte>(TaoCrypt::byte*); -template TaoCrypt::Integer* GetArrayMemory<TaoCrypt::Integer>(size_t); -template void FreeArrayMemory<TaoCrypt::Integer>(TaoCrypt::Integer*); -template vector<TaoCrypt::Integer>* GetArrayMemory<vector<TaoCrypt::Integer> >(size_t); -template void FreeArrayMemory<vector<TaoCrypt::Integer> >(vector<TaoCrypt::Integer>*); -template void FreeArrayMemory<void>(void*); -} - -#endif |