Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0d1bd3b1
Commit
0d1bd3b1
authored
Apr 18, 2006
by
msvensson@shellback.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import from yaSSL upstream
parent
1c4e31d5
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
125 additions
and
49 deletions
+125
-49
extra/yassl/include/openssl/rsa.h
extra/yassl/include/openssl/rsa.h
+1
-1
extra/yassl/include/openssl/ssl.h
extra/yassl/include/openssl/ssl.h
+2
-1
extra/yassl/include/yassl_int.hpp
extra/yassl/include/yassl_int.hpp
+0
-4
extra/yassl/include/yassl_types.hpp
extra/yassl/include/yassl_types.hpp
+5
-0
extra/yassl/mySTL/helpers.hpp
extra/yassl/mySTL/helpers.hpp
+4
-8
extra/yassl/mySTL/list.hpp
extra/yassl/mySTL/list.hpp
+2
-2
extra/yassl/mySTL/vector.hpp
extra/yassl/mySTL/vector.hpp
+2
-1
extra/yassl/src/handshake.cpp
extra/yassl/src/handshake.cpp
+10
-6
extra/yassl/src/socket_wrapper.cpp
extra/yassl/src/socket_wrapper.cpp
+7
-3
extra/yassl/src/ssl.cpp
extra/yassl/src/ssl.cpp
+4
-0
extra/yassl/src/yassl_imp.cpp
extra/yassl/src/yassl_imp.cpp
+1
-0
extra/yassl/src/yassl_int.cpp
extra/yassl/src/yassl_int.cpp
+16
-4
extra/yassl/taocrypt/benchmark/benchmark.cpp
extra/yassl/taocrypt/benchmark/benchmark.cpp
+6
-6
extra/yassl/taocrypt/include/integer.hpp
extra/yassl/taocrypt/include/integer.hpp
+0
-3
extra/yassl/taocrypt/include/misc.hpp
extra/yassl/taocrypt/include/misc.hpp
+11
-1
extra/yassl/taocrypt/include/runtime.hpp
extra/yassl/taocrypt/include/runtime.hpp
+21
-3
extra/yassl/taocrypt/include/types.hpp
extra/yassl/taocrypt/include/types.hpp
+2
-0
extra/yassl/taocrypt/src/algebra.cpp
extra/yassl/taocrypt/src/algebra.cpp
+3
-1
extra/yassl/taocrypt/src/integer.cpp
extra/yassl/taocrypt/src/integer.cpp
+16
-4
extra/yassl/taocrypt/src/misc.cpp
extra/yassl/taocrypt/src/misc.cpp
+0
-1
extra/yassl/taocrypt/src/random.cpp
extra/yassl/taocrypt/src/random.cpp
+3
-0
extra/yassl/taocrypt/src/template_instnt.cpp
extra/yassl/taocrypt/src/template_instnt.cpp
+9
-0
No files found.
extra/yassl/include/openssl/rsa.h
View file @
0d1bd3b1
/* rsa.h for openSSL */
#ifndef y
s
SSL_rsa_h__
#ifndef y
a
SSL_rsa_h__
#define yaSSL_rsa_h__
enum
{
RSA_F4
=
1
};
...
...
extra/yassl/include/openssl/ssl.h
View file @
0d1bd3b1
...
...
@@ -25,7 +25,7 @@
#ifndef y
s
SSL_openssl_h__
#ifndef y
a
SSL_openssl_h__
#define yaSSL_openssl_h__
#include <stdio.h>
/* ERR_print fp */
...
...
@@ -345,6 +345,7 @@ long SSL_CTX_sess_set_cache_size(SSL_CTX*, long);
long
SSL_CTX_set_tmp_dh
(
SSL_CTX
*
,
DH
*
);
void
OpenSSL_add_all_algorithms
(
void
);
void
SSL_library_init
();
void
SSLeay_add_ssl_algorithms
(
void
);
...
...
extra/yassl/include/yassl_int.hpp
View file @
0d1bd3b1
...
...
@@ -121,8 +121,6 @@ public:
friend
sslFactory
&
GetSSL_Factory
();
// singleton creator
private:
static
sslFactory
instance_
;
sslFactory
(
const
sslFactory
&
);
// hide copy
sslFactory
&
operator
=
(
const
sslFactory
&
);
// and assign
};
...
...
@@ -214,8 +212,6 @@ public:
friend
Sessions
&
GetSessions
();
// singleton creator
private:
static
Sessions
instance_
;
Sessions
(
const
Sessions
&
);
// hide copy
Sessions
&
operator
=
(
const
Sessions
&
);
// and assign
};
...
...
extra/yassl/include/yassl_types.hpp
View file @
0d1bd3b1
...
...
@@ -34,6 +34,11 @@
namespace
yaSSL
{
// Delete static singleton memory holders
void
CleanUp
();
#ifdef YASSL_PURE_C
// library allocation
...
...
extra/yassl/mySTL/helpers.hpp
View file @
0d1bd3b1
...
...
@@ -28,14 +28,14 @@
#define mySTL_HELPERS_HPP
#include <stdlib.h>
#i
nclude <new> // placement new
#i
fdef _MSC_VER
#include <new>
#endif
#ifdef __IBMCPP__
/*
Workaround for the lack of operator new(size_t, void*)
in IBM VA C++ 6.0
Also used as a workaround to avoid including <new>
*/
struct
Dummy
{};
...
...
@@ -45,10 +45,6 @@
}
typedef
Dummy
*
yassl_pointer
;
#else
typedef
void
*
yassl_pointer
;
#endif
namespace
mySTL
{
...
...
extra/yassl/mySTL/list.hpp
View file @
0d1bd3b1
...
...
@@ -164,7 +164,7 @@ void list<T>::push_front(T t)
{
void
*
mem
=
malloc
(
sizeof
(
node
));
if
(
!
mem
)
abort
();
node
*
add
=
new
(
mem
)
node
(
t
);
node
*
add
=
new
(
reinterpret_cast
<
yassl_pointer
>
(
mem
)
)
node
(
t
);
if
(
head_
)
{
add
->
next_
=
head_
;
...
...
@@ -210,7 +210,7 @@ void list<T>::push_back(T t)
{
void
*
mem
=
malloc
(
sizeof
(
node
));
if
(
!
mem
)
abort
();
node
*
add
=
new
(
mem
)
node
(
t
);
node
*
add
=
new
(
reinterpret_cast
<
yassl_pointer
>
(
mem
)
)
node
(
t
);
if
(
tail_
)
{
tail_
->
next_
=
add
;
...
...
extra/yassl/mySTL/vector.hpp
View file @
0d1bd3b1
...
...
@@ -45,7 +45,8 @@ struct vector_base {
vector_base
()
:
start_
(
0
),
finish_
(
0
),
end_of_storage_
(
0
)
{}
vector_base
(
size_t
n
)
{
start_
=
static_cast
<
T
*>
(
malloc
(
n
*
sizeof
(
T
)));
// Don't allow malloc(0), if n is 0 use 1
start_
=
static_cast
<
T
*>
(
malloc
((
n
?
n
:
1
)
*
sizeof
(
T
)));
if
(
!
start_
)
abort
();
finish_
=
start_
;
end_of_storage_
=
start_
+
n
;
...
...
extra/yassl/src/handshake.cpp
View file @
0d1bd3b1
...
...
@@ -650,7 +650,6 @@ void build_certHashes(SSL& ssl, Hashes& hashes)
}
mySTL
::
auto_ptr
<
input_buffer
>
null_buffer
(
ysDelete
);
// do process input requests
mySTL
::
auto_ptr
<
input_buffer
>
...
...
@@ -659,7 +658,8 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
// wait for input if blocking
if
(
!
ssl
.
getSocket
().
wait
())
{
ssl
.
SetError
(
receive_error
);
return
buffered
=
null_buffer
;
buffered
.
reset
(
0
);
return
buffered
;
}
uint
ready
=
ssl
.
getSocket
().
get_ready
();
if
(
!
ready
)
return
buffered
;
...
...
@@ -669,10 +669,10 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
input_buffer
buffer
(
buffSz
+
ready
);
if
(
buffSz
)
{
buffer
.
assign
(
buffered
.
get
()
->
get_buffer
(),
buffSz
);
buffered
=
null_buffer
;
buffered
.
reset
(
0
)
;
}
// add
NEW_YS
data
// add
new
data
uint
read
=
ssl
.
getSocket
().
receive
(
buffer
.
get_buffer
()
+
buffSz
,
ready
);
buffer
.
add_size
(
read
);
uint
offset
=
0
;
...
...
@@ -705,11 +705,15 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
mySTL
::
auto_ptr
<
Message
>
msg
(
mf
.
CreateObject
(
hdr
.
type_
),
ysDelete
);
if
(
!
msg
.
get
())
{
ssl
.
SetError
(
factory_error
);
return
buffered
=
null_buffer
;
buffered
.
reset
(
0
);
return
buffered
;
}
buffer
>>
*
msg
;
msg
->
Process
(
buffer
,
ssl
);
if
(
ssl
.
GetError
())
return
buffered
=
null_buffer
;
if
(
ssl
.
GetError
())
{
buffered
.
reset
(
0
);
return
buffered
;
}
}
offset
+=
hdr
.
length_
+
RECORD_HEADER
;
}
...
...
extra/yassl/src/socket_wrapper.cpp
View file @
0d1bd3b1
...
...
@@ -39,7 +39,7 @@
#include <string.h>
#endif // _WIN32
#if
def __sun
#if
defined(__sun) || defined(__SCO_VERSION__)
#include <sys/filio.h>
#endif
...
...
@@ -95,11 +95,15 @@ void Socket::closeSocket()
uint
Socket
::
get_ready
()
const
{
unsigned
long
ready
=
0
;
#ifdef _WIN32
unsigned
long
ready
=
0
;
ioctlsocket
(
socket_
,
FIONREAD
,
&
ready
);
#else
/*
64-bit Solaris requires the variable passed to
FIONREAD be a 32-bit value.
*/
unsigned
int
ready
=
0
;
ioctl
(
socket_
,
FIONREAD
,
&
ready
);
#endif
...
...
extra/yassl/src/ssl.cpp
View file @
0d1bd3b1
...
...
@@ -723,6 +723,10 @@ void OpenSSL_add_all_algorithms() // compatibility only
{}
void
SSL_library_init
()
// compatiblity only
{}
DH
*
DH_new
(
void
)
{
DH
*
dh
=
NEW_YS
DH
;
...
...
extra/yassl/src/yassl_imp.cpp
View file @
0d1bd3b1
...
...
@@ -1329,6 +1329,7 @@ input_buffer& operator>>(input_buffer& input, ClientHello& hello)
// Compression
hello
.
comp_len_
=
input
[
AUTO
];
while
(
hello
.
comp_len_
--
)
// ignore for now
hello
.
compression_methods_
=
CompressionMethod
(
input
[
AUTO
]);
return
input
;
...
...
extra/yassl/src/yassl_int.cpp
View file @
0d1bd3b1
...
...
@@ -1363,19 +1363,31 @@ SSL_SESSION::~SSL_SESSION()
}
Sessions
Sessions
::
instance_
;
// simple singleton
static
Sessions
*
sessionsInstance
=
0
;
Sessions
&
GetSessions
()
{
return
Sessions
::
instance_
;
if
(
!
sessionsInstance
)
sessionsInstance
=
NEW_YS
Sessions
;
return
*
sessionsInstance
;
}
s
slFactory
sslFactory
::
instance_
;
// simple singleton
s
tatic
sslFactory
*
sslFactoryInstance
=
0
;
sslFactory
&
GetSSL_Factory
()
{
return
sslFactory
::
instance_
;
if
(
!
sslFactoryInstance
)
sslFactoryInstance
=
NEW_YS
sslFactory
;
return
*
sslFactoryInstance
;
}
void
CleanUp
()
{
TaoCrypt
::
CleanUp
();
ysDelete
(
sslFactoryInstance
);
ysDelete
(
sessionsInstance
);
}
...
...
extra/yassl/taocrypt/benchmark/benchmark.cpp
View file @
0d1bd3b1
...
...
@@ -284,7 +284,7 @@ void bench_rsa()
double
each
=
total
/
times
;
// per second
double
milliEach
=
each
*
1000
;
// milliseconds
printf
(
"RSA 1024 encryption took
%3
.2f milliseconds, avg over %d"
printf
(
"RSA 1024 encryption took
%6
.2f milliseconds, avg over %d"
" iterations
\n
"
,
milliEach
,
times
);
RSAES_Decryptor
dec
(
priv
);
...
...
@@ -298,7 +298,7 @@ void bench_rsa()
each
=
total
/
times
;
// per second
milliEach
=
each
*
1000
;
// milliseconds
printf
(
"RSA 1024 decryption took %
3
.2f milliseconds, avg over %d"
printf
(
"RSA 1024 decryption took %
6
.2f milliseconds, avg over %d"
" iterations
\n
"
,
milliEach
,
times
);
}
...
...
@@ -329,7 +329,7 @@ void bench_dh()
double
each
=
total
/
times
;
// per second
double
milliEach
=
each
*
1000
;
// milliseconds
printf
(
"DH 1024 key generation
%3
.2f milliseconds, avg over %d"
printf
(
"DH 1024 key generation
%6
.2f milliseconds, avg over %d"
" iterations
\n
"
,
milliEach
,
times
);
DH
dh2
(
dh
);
...
...
@@ -347,7 +347,7 @@ void bench_dh()
each
=
total
/
times
;
// per second
milliEach
=
each
*
1000
;
// in milliseconds
printf
(
"DH 1024 key agreement
%3
.2f milliseconds, avg over %d"
printf
(
"DH 1024 key agreement
%6
.2f milliseconds, avg over %d"
" iterations
\n
"
,
milliEach
,
times
);
}
...
...
@@ -383,7 +383,7 @@ void bench_dsa()
double
each
=
total
/
times
;
// per second
double
milliEach
=
each
*
1000
;
// milliseconds
printf
(
"DSA 1024 sign took
%3
.2f milliseconds, avg over %d"
printf
(
"DSA 1024 sign took
%6
.2f milliseconds, avg over %d"
" iterations
\n
"
,
milliEach
,
times
);
DSA_Verifier
verifier
(
key
);
...
...
@@ -397,7 +397,7 @@ void bench_dsa()
each
=
total
/
times
;
// per second
milliEach
=
each
*
1000
;
// in milliseconds
printf
(
"DSA 1024 verify took
%3
.2f milliseconds, avg over %d"
printf
(
"DSA 1024 verify took
%6
.2f milliseconds, avg over %d"
" iterations
\n
"
,
milliEach
,
times
);
}
...
...
extra/yassl/taocrypt/include/integer.hpp
View file @
0d1bd3b1
...
...
@@ -274,9 +274,6 @@ private:
Integer
&
dividend
,
const
Integer
&
divisor
);
AlignedWordBlock
reg_
;
Sign
sign_
;
static
const
Integer
zero_
;
static
const
Integer
one_
;
};
inline
bool
operator
==
(
const
Integer
&
a
,
const
Integer
&
b
)
...
...
extra/yassl/taocrypt/include/misc.hpp
View file @
0d1bd3b1
...
...
@@ -40,6 +40,11 @@
namespace
TaoCrypt
{
// Delete static singleton holders
void
CleanUp
();
#ifdef YASSL_PURE_C
// library allocation
...
...
@@ -123,7 +128,12 @@ namespace TaoCrypt {
// no gas on these systems ?, disable for now
#if defined(__sun__) || defined (__QNX__)
#if defined(__sun__) || defined (__QNX__) || defined (__APPLE__)
#define TAOCRYPT_DISABLE_X86ASM
#endif
// icc problem with -03 and integer, disable for now
#if defined(__INTEL_COMPILER)
#define TAOCRYPT_DISABLE_X86ASM
#endif
...
...
extra/yassl/taocrypt/include/runtime.hpp
View file @
0d1bd3b1
...
...
@@ -25,10 +25,27 @@
#if !defined(yaSSL_NEW_HPP) && defined(__GNUC__) && !defined(__ICC)
#ifndef yaSSL_NEW_HPP
#define yaSSL_NEW_HPP
#ifdef __sun
#include <assert.h>
// Handler for pure virtual functions
namespace
__Crun
{
static
void
pure_error
(
void
)
{
assert
(
"Pure virtual method called."
==
"Aborted"
);
}
}
// namespace __Crun
#endif // __sun
#if defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
#if __GNUC__ > 2
extern
"C"
{
...
...
@@ -50,5 +67,6 @@ static int __cxa_pure_virtual()
}
// extern "C"
#endif // __GNUC__ > 2
#endif // yaSSL_NEW_HPP && __GNUC__
#endif // compiler check
#endif // yaSSL_NEW_HPP
extra/yassl/taocrypt/include/types.hpp
View file @
0d1bd3b1
...
...
@@ -61,7 +61,9 @@ typedef unsigned int word32;
// compilers we've found 64-bit multiply insructions for
#if defined(__GNUC__) || defined(_MSC_VER) || defined(__DECCXX)
#if !(defined(__ICC) || defined(__INTEL_COMPILER))
#define HAVE_64_MULTIPLY
#endif
#endif
...
...
extra/yassl/taocrypt/src/algebra.cpp
View file @
0d1bd3b1
...
...
@@ -78,7 +78,9 @@ const Integer& AbstractEuclideanDomain::Mod(const Element &a,
const
Integer
&
AbstractEuclideanDomain
::
Gcd
(
const
Element
&
a
,
const
Element
&
b
)
const
{
Element
g
[
3
]
=
{
b
,
a
};
mySTL
::
vector
<
Element
>
g
(
3
);
g
[
0
]
=
b
;
g
[
1
]
=
a
;
unsigned
int
i0
=
0
,
i1
=
1
,
i2
=
2
;
while
(
!
Equal
(
g
[
i1
],
this
->
Identity
()))
...
...
extra/yassl/taocrypt/src/integer.cpp
View file @
0d1bd3b1
...
...
@@ -2709,22 +2709,34 @@ unsigned int Integer::Encode(byte* output, unsigned int outputLen,
}
const
Integer
Integer
::
zero_
;
static
Integer
*
zero
=
0
;
const
Integer
&
Integer
::
Zero
()
{
return
zero_
;
if
(
!
zero
)
zero
=
NEW_TC
Integer
;
return
*
zero
;
}
const
Integer
Integer
::
one_
(
1
,
2
)
;
static
Integer
*
one
=
0
;
const
Integer
&
Integer
::
One
()
{
return
one_
;
if
(
!
one
)
one
=
NEW_TC
Integer
(
1
,
2
);
return
*
one
;
}
// Clean up static singleton holders, not a leak, but helpful to have gone
// when checking for leaks
void
CleanUp
()
{
tcDelete
(
one
);
tcDelete
(
zero
);
}
Integer
::
Integer
(
RandomNumberGenerator
&
rng
,
const
Integer
&
min
,
const
Integer
&
max
)
{
...
...
extra/yassl/taocrypt/src/misc.cpp
View file @
0d1bd3b1
...
...
@@ -24,7 +24,6 @@
#include "runtime.hpp"
#include "misc.hpp"
#include <new> // for NewHandler
#ifdef YASSL_PURE_C
...
...
extra/yassl/taocrypt/src/random.cpp
View file @
0d1bd3b1
...
...
@@ -97,8 +97,11 @@ void OS_Seed::GenerateSeed(byte* output, word32 sz)
OS_Seed
::
OS_Seed
()
{
fd_
=
open
(
"/dev/urandom"
,
O_RDONLY
);
if
(
fd_
==
-
1
)
{
fd_
=
open
(
"/dev/random"
,
O_RDONLY
);
if
(
fd_
==
-
1
)
error_
.
SetError
(
OPEN_RAN_E
);
}
}
...
...
extra/yassl/taocrypt/src/template_instnt.cpp
View file @
0d1bd3b1
...
...
@@ -24,8 +24,13 @@
*/
#include "runtime.hpp"
#include "integer.hpp"
#include "rsa.hpp"
#include "sha.hpp"
#include "md5.hpp"
#include "hmac.hpp"
#include "pwdbased.hpp"
#include "algebra.hpp"
#include "vector.hpp"
#include "hash.hpp"
...
...
@@ -52,6 +57,10 @@ template AllocatorWithCleanup<word32>::pointer StdReallocate<word32, AllocatorWi
#endif
template
void
tcArrayDelete
<
char
>(
char
*
);
template
class
PBKDF2_HMAC
<
SHA
>;
template
class
HMAC
<
MD5
>;
template
class
HMAC
<
SHA
>;
}
namespace
mySTL
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment