Commit a834b692 authored by svoj@mysql.com's avatar svoj@mysql.com

Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/svoj/devel/mysql/yassl1-mysql-5.0
parents 549399ee 9359cec4
...@@ -445,7 +445,7 @@ const opaque master_label[MASTER_LABEL_SZ + 1] = "master secret"; ...@@ -445,7 +445,7 @@ const opaque master_label[MASTER_LABEL_SZ + 1] = "master secret";
const opaque key_label [KEY_LABEL_SZ + 1] = "key expansion"; const opaque key_label [KEY_LABEL_SZ + 1] = "key expansion";
} // namespace } // naemspace
#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 #if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
/* /*
...@@ -456,4 +456,5 @@ const opaque key_label [KEY_LABEL_SZ + 1] = "key expansion"; ...@@ -456,4 +456,5 @@ const opaque key_label [KEY_LABEL_SZ + 1] = "key expansion";
using yaSSL::byte; using yaSSL::byte;
#endif #endif
#endif // yaSSL_TYPES_HPP #endif // yaSSL_TYPES_HPP
...@@ -5,3 +5,4 @@ libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ ...@@ -5,3 +5,4 @@ libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \ handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h
AM_CXXFLAGS = -DYASSL_PURE_C
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
*/ */
#include <string.h> // memcpy #include <string.h> // memcpy
#include "runtime.hpp"
#include "buffer.hpp" #include "buffer.hpp"
#include "yassl_types.hpp" #include "yassl_types.hpp"
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* *
*/ */
#include "runtime.hpp"
#include "cert_wrapper.hpp" #include "cert_wrapper.hpp"
#include "yassl_int.hpp" #include "yassl_int.hpp"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* Locking functions /* Locking functions
*/ */
#include "runtime.hpp"
#include "lock.hpp" #include "lock.hpp"
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
/* Debug logging functions /* Debug logging functions
*/ */
#include "runtime.hpp"
#include "log.hpp" #include "log.hpp"
#ifdef YASSL_LOG #ifdef YASSL_LOG
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
*/ */
#include "runtime.hpp"
#include "socket_wrapper.hpp" #include "socket_wrapper.hpp"
#ifndef _WIN32 #ifndef _WIN32
......
/* template_instnt.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.
*
* 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
*/
/* Explicit template instantiation requests
*/
#include "runtime.hpp" #include "runtime.hpp"
#include "handshake.hpp" #include "handshake.hpp"
#include "yassl_int.hpp" #include "yassl_int.hpp"
...@@ -15,7 +41,7 @@ template class HMAC<MD5>; ...@@ -15,7 +41,7 @@ template class HMAC<MD5>;
template class HMAC<SHA>; template class HMAC<SHA>;
template class HMAC<RIPEMD160>; template class HMAC<RIPEMD160>;
} }
#endif #endif // USE_CRYPTOPP_LIB
namespace mySTL { namespace mySTL {
template class list<unsigned char*>; template class list<unsigned char*>;
...@@ -64,4 +90,6 @@ template void ysDelete<Message>(Message*); ...@@ -64,4 +90,6 @@ template void ysDelete<Message>(Message*);
template void ysArrayDelete<unsigned char>(unsigned char*); template void ysArrayDelete<unsigned char>(unsigned char*);
template void ysArrayDelete<char>(char*); template void ysArrayDelete<char>(char*);
} }
#endif
#endif // HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
* *
*/ */
#include "runtime.hpp"
#include "timer.hpp" #include "timer.hpp"
namespace yaSSL { namespace yaSSL {
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
/* yaSSL error implements and an exception class /* yaSSL error implements and an exception class
*/ */
#include "runtime.hpp"
#include "yassl_error.hpp" #include "yassl_error.hpp"
namespace yaSSL { namespace yaSSL {
......
...@@ -33,28 +33,36 @@ ...@@ -33,28 +33,36 @@
void* operator new(size_t sz, yaSSL::new_t) void* operator new(size_t sz, yaSSL::new_t)
{ {
#ifdef YASSL_PURE_C
void* ptr = malloc(sz ? sz : 1); void* ptr = malloc(sz ? sz : 1);
if (!ptr) abort(); if (!ptr) abort();
return ptr; return ptr;
#else
return ::operator new(sz);
#endif
} }
void* operator new[](size_t sz, yaSSL::new_t)
{
void* ptr = malloc(sz ? sz : 1);
if (!ptr) abort();
return ptr;
}
void operator delete(void* ptr, yaSSL::new_t) void operator delete(void* ptr, yaSSL::new_t)
{ {
#ifdef YASSL_PURE_C
if (ptr) free(ptr); if (ptr) free(ptr);
#else
::operator delete(ptr);
#endif
}
void* operator new[](size_t sz, yaSSL::new_t nt)
{
return ::operator new(sz, nt);
} }
void operator delete[](void* ptr, yaSSL::new_t)
void operator delete[](void* ptr, yaSSL::new_t nt)
{ {
if (ptr) free(ptr); ::operator delete(ptr, nt);
} }
...@@ -923,7 +931,7 @@ void SSL::setKeys() ...@@ -923,7 +931,7 @@ void SSL::setKeys()
// local functors // local functors
namespace yassl_int_cpp_local1 { namespace yassl_int_cpp_local1 { // for explicit templates
struct SumData { struct SumData {
uint total_; uint total_;
...@@ -1385,7 +1393,8 @@ Sessions::~Sessions() ...@@ -1385,7 +1393,8 @@ Sessions::~Sessions()
} }
namespace yassl_int_cpp_local2 { // locals // locals
namespace yassl_int_cpp_local2 { // for explicit templates
typedef mySTL::list<SSL_SESSION*>::iterator iterator; typedef mySTL::list<SSL_SESSION*>::iterator iterator;
...@@ -1974,6 +1983,8 @@ X509_NAME* X509::GetSubject() ...@@ -1974,6 +1983,8 @@ X509_NAME* X509::GetSubject()
return &subject_; return &subject_;
} }
} // namespace } // namespace
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
...@@ -1983,3 +1994,4 @@ template yaSSL::yassl_int_cpp_local1::SumBuffer for_each<mySTL::list<yaSSL::outp ...@@ -1983,3 +1994,4 @@ template yaSSL::yassl_int_cpp_local1::SumBuffer for_each<mySTL::list<yaSSL::outp
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::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);
} }
#endif #endif
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
namespace TaoCrypt { namespace TaoCrypt {
// define this if running on a big-endian CPU
#if !defined(LITTLE_ENDIAN_ORDER) && (defined(__BIG_ENDIAN__) || \ #if defined(WORDS_BIGENDIAN) || (defined(__MWERKS__) && !defined(__INTEL__))
defined(__sparc) || defined(__sparc__) || defined(__hppa__) || \
defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
#define BIG_ENDIAN_ORDER #define BIG_ENDIAN_ORDER
#endif #endif
...@@ -47,34 +45,28 @@ typedef unsigned char byte; ...@@ -47,34 +45,28 @@ typedef unsigned char byte;
typedef unsigned short word16; typedef unsigned short word16;
typedef unsigned int word32; typedef unsigned int word32;
#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE) #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE
typedef unsigned long long word64;
#define W64LIT(x) x##LL
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE #define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE #define WORD64_IS_DISTINCT_TYPE
typedef unsigned __int64 word64; typedef unsigned __int64 word64;
#define W64LIT(x) x##ui64 #elif SIZEOF_LONG == 8
#elif defined(__DECCXX)
#define WORD64_AVAILABLE #define WORD64_AVAILABLE
typedef unsigned long word64; typedef unsigned long word64;
#elif SIZEOF_LONG_LONG == 8
#define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE
typedef unsigned long long word64;
#endif #endif
// define largest word type
#ifdef WORD64_AVAILABLE
typedef word64 lword;
#else
typedef word32 lword;
#endif
// compilers we've found 64-bit multiply insructions for
#if defined(__GNUC__) || defined(_MSC_VER) || defined(__DECCXX)
#define HAVE_64_MULTIPLY
#endif
// TODO: FIXME, add asm multiply for x86_64 on Solaris and remove !__sun
#if defined(__alpha__) || (defined(__ia64__) && !defined(__INTEL_COMPILER)) || \ #if defined(HAVE_64_MULTIPLY) && (defined(__alpha__) || defined(__ia64__) \
defined(_ARCH_PPC64) || defined(__mips64) || \ || defined(_ARCH_PPC64) || defined(__mips64) || defined(__x86_64__))
(defined(__x86_64__) && !defined(__sun))
// These platforms have 64-bit CPU registers. Unfortunately most C++ compilers // These platforms have 64-bit CPU registers. Unfortunately most C++ compilers
// don't allow any way to access the 64-bit by 64-bit multiply instruction // don't allow any way to access the 64-bit by 64-bit multiply instruction
// without using assembly, so in order to use word64 as word, the assembly // without using assembly, so in order to use word64 as word, the assembly
......
...@@ -6,3 +6,4 @@ libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \ ...@@ -6,3 +6,4 @@ libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \
md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp \ md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp \
template_instnt.cpp template_instnt.cpp
EXTRA_DIST = ../include/*.hpp EXTRA_DIST = ../include/*.hpp
AM_CXXFLAGS = -DYASSL_PURE_C
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
/* based on Wei Dai's aestables.cpp from CryptoPP */ /* based on Wei Dai's aestables.cpp from CryptoPP */
#include "runtime.hpp"
#include "aes.hpp" #include "aes.hpp"
......
...@@ -319,9 +319,11 @@ void AbstractRing::SimultaneousExponentiate(Integer *results, ...@@ -319,9 +319,11 @@ void AbstractRing::SimultaneousExponentiate(Integer *results,
} // namespace } // namespace
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
namespace mySTL { namespace mySTL {
template TaoCrypt::WindowSlider* uninit_copy<TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*); 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 void destroy<TaoCrypt::WindowSlider*>(TaoCrypt::WindowSlider*, TaoCrypt::WindowSlider*);
} }
#endif #endif
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
/* based on Wei Dai's arc4.cpp from CryptoPP */ /* based on Wei Dai's arc4.cpp from CryptoPP */
#include "runtime.hpp"
#include "arc4.hpp" #include "arc4.hpp"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* coding.cpp implements hex and base64 encoding/decoing /* coding.cpp implements hex and base64 encoding/decoing
*/ */
#include "runtime.hpp"
#include "coding.hpp" #include "coding.hpp"
#include "file.hpp" #include "file.hpp"
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
/* file.cpp implements File Sources and Sinks /* file.cpp implements File Sources and Sinks
*/ */
#include "runtime.hpp"
#include "file.hpp" #include "file.hpp"
......
...@@ -35,8 +35,9 @@ ...@@ -35,8 +35,9 @@
#endif #endif
#if defined(_MSC_VER) && defined(_WIN64) && \ // 64bit multiply overflow intrinsic
!defined(__INTEL_COMPILER) // 64 bit X overflow intrinsic #if defined(_MSC_VER) && defined(_WIN64) && !defined(__INTEL_COMPILER) && \
!defined(TAOCRYPT_NATIVE_DWORD_AVAILABLE)
#ifdef __ia64__ #ifdef __ia64__
#define myUMULH __UMULH #define myUMULH __UMULH
#elif __x86_64__ #elif __x86_64__
...@@ -3957,6 +3958,7 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, ...@@ -3957,6 +3958,7 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq,
return p * (u * (xq-xp) % q) + xp; return p * (u * (xq-xp) % q) + xp;
} }
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
#ifndef TAOCRYPT_NATIVE_DWORD_AVAILABLE #ifndef TAOCRYPT_NATIVE_DWORD_AVAILABLE
template hword DivideThreeWordsByTwo<hword, Word>(hword*, hword, hword, Word*); template hword DivideThreeWordsByTwo<hword, Word>(hword*, hword, hword, Word*);
......
...@@ -22,34 +22,43 @@ ...@@ -22,34 +22,43 @@
/* based on Wei Dai's misc.cpp from CryptoPP */ /* based on Wei Dai's misc.cpp from CryptoPP */
#include "runtime.hpp"
#include "misc.hpp" #include "misc.hpp"
#include <new> // for NewHandler #include <new> // for NewHandler
void* operator new(size_t sz, TaoCrypt::new_t) void* operator new(size_t sz, TaoCrypt::new_t)
{ {
#ifdef YASSL_PURE_C
void* ptr = malloc(sz ? sz : 1); void* ptr = malloc(sz ? sz : 1);
if (!ptr) abort(); if (!ptr) abort();
return ptr; return ptr;
#else
return ::operator new(sz);
#endif
} }
void* operator new[](size_t sz, TaoCrypt::new_t)
{
void* ptr = malloc(sz ? sz : 1);
if (!ptr) abort();
return ptr;
}
void operator delete(void* ptr, TaoCrypt::new_t) void operator delete(void* ptr, TaoCrypt::new_t)
{ {
#ifdef YASSL_PURE_C
if (ptr) free(ptr); if (ptr) free(ptr);
#else
::operator delete(ptr);
#endif
} }
void operator delete[](void* ptr, TaoCrypt::new_t)
void* operator new[](size_t sz, TaoCrypt::new_t nt)
{ {
if (ptr) free(ptr); return ::operator new(sz, nt);
}
void operator delete[](void* ptr, TaoCrypt::new_t nt)
{
::operator delete(ptr, nt);
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
specific seed, switch to /dev/random for more security but may block specific seed, switch to /dev/random for more security but may block
*/ */
#include "runtime.hpp"
#include "random.hpp" #include "random.hpp"
#if defined(_WIN32) #if defined(_WIN32)
......
/* template_instnt.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.
*
* 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
*/
/* Explicit template instantiation requests
*/
#include "integer.hpp" #include "integer.hpp"
#include "rsa.hpp" #include "rsa.hpp"
#include "algebra.hpp" #include "algebra.hpp"
...@@ -6,9 +32,11 @@ ...@@ -6,9 +32,11 @@
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION #ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
namespace TaoCrypt { namespace TaoCrypt {
#if defined(SSE2_INTRINSICS_AVAILABLE) #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); 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 #endif
template class RSA_Decryptor<RSA_BlockType2>; template class RSA_Decryptor<RSA_BlockType2>;
template class RSA_Encryptor<RSA_BlockType1>; template class RSA_Encryptor<RSA_BlockType1>;
template class RSA_Encryptor<RSA_BlockType2>; template class RSA_Encryptor<RSA_BlockType2>;
...@@ -17,10 +45,12 @@ template void tcArrayDelete<byte>(byte*); ...@@ -17,10 +45,12 @@ 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 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 void tcArrayDelete<word>(word*);
template AllocatorWithCleanup<word>::pointer StdReallocate<word, AllocatorWithCleanup<word> >(AllocatorWithCleanup<word>&, word*, AllocatorWithCleanup<word>::size_type, AllocatorWithCleanup<word>::size_type, bool); 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 #ifndef TAOCRYPT_SLOW_WORD64 // defined when word != word32
template void tcArrayDelete<word32>(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); template AllocatorWithCleanup<word32>::pointer StdReallocate<word32, AllocatorWithCleanup<word32> >(AllocatorWithCleanup<word32>&, word32*, AllocatorWithCleanup<word32>::size_type, AllocatorWithCleanup<word32>::size_type, bool);
#endif #endif
template void tcArrayDelete<char>(char*); template void tcArrayDelete<char>(char*);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment