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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a3fe8602
Commit
a3fe8602
authored
Jun 01, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/svoj/devel/mysql/yassl-mysql-5.0
parents
99db091f
a44ac5b2
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
790 additions
and
454 deletions
+790
-454
extra/yassl/include/buffer.hpp
extra/yassl/include/buffer.hpp
+2
-1
extra/yassl/include/crypto_wrapper.hpp
extra/yassl/include/crypto_wrapper.hpp
+3
-3
extra/yassl/include/socket_wrapper.hpp
extra/yassl/include/socket_wrapper.hpp
+1
-1
extra/yassl/include/yassl_imp.hpp
extra/yassl/include/yassl_imp.hpp
+5
-5
extra/yassl/include/yassl_types.hpp
extra/yassl/include/yassl_types.hpp
+45
-0
extra/yassl/mySTL/helpers.hpp
extra/yassl/mySTL/helpers.hpp
+1
-0
extra/yassl/mySTL/list.hpp
extra/yassl/mySTL/list.hpp
+17
-15
extra/yassl/mySTL/memory.hpp
extra/yassl/mySTL/memory.hpp
+27
-14
extra/yassl/mySTL/vector.hpp
extra/yassl/mySTL/vector.hpp
+3
-4
extra/yassl/src/Makefile.am
extra/yassl/src/Makefile.am
+1
-1
extra/yassl/src/buffer.cpp
extra/yassl/src/buffer.cpp
+9
-10
extra/yassl/src/cert_wrapper.cpp
extra/yassl/src/cert_wrapper.cpp
+8
-9
extra/yassl/src/crypto_wrapper.cpp
extra/yassl/src/crypto_wrapper.cpp
+67
-47
extra/yassl/src/handshake.cpp
extra/yassl/src/handshake.cpp
+21
-21
extra/yassl/src/lock.cpp
extra/yassl/src/lock.cpp
+0
-1
extra/yassl/src/log.cpp
extra/yassl/src/log.cpp
+0
-1
extra/yassl/src/socket_wrapper.cpp
extra/yassl/src/socket_wrapper.cpp
+0
-1
extra/yassl/src/ssl.cpp
extra/yassl/src/ssl.cpp
+17
-18
extra/yassl/src/template_instnt.cpp
extra/yassl/src/template_instnt.cpp
+67
-0
extra/yassl/src/timer.cpp
extra/yassl/src/timer.cpp
+0
-1
extra/yassl/src/yassl_error.cpp
extra/yassl/src/yassl_error.cpp
+0
-1
extra/yassl/src/yassl_imp.cpp
extra/yassl/src/yassl_imp.cpp
+55
-79
extra/yassl/src/yassl_int.cpp
extra/yassl/src/yassl_int.cpp
+87
-59
extra/yassl/taocrypt/include/algebra.hpp
extra/yassl/taocrypt/include/algebra.hpp
+3
-3
extra/yassl/taocrypt/include/asn.hpp
extra/yassl/taocrypt/include/asn.hpp
+3
-3
extra/yassl/taocrypt/include/block.hpp
extra/yassl/taocrypt/include/block.hpp
+2
-2
extra/yassl/taocrypt/include/hash.hpp
extra/yassl/taocrypt/include/hash.hpp
+4
-4
extra/yassl/taocrypt/include/integer.hpp
extra/yassl/taocrypt/include/integer.hpp
+5
-6
extra/yassl/taocrypt/include/misc.hpp
extra/yassl/taocrypt/include/misc.hpp
+42
-58
extra/yassl/taocrypt/include/modes.hpp
extra/yassl/taocrypt/include/modes.hpp
+1
-1
extra/yassl/taocrypt/include/runtime.hpp
extra/yassl/taocrypt/include/runtime.hpp
+0
-24
extra/yassl/taocrypt/include/type_traits.hpp
extra/yassl/taocrypt/include/type_traits.hpp
+80
-0
extra/yassl/taocrypt/include/types.hpp
extra/yassl/taocrypt/include/types.hpp
+99
-0
extra/yassl/taocrypt/src/Makefile.am
extra/yassl/taocrypt/src/Makefile.am
+2
-1
extra/yassl/taocrypt/src/aestables.cpp
extra/yassl/taocrypt/src/aestables.cpp
+0
-1
extra/yassl/taocrypt/src/algebra.cpp
extra/yassl/taocrypt/src/algebra.cpp
+0
-2
extra/yassl/taocrypt/src/arc4.cpp
extra/yassl/taocrypt/src/arc4.cpp
+0
-1
extra/yassl/taocrypt/src/asn.cpp
extra/yassl/taocrypt/src/asn.cpp
+15
-15
extra/yassl/taocrypt/src/coding.cpp
extra/yassl/taocrypt/src/coding.cpp
+0
-1
extra/yassl/taocrypt/src/dh.cpp
extra/yassl/taocrypt/src/dh.cpp
+0
-1
extra/yassl/taocrypt/src/dsa.cpp
extra/yassl/taocrypt/src/dsa.cpp
+0
-1
extra/yassl/taocrypt/src/file.cpp
extra/yassl/taocrypt/src/file.cpp
+0
-1
extra/yassl/taocrypt/src/integer.cpp
extra/yassl/taocrypt/src/integer.cpp
+7
-17
extra/yassl/taocrypt/src/misc.cpp
extra/yassl/taocrypt/src/misc.cpp
+60
-1
extra/yassl/taocrypt/src/random.cpp
extra/yassl/taocrypt/src/random.cpp
+0
-1
extra/yassl/taocrypt/src/rsa.cpp
extra/yassl/taocrypt/src/rsa.cpp
+0
-18
extra/yassl/taocrypt/src/template_instnt.cpp
extra/yassl/taocrypt/src/template_instnt.cpp
+31
-0
No files found.
extra/yassl/include/buffer.hpp
View file @
a3fe8602
...
...
@@ -28,6 +28,7 @@
#define yaSSL_BUFFER_HPP
#include <assert.h> // assert
#include "yassl_types.hpp" // ysDelete
#include "yassl_error.hpp" // Error
#include "memory.hpp" // mySTL::auto_ptr
#include "algorithm.hpp" // mySTL::swap
...
...
@@ -183,7 +184,7 @@ inline void checked_delete(T* p)
{
typedef
char
complete_type
[
sizeof
(
T
)
?
1
:
-
1
];
(
void
)
sizeof
(
complete_type
);
delete
p
;
ysDelete
(
p
)
;
}
...
...
extra/yassl/include/crypto_wrapper.hpp
View file @
a3fe8602
...
...
@@ -43,7 +43,7 @@ namespace yaSSL {
// Digest policy should implement a get_digest, update, and get sizes for pad and
// digest
struct
Digest
{
struct
Digest
:
public
virtual_base
{
virtual
void
get_digest
(
byte
*
)
=
0
;
virtual
void
get_digest
(
byte
*
,
const
byte
*
,
unsigned
int
)
=
0
;
virtual
void
update
(
const
byte
*
,
unsigned
int
)
=
0
;
...
...
@@ -178,7 +178,7 @@ private:
// BulkCipher policy should implement encrypt, decrypt, get block size,
// and set keys for encrypt and decrypt
struct
BulkCipher
{
struct
BulkCipher
:
public
virtual_base
{
virtual
void
encrypt
(
byte
*
,
const
byte
*
,
unsigned
int
)
=
0
;
virtual
void
decrypt
(
byte
*
,
const
byte
*
,
unsigned
int
)
=
0
;
virtual
void
set_encryptKey
(
const
byte
*
,
const
byte
*
=
0
)
=
0
;
...
...
@@ -308,7 +308,7 @@ private:
// Authentication policy should implement sign, and verify
struct
Auth
{
struct
Auth
:
public
virtual_base
{
virtual
void
sign
(
byte
*
,
const
byte
*
,
unsigned
int
,
const
RandomPool
&
)
=
0
;
virtual
bool
verify
(
const
byte
*
,
unsigned
int
,
const
byte
*
,
unsigned
int
)
=
0
;
...
...
extra/yassl/include/socket_wrapper.hpp
View file @
a3fe8602
...
...
@@ -68,7 +68,7 @@ class Socket {
socket_t
socket_
;
// underlying socket descriptor
public:
explicit
Socket
(
socket_t
s
=
INVALID_SOCKET
);
virtual
~
Socket
();
~
Socket
();
void
set_fd
(
socket_t
s
);
uint
get_ready
()
const
;
...
...
extra/yassl/include/yassl_imp.hpp
View file @
a3fe8602
...
...
@@ -63,7 +63,7 @@ struct RecordLayerHeader {
// base for all messages
struct
Message
{
struct
Message
:
public
virtual_base
{
virtual
input_buffer
&
set
(
input_buffer
&
)
=
0
;
virtual
output_buffer
&
get
(
output_buffer
&
)
const
=
0
;
...
...
@@ -175,7 +175,7 @@ private:
// Base Class for all handshake messages
class
HandShakeBase
{
class
HandShakeBase
:
public
virtual_base
{
int
length_
;
public:
int
get_length
()
const
;
...
...
@@ -327,7 +327,7 @@ private:
};
struct
ServerKeyBase
{
struct
ServerKeyBase
:
public
virtual_base
{
virtual
~
ServerKeyBase
()
{}
virtual
void
build
(
SSL
&
)
{}
virtual
void
read
(
SSL
&
,
input_buffer
&
)
{}
...
...
@@ -342,7 +342,7 @@ struct Fortezza_Server : public ServerKeyBase {
};
struct
SignatureBase
{
struct
SignatureBase
:
public
virtual_base
{
virtual
~
SignatureBase
()
{}
};
...
...
@@ -461,7 +461,7 @@ struct PreMasterSecret {
};
struct
ClientKeyBase
{
struct
ClientKeyBase
:
public
virtual_base
{
virtual
~
ClientKeyBase
()
{}
virtual
void
build
(
SSL
&
)
{}
virtual
void
read
(
SSL
&
,
input_buffer
&
)
{}
...
...
extra/yassl/include/yassl_types.hpp
View file @
a3fe8602
...
...
@@ -28,10 +28,55 @@
#define yaSSL_TYPES_HPP
#include <stddef.h>
#include <assert.h>
#include "type_traits.hpp"
namespace
yaSSL
{
// library allocation
struct
new_t
{};
// yaSSL New type
extern
new_t
ys
;
// pass in parameter
}
// namespace yaSSL
void
*
operator
new
(
size_t
,
yaSSL
::
new_t
);
void
*
operator
new
[](
size_t
,
yaSSL
::
new_t
);
void
operator
delete
(
void
*
,
yaSSL
::
new_t
);
void
operator
delete
[](
void
*
,
yaSSL
::
new_t
);
namespace
yaSSL
{
template
<
typename
T
>
void
ysDelete
(
T
*
ptr
)
{
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
);
::
operator
delete
[](
ptr
,
yaSSL
::
ys
);
}
// to resolve compiler generated operator delete on base classes with
// virtual destructors, make sure doesn't get called
class
virtual_base
{
public:
static
void
operator
delete
(
void
*
)
{
assert
(
0
);
}
};
typedef
unsigned
char
uint8
;
typedef
unsigned
short
uint16
;
...
...
extra/yassl/mySTL/helpers.hpp
View file @
a3fe8602
...
...
@@ -28,6 +28,7 @@
#define mySTL_HELPERS_HPP
#include <stdlib.h>
#include <new> // placement new
#ifdef __IBMCPP__
...
...
extra/yassl/mySTL/list.hpp
View file @
a3fe8602
...
...
@@ -29,7 +29,7 @@
#include "helpers.hpp"
#include <
new> // ::operator new and delete, placement too
#include <
stdlib.h>
namespace
mySTL
{
...
...
@@ -38,13 +38,15 @@ namespace mySTL {
template
<
typename
T
>
class
list
{
#ifdef __SUNPRO_CC
/*
Sun Forte 7 C++ v. 5.4 needs class 'node' be
public to be visible to
the nested class 'iterator' (a non-standard behaviour).
Sun Forte 7 C++ v. 5.4 needs class 'node'
public to be visible to
the nested class 'iterator' (a non-standard behaviour).
*/
public:
#endif
struct
node
{
node
(
T
t
)
:
prev_
(
0
),
next_
(
0
),
value_
(
t
)
{}
...
...
@@ -94,22 +96,22 @@ public:
return
*
this
;
}
iterator
&
operator
++
(
int
)
iterator
operator
++
(
int
)
{
iterator
tmp
=
*
this
;
current_
=
current_
->
next_
;
return
*
this
;
return
tmp
;
}
iterator
&
operator
--
(
int
)
iterator
operator
--
(
int
)
{
iterator
tmp
=
*
this
;
current_
=
current_
->
prev_
;
return
*
this
;
return
tmp
;
}
bool
operator
==
(
const
iterator
&
other
)
const
{
{
return
current_
==
other
.
current_
;
}
...
...
@@ -152,7 +154,7 @@ list<T>::~list()
for
(;
start
;
start
=
next_
)
{
next_
=
start
->
next_
;
destroy
(
start
);
::
operator
delet
e
(
start
);
fre
e
(
start
);
}
}
...
...
@@ -160,7 +162,7 @@ list<T>::~list()
template
<
typename
T
>
void
list
<
T
>::
push_front
(
T
t
)
{
void
*
mem
=
::
operator
new
(
sizeof
(
node
));
void
*
mem
=
malloc
(
sizeof
(
node
));
if
(
!
mem
)
abort
();
node
*
add
=
new
(
mem
)
node
(
t
);
...
...
@@ -190,7 +192,7 @@ void list<T>::pop_front()
head_
->
prev_
=
0
;
}
destroy
(
front
);
::
operator
delet
e
(
front
);
fre
e
(
front
);
--
sz_
;
}
...
...
@@ -206,7 +208,7 @@ T list<T>::front() const
template
<
typename
T
>
void
list
<
T
>::
push_back
(
T
t
)
{
void
*
mem
=
::
operator
new
(
sizeof
(
node
));
void
*
mem
=
malloc
(
sizeof
(
node
));
if
(
!
mem
)
abort
();
node
*
add
=
new
(
mem
)
node
(
t
);
...
...
@@ -236,7 +238,7 @@ void list<T>::pop_back()
tail_
->
next_
=
0
;
}
destroy
(
rear
);
::
operator
delet
e
(
rear
);
fre
e
(
rear
);
--
sz_
;
}
...
...
@@ -280,7 +282,7 @@ bool list<T>::remove(T t)
del
->
next_
->
prev_
=
del
->
prev_
;
destroy
(
del
);
::
operator
delet
e
(
del
);
fre
e
(
del
);
--
sz_
;
}
return
true
;
...
...
@@ -303,7 +305,7 @@ bool list<T>::erase(iterator iter)
del
->
next_
->
prev_
=
del
->
prev_
;
destroy
(
del
);
::
operator
delet
e
(
del
);
fre
e
(
del
);
--
sz_
;
}
return
true
;
...
...
extra/yassl/mySTL/memory.hpp
View file @
a3fe8602
...
...
@@ -37,30 +37,42 @@
namespace
mySTL
{
template
<
typename
T
>
template
<
typename
T
,
typename
Deletor
=
void
(
*
)
(
T
*
)
>
struct
auto_ptr_ref
{
T
*
ptr_
;
explicit
auto_ptr_ref
(
T
*
p
)
:
ptr_
(
p
)
{}
T
*
ptr_
;
Deletor
del_
;
auto_ptr_ref
(
T
*
p
,
Deletor
d
)
:
ptr_
(
p
),
del_
(
d
)
{}
};
template
<
typename
T
>
template
<
typename
T
,
typename
Deletor
=
void
(
*
)
(
T
*
)
>
class
auto_ptr
{
T
*
ptr_
;
T
*
ptr_
;
Deletor
del_
;
void
Destroy
()
{
del_
(
ptr_
);
}
public:
explicit
auto_ptr
(
T
*
p
=
0
)
:
ptr_
(
p
)
{}
auto_ptr
(
T
*
p
,
Deletor
d
)
:
ptr_
(
p
),
del_
(
d
)
{}
explicit
auto_ptr
(
Deletor
d
)
:
ptr_
(
0
),
del_
(
d
)
{}
~
auto_ptr
()
{
delete
ptr_
;
Destroy
()
;
}
auto_ptr
(
auto_ptr
&
other
)
:
ptr_
(
other
.
release
())
{}
auto_ptr
(
auto_ptr
&
other
)
:
ptr_
(
other
.
release
()),
del_
(
other
.
del_
)
{}
auto_ptr
&
operator
=
(
auto_ptr
&
that
)
{
if
(
this
!=
&
that
)
{
delete
ptr_
;
Destroy
()
;
ptr_
=
that
.
release
();
del_
=
that
.
del_
;
}
return
*
this
;
}
...
...
@@ -91,19 +103,20 @@ public:
void
reset
(
T
*
p
=
0
)
{
if
(
ptr_
!=
p
)
{
delete
ptr_
;
Destroy
()
;
ptr_
=
p
;
}
}
// auto_ptr_ref conversions
auto_ptr
(
auto_ptr_ref
<
T
>
ref
)
:
ptr_
(
ref
.
ptr_
)
{}
auto_ptr
(
auto_ptr_ref
<
T
>
ref
)
:
ptr_
(
ref
.
ptr_
)
,
del_
(
ref
.
del_
)
{}
auto_ptr
&
operator
=
(
auto_ptr_ref
<
T
>
ref
)
{
if
(
this
->
ptr_
!=
ref
.
ptr_
)
{
delete
ptr_
;
Destroy
()
;
ptr_
=
ref
.
ptr_
;
del_
=
ref
.
del_
;
}
return
*
this
;
}
...
...
@@ -111,13 +124,13 @@ public:
template
<
typename
T2
>
operator
auto_ptr
<
T2
>
()
{
return
auto_ptr
<
T2
>
(
this
->
release
());
return
auto_ptr
<
T2
>
(
this
->
release
()
,
this
->
del_
);
}
template
<
typename
T2
>
operator
auto_ptr_ref
<
T2
>
()
{
return
auto_ptr_ref
<
T2
>
(
this
->
release
());
return
auto_ptr_ref
<
T2
>
(
this
->
release
()
,
this
->
del_
);
}
};
...
...
extra/yassl/mySTL/vector.hpp
View file @
a3fe8602
...
...
@@ -27,11 +27,10 @@
#ifndef mySTL_VECTOR_HPP
#define mySTL_VECTOR_HPP
#include "helpers.hpp" // construct, destory, fill, etc.
#include "algorithm.hpp" // swap
#include <new> // ::operator new and delete, placement too
#include <assert.h> // assert
#include <stdlib.h> // malloc
namespace
mySTL
{
...
...
@@ -46,13 +45,13 @@ struct vector_base {
vector_base
()
:
start_
(
0
),
finish_
(
0
),
end_of_storage_
(
0
)
{}
vector_base
(
size_t
n
)
{
start_
=
static_cast
<
T
*>
(
::
operator
new
(
n
*
sizeof
(
T
)));
start_
=
static_cast
<
T
*>
(
malloc
(
n
*
sizeof
(
T
)));
if
(
!
start_
)
abort
();
finish_
=
start_
;
end_of_storage_
=
start_
+
n
;
}
~
vector_base
()
{
::
operator
delet
e
(
start_
);
}
~
vector_base
()
{
if
(
start_
)
fre
e
(
start_
);
}
void
Swap
(
vector_base
&
that
)
{
...
...
extra/yassl/src/Makefile.am
View file @
a3fe8602
...
...
@@ -3,5 +3,5 @@ INCLUDES = -I../include -I../taocrypt/include -I../mySTL
noinst_LIBRARIES
=
libyassl.a
libyassl_a_SOURCES
=
buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp
\
handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp
\
timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
t
emplate_instnt.cpp t
imer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST
=
../include/
*
.hpp ../include/openssl/
*
.h
extra/yassl/src/buffer.cpp
View file @
a3fe8602
...
...
@@ -24,7 +24,6 @@
* with SSL types and sockets
*/
#include "runtime.hpp"
#include "buffer.hpp"
#include "yassl_types.hpp"
...
...
@@ -62,13 +61,13 @@ input_buffer::input_buffer()
input_buffer
::
input_buffer
(
uint
s
)
:
size_
(
0
),
current_
(
0
),
buffer_
(
new
byte
[
s
]),
end_
(
buffer_
+
s
)
:
size_
(
0
),
current_
(
0
),
buffer_
(
new
(
ys
)
byte
[
s
]),
end_
(
buffer_
+
s
)
{}
// with assign
input_buffer
::
input_buffer
(
uint
s
,
const
byte
*
t
,
uint
len
)
:
size_
(
0
),
current_
(
0
),
buffer_
(
new
byte
[
s
]),
end_
(
buffer_
+
s
)
:
size_
(
0
),
current_
(
0
),
buffer_
(
new
(
ys
)
byte
[
s
]),
end_
(
buffer_
+
s
)
{
assign
(
t
,
len
);
}
...
...
@@ -76,7 +75,7 @@ input_buffer::input_buffer(uint s, const byte* t, uint len)
input_buffer
::~
input_buffer
()
{
delete
[]
buffer_
;
ysArrayDelete
(
buffer_
)
;
}
...
...
@@ -84,7 +83,7 @@ input_buffer::~input_buffer()
void
input_buffer
::
allocate
(
uint
s
)
{
assert
(
!
buffer_
);
// find realloc error
buffer_
=
new
byte
[
s
];
buffer_
=
new
(
ys
)
byte
[
s
];
end_
=
buffer_
+
s
;
}
...
...
@@ -96,7 +95,7 @@ byte* input_buffer::get_buffer() const
}
// after a raw write user can set new size
// after a raw write user can set new
(ys)
size
// if you know the size before the write use assign()
void
input_buffer
::
add_size
(
uint
i
)
{
...
...
@@ -198,13 +197,13 @@ output_buffer::output_buffer()
// with allocate
output_buffer
::
output_buffer
(
uint
s
)
:
current_
(
0
),
buffer_
(
new
byte
[
s
]),
end_
(
buffer_
+
s
)
:
current_
(
0
),
buffer_
(
new
(
ys
)
byte
[
s
]),
end_
(
buffer_
+
s
)
{}
// with assign
output_buffer
::
output_buffer
(
uint
s
,
const
byte
*
t
,
uint
len
)
:
current_
(
0
),
buffer_
(
new
byte
[
s
]),
end_
(
buffer_
+
s
)
:
current_
(
0
),
buffer_
(
new
(
ys
)
byte
[
s
]),
end_
(
buffer_
+
s
)
{
write
(
t
,
len
);
}
...
...
@@ -212,7 +211,7 @@ output_buffer::output_buffer(uint s, const byte* t, uint len)
output_buffer
::~
output_buffer
()
{
delete
[]
buffer_
;
ysArrayDelete
(
buffer_
)
;
}
...
...
@@ -239,7 +238,7 @@ void output_buffer::set_current(uint c)
void
output_buffer
::
allocate
(
uint
s
)
{
assert
(
!
buffer_
);
// find realloc error
buffer_
=
new
byte
[
s
];
end_
=
buffer_
+
s
;
buffer_
=
new
(
ys
)
byte
[
s
];
end_
=
buffer_
+
s
;
}
...
...
extra/yassl/src/cert_wrapper.cpp
View file @
a3fe8602
...
...
@@ -24,7 +24,6 @@
*
*/
#include "runtime.hpp"
#include "cert_wrapper.hpp"
#include "yassl_int.hpp"
...
...
@@ -39,19 +38,19 @@
namespace
yaSSL
{
x509
::
x509
(
uint
sz
)
:
length_
(
sz
),
buffer_
(
new
opaque
[
sz
])
x509
::
x509
(
uint
sz
)
:
length_
(
sz
),
buffer_
(
new
(
ys
)
opaque
[
sz
])
{
}
x509
::~
x509
()
{
delete
[]
buffer_
;
ysArrayDelete
(
buffer_
)
;
}
x509
::
x509
(
const
x509
&
that
)
:
length_
(
that
.
length_
),
buffer_
(
new
opaque
[
length_
])
buffer_
(
new
(
ys
)
opaque
[
length_
])
{
memcpy
(
buffer_
,
that
.
buffer_
,
length_
);
}
...
...
@@ -98,7 +97,7 @@ CertManager::CertManager()
CertManager
::~
CertManager
()
{
delete
peerX509_
;
ysDelete
(
peerX509_
)
;
mySTL
::
for_each
(
signers_
.
begin
(),
signers_
.
end
(),
del_ptr_zero
())
;
...
...
@@ -153,7 +152,7 @@ void CertManager::AddPeerCert(x509* x)
void
CertManager
::
CopySelfCert
(
const
x509
*
x
)
{
if
(
x
)
list_
.
push_back
(
new
x509
(
*
x
));
list_
.
push_back
(
new
(
ys
)
x509
(
*
x
));
}
...
...
@@ -165,7 +164,7 @@ int CertManager::CopyCaCert(const x509* x)
if
(
!
cert
.
GetError
().
What
())
{
const
TaoCrypt
::
PublicKey
&
key
=
cert
.
GetPublicKey
();
signers_
.
push_back
(
new
TaoCrypt
::
Signer
(
key
.
GetKey
(),
key
.
size
(),
signers_
.
push_back
(
new
(
ys
)
TaoCrypt
::
Signer
(
key
.
GetKey
(),
key
.
size
(),
cert
.
GetCommonName
(),
cert
.
GetHash
()));
}
return
cert
.
GetError
().
What
();
...
...
@@ -234,7 +233,7 @@ int CertManager::Validate()
return
err
;
const
TaoCrypt
::
PublicKey
&
key
=
cert
.
GetPublicKey
();
signers_
.
push_back
(
new
TaoCrypt
::
Signer
(
key
.
GetKey
(),
key
.
size
(),
signers_
.
push_back
(
new
(
ys
)
TaoCrypt
::
Signer
(
key
.
GetKey
(),
key
.
size
(),
cert
.
GetCommonName
(),
cert
.
GetHash
()));
--
last
;
--
count
;
...
...
@@ -259,7 +258,7 @@ int CertManager::Validate()
int
iSz
=
cert
.
GetIssuer
()
?
strlen
(
cert
.
GetIssuer
())
+
1
:
0
;
int
sSz
=
cert
.
GetCommonName
()
?
strlen
(
cert
.
GetCommonName
())
+
1
:
0
;
peerX509_
=
new
X509
(
cert
.
GetIssuer
(),
iSz
,
cert
.
GetCommonName
(),
peerX509_
=
new
(
ys
)
X509
(
cert
.
GetIssuer
(),
iSz
,
cert
.
GetCommonName
(),
sSz
);
}
return
0
;
...
...
extra/yassl/src/crypto_wrapper.cpp
View file @
a3fe8602
...
...
@@ -58,13 +58,13 @@ struct MD5::MD5Impl {
};
MD5
::
MD5
()
:
pimpl_
(
new
MD5Impl
)
{}
MD5
::
MD5
()
:
pimpl_
(
new
(
ys
)
MD5Impl
)
{}
MD5
::~
MD5
()
{
delete
pimpl_
;
}
MD5
::~
MD5
()
{
ysDelete
(
pimpl_
)
;
}
MD5
::
MD5
(
const
MD5
&
that
)
:
Digest
(),
pimpl_
(
new
MD5
::
MD5
(
const
MD5
&
that
)
:
Digest
(),
pimpl_
(
new
(
ys
)
MD5Impl
(
that
.
pimpl_
->
md5_
))
{}
...
...
@@ -116,13 +116,13 @@ struct SHA::SHAImpl {
};
SHA
::
SHA
()
:
pimpl_
(
new
SHAImpl
)
{}
SHA
::
SHA
()
:
pimpl_
(
new
(
ys
)
SHAImpl
)
{}
SHA
::~
SHA
()
{
delete
pimpl_
;
}
SHA
::~
SHA
()
{
ysDelete
(
pimpl_
)
;
}
SHA
::
SHA
(
const
SHA
&
that
)
:
Digest
(),
pimpl_
(
new
SHAImpl
(
that
.
pimpl_
->
sha_
))
{}
SHA
::
SHA
(
const
SHA
&
that
)
:
Digest
(),
pimpl_
(
new
(
ys
)
SHAImpl
(
that
.
pimpl_
->
sha_
))
{}
SHA
&
SHA
::
operator
=
(
const
SHA
&
that
)
{
...
...
@@ -173,13 +173,13 @@ struct RMD::RMDImpl {
};
RMD
::
RMD
()
:
pimpl_
(
new
RMDImpl
)
{}
RMD
::
RMD
()
:
pimpl_
(
new
(
ys
)
RMDImpl
)
{}
RMD
::~
RMD
()
{
delete
pimpl_
;
}
RMD
::~
RMD
()
{
ysDelete
(
pimpl_
)
;
}
RMD
::
RMD
(
const
RMD
&
that
)
:
Digest
(),
pimpl_
(
new
RMDImpl
(
that
.
pimpl_
->
rmd_
))
{}
RMD
::
RMD
(
const
RMD
&
that
)
:
Digest
(),
pimpl_
(
new
(
ys
)
RMDImpl
(
that
.
pimpl_
->
rmd_
))
{}
RMD
&
RMD
::
operator
=
(
const
RMD
&
that
)
{
...
...
@@ -230,13 +230,13 @@ struct HMAC_MD5::HMAC_MD5Impl {
HMAC_MD5
::
HMAC_MD5
(
const
byte
*
secret
,
unsigned
int
len
)
:
pimpl_
(
new
HMAC_MD5Impl
)
:
pimpl_
(
new
(
ys
)
HMAC_MD5Impl
)
{
pimpl_
->
mac_
.
SetKey
(
secret
,
len
);
}
HMAC_MD5
::~
HMAC_MD5
()
{
delete
pimpl_
;
}
HMAC_MD5
::~
HMAC_MD5
()
{
ysDelete
(
pimpl_
)
;
}
uint
HMAC_MD5
::
get_digestSize
()
const
...
...
@@ -280,13 +280,13 @@ struct HMAC_SHA::HMAC_SHAImpl {
HMAC_SHA
::
HMAC_SHA
(
const
byte
*
secret
,
unsigned
int
len
)
:
pimpl_
(
new
HMAC_SHAImpl
)
:
pimpl_
(
new
(
ys
)
HMAC_SHAImpl
)
{
pimpl_
->
mac_
.
SetKey
(
secret
,
len
);
}
HMAC_SHA
::~
HMAC_SHA
()
{
delete
pimpl_
;
}
HMAC_SHA
::~
HMAC_SHA
()
{
ysDelete
(
pimpl_
)
;
}
uint
HMAC_SHA
::
get_digestSize
()
const
...
...
@@ -331,13 +331,13 @@ struct HMAC_RMD::HMAC_RMDImpl {
HMAC_RMD
::
HMAC_RMD
(
const
byte
*
secret
,
unsigned
int
len
)
:
pimpl_
(
new
HMAC_RMDImpl
)
:
pimpl_
(
new
(
ys
)
HMAC_RMDImpl
)
{
pimpl_
->
mac_
.
SetKey
(
secret
,
len
);
}
HMAC_RMD
::~
HMAC_RMD
()
{
delete
pimpl_
;
}
HMAC_RMD
::~
HMAC_RMD
()
{
ysDelete
(
pimpl_
)
;
}
uint
HMAC_RMD
::
get_digestSize
()
const
...
...
@@ -379,9 +379,9 @@ struct DES::DESImpl {
};
DES
::
DES
()
:
pimpl_
(
new
DESImpl
)
{}
DES
::
DES
()
:
pimpl_
(
new
(
ys
)
DESImpl
)
{}
DES
::~
DES
()
{
delete
pimpl_
;
}
DES
::~
DES
()
{
ysDelete
(
pimpl_
)
;
}
void
DES
::
set_encryptKey
(
const
byte
*
k
,
const
byte
*
iv
)
...
...
@@ -415,9 +415,9 @@ struct DES_EDE::DES_EDEImpl {
};
DES_EDE
::
DES_EDE
()
:
pimpl_
(
new
DES_EDEImpl
)
{}
DES_EDE
::
DES_EDE
()
:
pimpl_
(
new
(
ys
)
DES_EDEImpl
)
{}
DES_EDE
::~
DES_EDE
()
{
delete
pimpl_
;
}
DES_EDE
::~
DES_EDE
()
{
ysDelete
(
pimpl_
)
;
}
void
DES_EDE
::
set_encryptKey
(
const
byte
*
k
,
const
byte
*
iv
)
...
...
@@ -453,9 +453,9 @@ struct RC4::RC4Impl {
};
RC4
::
RC4
()
:
pimpl_
(
new
RC4Impl
)
{}
RC4
::
RC4
()
:
pimpl_
(
new
(
ys
)
RC4Impl
)
{}
RC4
::~
RC4
()
{
delete
pimpl_
;
}
RC4
::~
RC4
()
{
ysDelete
(
pimpl_
)
;
}
void
RC4
::
set_encryptKey
(
const
byte
*
k
,
const
byte
*
)
...
...
@@ -495,9 +495,9 @@ struct AES::AESImpl {
};
AES
::
AES
(
unsigned
int
ks
)
:
pimpl_
(
new
AESImpl
(
ks
))
{}
AES
::
AES
(
unsigned
int
ks
)
:
pimpl_
(
new
(
ys
)
AESImpl
(
ks
))
{}
AES
::~
AES
()
{
delete
pimpl_
;
}
AES
::~
AES
()
{
ysDelete
(
pimpl_
)
;
}
int
AES
::
get_keySize
()
const
...
...
@@ -536,9 +536,9 @@ struct RandomPool::RandomImpl {
TaoCrypt
::
RandomNumberGenerator
RNG_
;
};
RandomPool
::
RandomPool
()
:
pimpl_
(
new
RandomImpl
)
{}
RandomPool
::
RandomPool
()
:
pimpl_
(
new
(
ys
)
RandomImpl
)
{}
RandomPool
::~
RandomPool
()
{
delete
pimpl_
;
}
RandomPool
::~
RandomPool
()
{
ysDelete
(
pimpl_
)
;
}
int
RandomPool
::
GetError
()
const
{
...
...
@@ -580,7 +580,7 @@ void DSS::DSSImpl::SetPrivate(const byte* key, unsigned int sz)
// Set public or private key
DSS
::
DSS
(
const
byte
*
key
,
unsigned
int
sz
,
bool
publicKey
)
:
pimpl_
(
new
DSSImpl
)
:
pimpl_
(
new
(
ys
)
DSSImpl
)
{
if
(
publicKey
)
pimpl_
->
SetPublic
(
key
,
sz
);
...
...
@@ -591,7 +591,7 @@ DSS::DSS(const byte* key, unsigned int sz, bool publicKey)
DSS
::~
DSS
()
{
delete
pimpl_
;
ysDelete
(
pimpl_
)
;
}
...
...
@@ -651,7 +651,7 @@ void RSA::RSAImpl::SetPrivate(const byte* key, unsigned int sz)
// Set public or private key
RSA
::
RSA
(
const
byte
*
key
,
unsigned
int
sz
,
bool
publicKey
)
:
pimpl_
(
new
RSAImpl
)
:
pimpl_
(
new
(
ys
)
RSAImpl
)
{
if
(
publicKey
)
pimpl_
->
SetPublic
(
key
,
sz
);
...
...
@@ -661,7 +661,7 @@ RSA::RSA(const byte* key, unsigned int sz, bool publicKey)
RSA
::~
RSA
()
{
delete
pimpl_
;
ysDelete
(
pimpl_
)
;
}
...
...
@@ -723,13 +723,13 @@ struct Integer::IntegerImpl {
explicit
IntegerImpl
(
const
TaoCrypt
::
Integer
&
i
)
:
int_
(
i
)
{}
};
Integer
::
Integer
()
:
pimpl_
(
new
IntegerImpl
)
{}
Integer
::
Integer
()
:
pimpl_
(
new
(
ys
)
IntegerImpl
)
{}
Integer
::~
Integer
()
{
delete
pimpl_
;
}
Integer
::~
Integer
()
{
ysDelete
(
pimpl_
)
;
}
Integer
::
Integer
(
const
Integer
&
other
)
:
pimpl_
(
new
Integer
::
Integer
(
const
Integer
&
other
)
:
pimpl_
(
new
(
ys
)
IntegerImpl
(
other
.
pimpl_
->
int_
))
{}
...
...
@@ -757,7 +757,12 @@ struct DiffieHellman::DHImpl {
DHImpl
(
TaoCrypt
::
RandomNumberGenerator
&
r
)
:
ranPool_
(
r
),
publicKey_
(
0
),
privateKey_
(
0
),
agreedKey_
(
0
)
{}
~
DHImpl
()
{
delete
[]
agreedKey_
;
delete
[]
privateKey_
;
delete
[]
publicKey_
;}
~
DHImpl
()
{
ysArrayDelete
(
agreedKey_
);
ysArrayDelete
(
privateKey_
);
ysArrayDelete
(
publicKey_
);
}
DHImpl
(
const
DHImpl
&
that
)
:
dh_
(
that
.
dh_
),
ranPool_
(
that
.
ranPool_
),
publicKey_
(
0
),
privateKey_
(
0
),
agreedKey_
(
0
)
...
...
@@ -768,9 +773,9 @@ struct DiffieHellman::DHImpl {
void
AllocKeys
(
unsigned
int
pubSz
,
unsigned
int
privSz
,
unsigned
int
agrSz
)
{
publicKey_
=
new
byte
[
pubSz
];
privateKey_
=
new
byte
[
privSz
];
agreedKey_
=
new
byte
[
agrSz
];
publicKey_
=
new
(
ys
)
byte
[
pubSz
];
privateKey_
=
new
(
ys
)
byte
[
privSz
];
agreedKey_
=
new
(
ys
)
byte
[
agrSz
];
}
};
...
...
@@ -779,7 +784,7 @@ struct DiffieHellman::DHImpl {
/*
// server Side DH, server's view
DiffieHellman::DiffieHellman(const char* file, const RandomPool& random)
: pimpl_(new DHImpl(random.pimpl_->RNG_))
: pimpl_(new
(ys)
DHImpl(random.pimpl_->RNG_))
{
using namespace TaoCrypt;
Source source;
...
...
@@ -803,12 +808,12 @@ DiffieHellman::DiffieHellman(const char* file, const RandomPool& random)
DiffieHellman
::
DiffieHellman
(
const
byte
*
p
,
unsigned
int
pSz
,
const
byte
*
g
,
unsigned
int
gSz
,
const
byte
*
pub
,
unsigned
int
pubSz
,
const
RandomPool
&
random
)
:
pimpl_
(
new
DHImpl
(
random
.
pimpl_
->
RNG_
))
:
pimpl_
(
new
(
ys
)
DHImpl
(
random
.
pimpl_
->
RNG_
))
{
using
TaoCrypt
::
Integer
;
pimpl_
->
dh_
.
Initialize
(
Integer
(
p
,
pSz
).
Ref
(),
Integer
(
g
,
gSz
).
Ref
());
pimpl_
->
publicKey_
=
new
opaque
[
pubSz
];
pimpl_
->
publicKey_
=
new
(
ys
)
opaque
[
pubSz
];
memcpy
(
pimpl_
->
publicKey_
,
pub
,
pubSz
);
}
...
...
@@ -816,7 +821,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g,
// Server Side DH, server's view
DiffieHellman
::
DiffieHellman
(
const
Integer
&
p
,
const
Integer
&
g
,
const
RandomPool
&
random
)
:
pimpl_
(
new
DHImpl
(
random
.
pimpl_
->
RNG_
))
:
pimpl_
(
new
(
ys
)
DHImpl
(
random
.
pimpl_
->
RNG_
))
{
using
TaoCrypt
::
Integer
;
...
...
@@ -829,12 +834,12 @@ DiffieHellman::DiffieHellman(const Integer& p, const Integer& g,
pimpl_
->
publicKey_
);
}
DiffieHellman
::~
DiffieHellman
()
{
delete
pimpl_
;
}
DiffieHellman
::~
DiffieHellman
()
{
ysDelete
(
pimpl_
)
;
}
// Client side and view, use server that for p and g
DiffieHellman
::
DiffieHellman
(
const
DiffieHellman
&
that
)
:
pimpl_
(
new
DHImpl
(
*
that
.
pimpl_
))
:
pimpl_
(
new
(
ys
)
DHImpl
(
*
that
.
pimpl_
))
{
pimpl_
->
dh_
.
GenerateKeyPair
(
pimpl_
->
ranPool_
,
pimpl_
->
privateKey_
,
pimpl_
->
publicKey_
);
...
...
@@ -955,7 +960,7 @@ x509* PemToDer(const char* fname, CertType type)
Base64Decoder
b64Dec
(
der
);
uint
sz
=
der
.
size
();
mySTL
::
auto_ptr
<
x509
>
x
(
new
x509
(
sz
)
);
mySTL
::
auto_ptr
<
x509
>
x
(
new
(
ys
)
x509
(
sz
),
ysDelete
);
memcpy
(
x
->
use_buffer
(),
der
.
get_buffer
(),
sz
);
fclose
(
file
);
...
...
@@ -965,10 +970,25 @@ x509* PemToDer(const char* fname, CertType type)
}
// namespace
#ifdef __GNUC__
template
class
TaoCrypt
::
HMAC
<
TaoCrypt
::
MD5
>;
template
class
TaoCrypt
::
HMAC
<
TaoCrypt
::
SHA
>;
template
class
TaoCrypt
::
HMAC
<
TaoCrypt
::
RIPEMD160
>;
#endif
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 // __GNUC__
#endif // !USE_CRYPTOPP_LIB
extra/yassl/src/handshake.cpp
View file @
a3fe8602
...
...
@@ -357,14 +357,14 @@ void p_hash(output_buffer& result, const output_buffer& secret,
uint
lastLen
=
result
.
get_capacity
()
%
len
;
opaque
previous
[
SHA_LEN
];
// max size
opaque
current
[
SHA_LEN
];
// max size
mySTL
::
auto_ptr
<
Digest
>
hmac
;
mySTL
::
auto_ptr
<
Digest
>
hmac
(
ysDelete
)
;
if
(
lastLen
)
times
+=
1
;
if
(
hash
==
md5
)
hmac
.
reset
(
new
HMAC_MD5
(
secret
.
get_buffer
(),
secret
.
get_size
()));
hmac
.
reset
(
new
(
ys
)
HMAC_MD5
(
secret
.
get_buffer
(),
secret
.
get_size
()));
else
hmac
.
reset
(
new
HMAC_SHA
(
secret
.
get_buffer
(),
secret
.
get_size
()));
hmac
.
reset
(
new
(
ys
)
HMAC_SHA
(
secret
.
get_buffer
(),
secret
.
get_size
()));
// A0 = seed
hmac
->
get_digest
(
previous
,
seed
.
get_buffer
(),
seed
.
get_size
());
// A1
uint
lastTime
=
times
-
1
;
...
...
@@ -571,7 +571,7 @@ void hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz,
void
TLS_hmac
(
SSL
&
ssl
,
byte
*
digest
,
const
byte
*
buffer
,
uint
sz
,
ContentType
content
,
bool
verify
)
{
mySTL
::
auto_ptr
<
Digest
>
hmac
;
mySTL
::
auto_ptr
<
Digest
>
hmac
(
ysDelete
)
;
opaque
seq
[
SEQ_SZ
]
=
{
0x00
,
0x00
,
0x00
,
0x00
};
opaque
length
[
LENGTH_SZ
];
opaque
inner
[
SIZEOF_ENUM
+
VERSION_SZ
+
LENGTH_SZ
];
// type + version + len
...
...
@@ -582,11 +582,11 @@ void TLS_hmac(SSL& ssl, byte* digest, const byte* buffer, uint sz,
MACAlgorithm
algo
=
ssl
.
getSecurity
().
get_parms
().
mac_algorithm_
;
if
(
algo
==
sha
)
hmac
.
reset
(
new
HMAC_SHA
(
ssl
.
get_macSecret
(
verify
),
SHA_LEN
));
hmac
.
reset
(
new
(
ys
)
HMAC_SHA
(
ssl
.
get_macSecret
(
verify
),
SHA_LEN
));
else
if
(
algo
==
rmd
)
hmac
.
reset
(
new
HMAC_RMD
(
ssl
.
get_macSecret
(
verify
),
RMD_LEN
));
hmac
.
reset
(
new
(
ys
)
HMAC_RMD
(
ssl
.
get_macSecret
(
verify
),
RMD_LEN
));
else
hmac
.
reset
(
new
HMAC_MD5
(
ssl
.
get_macSecret
(
verify
),
MD5_LEN
));
hmac
.
reset
(
new
(
ys
)
HMAC_MD5
(
ssl
.
get_macSecret
(
verify
),
MD5_LEN
));
hmac
->
update
(
seq
,
SEQ_SZ
);
// seq_num
inner
[
0
]
=
content
;
// type
...
...
@@ -648,7 +648,7 @@ void build_certHashes(SSL& ssl, Hashes& hashes)
}
mySTL
::
auto_ptr
<
input_buffer
>
null_buffer
;
mySTL
::
auto_ptr
<
input_buffer
>
null_buffer
(
ysDelete
)
;
// do process input requests
mySTL
::
auto_ptr
<
input_buffer
>
...
...
@@ -666,7 +666,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
buffered
=
null_buffer
;
}
// add new data
// add new
(ys)
data
uint
read
=
ssl
.
getSocket
().
receive
(
buffer
.
get_buffer
()
+
buffSz
,
ready
);
buffer
.
add_size
(
read
);
uint
offset
=
0
;
...
...
@@ -687,7 +687,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
// make sure we have enough input in buffer to process this record
if
(
hdr
.
length_
>
buffer
.
get_remaining
())
{
uint
sz
=
buffer
.
get_remaining
()
+
RECORD_HEADER
;
buffered
.
reset
(
new
input_buffer
(
sz
,
buffer
.
get_buffer
()
+
buffered
.
reset
(
new
(
ys
)
input_buffer
(
sz
,
buffer
.
get_buffer
()
+
buffer
.
get_current
()
-
RECORD_HEADER
,
sz
));
break
;
}
...
...
@@ -696,7 +696,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
// each message in record
if
(
ssl
.
getSecurity
().
get_parms
().
pending_
==
false
)
// cipher on
decrypt_message
(
ssl
,
buffer
,
hdr
.
length_
);
mySTL
::
auto_ptr
<
Message
>
msg
(
mf
.
CreateObject
(
hdr
.
type_
));
mySTL
::
auto_ptr
<
Message
>
msg
(
mf
.
CreateObject
(
hdr
.
type_
)
,
ysDelete
);
if
(
!
msg
.
get
())
{
ssl
.
SetError
(
factory_error
);
return
buffered
=
null_buffer
;
...
...
@@ -715,7 +715,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
void
processReply
(
SSL
&
ssl
)
{
if
(
ssl
.
GetError
())
return
;
mySTL
::
auto_ptr
<
input_buffer
>
buffered
;
mySTL
::
auto_ptr
<
input_buffer
>
buffered
(
ysDelete
)
;
for
(;;)
{
mySTL
::
auto_ptr
<
input_buffer
>
tmp
=
DoProcessReply
(
ssl
,
buffered
);
...
...
@@ -760,7 +760,7 @@ void sendClientKeyExchange(SSL& ssl, BufferOutput buffer)
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildHeaders
(
ssl
,
hsHeader
,
rlHeader
,
ck
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
hsHeader
,
ck
);
hashHandShake
(
ssl
,
*
out
.
get
());
...
...
@@ -781,7 +781,7 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer)
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildHeaders
(
ssl
,
hsHeader
,
rlHeader
,
sk
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
hsHeader
,
sk
);
hashHandShake
(
ssl
,
*
out
.
get
());
...
...
@@ -806,7 +806,7 @@ void sendChangeCipher(SSL& ssl, BufferOutput buffer)
ChangeCipherSpec
ccs
;
RecordLayerHeader
rlHeader
;
buildHeader
(
ssl
,
rlHeader
,
ccs
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
ccs
);
if
(
buffer
==
buffered
)
...
...
@@ -823,7 +823,7 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
Finished
fin
;
buildFinished
(
ssl
,
fin
,
side
==
client_end
?
client
:
server
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
cipherFinished
(
ssl
,
fin
,
*
out
.
get
());
// hashes handshake
if
(
ssl
.
getSecurity
().
get_resuming
())
{
...
...
@@ -907,7 +907,7 @@ void sendServerHello(SSL& ssl, BufferOutput buffer)
ServerHello
sh
(
ssl
.
getSecurity
().
get_connection
().
version_
);
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildServerHello
(
ssl
,
sh
);
ssl
.
set_random
(
sh
.
get_random
(),
server_end
);
...
...
@@ -930,7 +930,7 @@ void sendServerHelloDone(SSL& ssl, BufferOutput buffer)
ServerHelloDone
shd
;
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildHeaders
(
ssl
,
hsHeader
,
rlHeader
,
shd
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
hsHeader
,
shd
);
...
...
@@ -951,7 +951,7 @@ void sendCertificate(SSL& ssl, BufferOutput buffer)
Certificate
cert
(
ssl
.
getCrypto
().
get_certManager
().
get_cert
());
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildHeaders
(
ssl
,
hsHeader
,
rlHeader
,
cert
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
hsHeader
,
cert
);
...
...
@@ -973,7 +973,7 @@ void sendCertificateRequest(SSL& ssl, BufferOutput buffer)
request
.
Build
();
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildHeaders
(
ssl
,
hsHeader
,
rlHeader
,
request
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
hsHeader
,
request
);
...
...
@@ -995,7 +995,7 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer)
verify
.
Build
(
ssl
);
RecordLayerHeader
rlHeader
;
HandShakeHeader
hsHeader
;
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
output_buffer
);
mySTL
::
auto_ptr
<
output_buffer
>
out
(
new
(
ys
)
output_buffer
,
ysDelete
);
buildHeaders
(
ssl
,
hsHeader
,
rlHeader
,
verify
);
buildOutput
(
*
out
.
get
(),
rlHeader
,
hsHeader
,
verify
);
...
...
extra/yassl/src/lock.cpp
View file @
a3fe8602
...
...
@@ -22,7 +22,6 @@
/* Locking functions
*/
#include "runtime.hpp"
#include "lock.hpp"
...
...
extra/yassl/src/log.cpp
View file @
a3fe8602
...
...
@@ -22,7 +22,6 @@
/* Debug logging functions
*/
#include "runtime.hpp"
#include "log.hpp"
#ifdef YASSL_LOG
...
...
extra/yassl/src/socket_wrapper.cpp
View file @
a3fe8602
...
...
@@ -26,7 +26,6 @@
*/
#include "runtime.hpp"
#include "socket_wrapper.hpp"
#include "yassl_error.hpp"
...
...
extra/yassl/src/ssl.cpp
View file @
a3fe8602
...
...
@@ -32,7 +32,6 @@
/* see man pages for function descriptions */
#include "runtime.hpp"
#include "openssl/ssl.h"
#include "handshake.hpp"
#include "yassl_int.hpp"
...
...
@@ -52,25 +51,25 @@ SSL_METHOD* SSLv3_method()
SSL_METHOD
*
SSLv3_server_method
()
{
return
new
SSL_METHOD
(
server_end
,
ProtocolVersion
(
3
,
0
));
return
new
(
ys
)
SSL_METHOD
(
server_end
,
ProtocolVersion
(
3
,
0
));
}
SSL_METHOD
*
SSLv3_client_method
()
{
return
new
SSL_METHOD
(
client_end
,
ProtocolVersion
(
3
,
0
));
return
new
(
ys
)
SSL_METHOD
(
client_end
,
ProtocolVersion
(
3
,
0
));
}
SSL_METHOD
*
TLSv1_server_method
()
{
return
new
SSL_METHOD
(
server_end
,
ProtocolVersion
(
3
,
1
));
return
new
(
ys
)
SSL_METHOD
(
server_end
,
ProtocolVersion
(
3
,
1
));
}
SSL_METHOD
*
TLSv1_client_method
()
{
return
new
SSL_METHOD
(
client_end
,
ProtocolVersion
(
3
,
1
));
return
new
(
ys
)
SSL_METHOD
(
client_end
,
ProtocolVersion
(
3
,
1
));
}
...
...
@@ -83,25 +82,25 @@ SSL_METHOD* SSLv23_server_method()
SSL_CTX
*
SSL_CTX_new
(
SSL_METHOD
*
method
)
{
return
new
SSL_CTX
(
method
);
return
new
(
ys
)
SSL_CTX
(
method
);
}
void
SSL_CTX_free
(
SSL_CTX
*
ctx
)
{
delete
ctx
;
ysDelete
(
ctx
)
;
}
SSL
*
SSL_new
(
SSL_CTX
*
ctx
)
{
return
new
SSL
(
ctx
);
return
new
(
ys
)
SSL
(
ctx
);
}
void
SSL_free
(
SSL
*
ssl
)
{
delete
ssl
;
ysDelete
(
ssl
)
;
}
...
...
@@ -443,7 +442,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
fseek
(
input
,
0
,
SEEK_END
);
long
sz
=
ftell
(
input
);
rewind
(
input
);
x
=
new
x509
(
sz
);
// takes ownership
x
=
new
(
ys
)
x509
(
sz
);
// takes ownership
size_t
bytes
=
fread
(
x
->
use_buffer
(),
sz
,
1
,
input
);
if
(
bytes
!=
1
)
{
fclose
(
input
);
...
...
@@ -638,7 +637,7 @@ void OpenSSL_add_all_algorithms() // compatibility only
DH
*
DH_new
(
void
)
{
DH
*
dh
=
new
DH
;
DH
*
dh
=
new
(
ys
)
DH
;
if
(
dh
)
dh
->
p
=
dh
->
g
=
0
;
return
dh
;
...
...
@@ -647,9 +646,9 @@ DH* DH_new(void)
void
DH_free
(
DH
*
dh
)
{
delete
dh
->
g
;
delete
dh
->
p
;
delete
dh
;
ysDelete
(
dh
->
g
)
;
ysDelete
(
dh
->
p
)
;
ysDelete
(
dh
)
;
}
...
...
@@ -659,11 +658,11 @@ BIGNUM* BN_bin2bn(const unsigned char* num, int sz, BIGNUM* retVal)
{
using
mySTL
::
auto_ptr
;
bool
created
=
false
;
auto_ptr
<
BIGNUM
>
bn
;
auto_ptr
<
BIGNUM
>
bn
(
ysDelete
)
;
if
(
!
retVal
)
{
created
=
true
;
bn
.
reset
(
new
BIGNUM
);
bn
.
reset
(
new
(
ys
)
BIGNUM
);
retVal
=
bn
.
get
();
}
...
...
@@ -712,14 +711,14 @@ const char* X509_verify_cert_error_string(long /* error */)
const
EVP_MD
*
EVP_md5
(
void
)
{
// TODO: FIX add to some list for destruction
return
new
MD5
;
return
new
(
ys
)
MD5
;
}
const
EVP_CIPHER
*
EVP_des_ede3_cbc
(
void
)
{
// TODO: FIX add to some list for destruction
return
new
DES_EDE
;
return
new
(
ys
)
DES_EDE
;
}
...
...
extra/yassl/src/template_instnt.cpp
0 → 100644
View file @
a3fe8602
#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 __GNUC__
#if !defined(USE_CRYPTOPP_LIB)
namespace
TaoCrypt
{
template
class
HMAC
<
MD5
>;
template
class
HMAC
<
SHA
>;
template
class
HMAC
<
RIPEMD160
>;
}
#endif
namespace
mySTL
{
template
class
mySTL
::
list
<
unsigned
char
*
>;
template
yaSSL
::
del_ptr_zero
mySTL
::
for_each
(
mySTL
::
list
<
unsigned
char
*
>
::
iterator
,
mySTL
::
list
<
unsigned
char
*>::
iterator
,
yaSSL
::
del_ptr_zero
);
template
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()>
*
mySTL
::
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
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()>
*
mySTL
::
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
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()
>*
);
template
void
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()
>*
);
template
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()>
*
mySTL
::
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
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()
>*
);
template
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()>
*
mySTL
::
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
mySTL
::
list
<
TaoCrypt
::
Signer
*
>;
template
class
mySTL
::
list
<
yaSSL
::
SSL_SESSION
*
>;
template
class
mySTL
::
list
<
yaSSL
::
input_buffer
*
>;
template
class
mySTL
::
list
<
yaSSL
::
output_buffer
*
>;
template
class
mySTL
::
list
<
yaSSL
::
x509
*
>;
template
void
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()
>*
);
template
yaSSL
::
del_ptr_zero
mySTL
::
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
mySTL
::
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
mySTL
::
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
mySTL
::
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
mySTL
::
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
);
}
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
ysArrayDelete
<
unsigned
char
>(
unsigned
char
*
);
template
void
ysArrayDelete
<
char
>(
char
*
);
}
#endif
extra/yassl/src/timer.cpp
View file @
a3fe8602
...
...
@@ -23,7 +23,6 @@
*
*/
#include "runtime.hpp"
#include "timer.hpp"
namespace
yaSSL
{
...
...
extra/yassl/src/yassl_error.cpp
View file @
a3fe8602
...
...
@@ -23,7 +23,6 @@
/* yaSSL error implements and an exception class
*/
#include "runtime.hpp"
#include "yassl_error.hpp"
namespace
yaSSL
{
...
...
extra/yassl/src/yassl_imp.cpp
View file @
a3fe8602
...
...
@@ -130,14 +130,14 @@ void DH_Server::build(SSL& ssl)
parms_
.
alloc_pub
(
pubSz
));
short
sigSz
=
0
;
mySTL
::
auto_ptr
<
Auth
>
auth
;
mySTL
::
auto_ptr
<
Auth
>
auth
(
ysDelete
)
;
const
CertManager
&
cert
=
ssl
.
getCrypto
().
get_certManager
();
if
(
ssl
.
getSecurity
().
get_parms
().
sig_algo_
==
rsa_sa_algo
)
auth
.
reset
(
new
RSA
(
cert
.
get_privateKey
(),
auth
.
reset
(
new
(
ys
)
RSA
(
cert
.
get_privateKey
(),
cert
.
get_privateKeyLength
(),
false
));
else
{
auth
.
reset
(
new
DSS
(
cert
.
get_privateKey
(),
auth
.
reset
(
new
(
ys
)
DSS
(
cert
.
get_privateKey
(),
cert
.
get_privateKeyLength
(),
false
));
sigSz
+=
DSS_ENCODED_EXTRA
;
}
...
...
@@ -168,7 +168,7 @@ void DH_Server::build(SSL& ssl)
byte
hash
[
FINISHED_SZ
];
MD5
md5
;
SHA
sha
;
signature_
=
new
byte
[
sigSz
];
signature_
=
new
(
ys
)
byte
[
sigSz
];
const
Connection
&
conn
=
ssl
.
getSecurity
().
get_connection
();
// md5
...
...
@@ -199,7 +199,7 @@ void DH_Server::build(SSL& ssl)
tmp
.
write
(
signature_
,
sigSz
);
// key message
keyMessage_
=
new
opaque
[
length_
];
keyMessage_
=
new
(
ys
)
opaque
[
length_
];
memcpy
(
keyMessage_
,
tmp
.
get_buffer
(),
tmp
.
get_size
());
}
...
...
@@ -234,7 +234,7 @@ EncryptedPreMasterSecret::EncryptedPreMasterSecret()
EncryptedPreMasterSecret
::~
EncryptedPreMasterSecret
()
{
delete
[]
secret_
;
ysArrayDelete
(
secret_
)
;
}
...
...
@@ -253,7 +253,7 @@ opaque* EncryptedPreMasterSecret::get_clientKey() const
void
EncryptedPreMasterSecret
::
alloc
(
int
sz
)
{
length_
=
sz
;
secret_
=
new
opaque
[
sz
];
secret_
=
new
(
ys
)
opaque
[
sz
];
}
...
...
@@ -284,7 +284,7 @@ ClientDiffieHellmanPublic::ClientDiffieHellmanPublic()
ClientDiffieHellmanPublic
::~
ClientDiffieHellmanPublic
()
{
delete
[]
Yc_
;
ysArrayDelete
(
Yc_
)
;
}
...
...
@@ -303,7 +303,7 @@ opaque* ClientDiffieHellmanPublic::get_clientKey() const
void
ClientDiffieHellmanPublic
::
alloc
(
int
sz
,
bool
offset
)
{
length_
=
sz
+
(
offset
?
KEY_OFFSET
:
0
);
Yc_
=
new
opaque
[
length_
];
Yc_
=
new
(
ys
)
opaque
[
length_
];
}
...
...
@@ -348,7 +348,7 @@ void DH_Server::read(SSL& ssl, input_buffer& input)
tmp
[
1
]
=
input
[
AUTO
];
ato16
(
tmp
,
length
);
signature_
=
new
byte
[
length
];
signature_
=
new
(
ys
)
byte
[
length
];
input
.
read
(
signature_
,
length
);
// verify signature
...
...
@@ -386,7 +386,7 @@ void DH_Server::read(SSL& ssl, input_buffer& input)
}
// save input
ssl
.
useCrypto
().
SetDH
(
new
DiffieHellman
(
parms_
.
get_p
(),
ssl
.
useCrypto
().
SetDH
(
new
(
ys
)
DiffieHellman
(
parms_
.
get_p
(),
parms_
.
get_pSize
(),
parms_
.
get_g
(),
parms_
.
get_gSize
(),
parms_
.
get_pub
(),
parms_
.
get_pubSize
(),
ssl
.
getCrypto
().
get_random
()));
...
...
@@ -400,8 +400,8 @@ DH_Server::DH_Server()
DH_Server
::~
DH_Server
()
{
delete
[]
keyMessage_
;
delete
[]
signature_
;
ysArrayDelete
(
keyMessage_
)
;
ysArrayDelete
(
signature_
)
;
}
...
...
@@ -594,7 +594,7 @@ void HandShakeHeader::Process(input_buffer& input, SSL& ssl)
{
ssl
.
verifyState
(
*
this
);
const
HandShakeFactory
&
hsf
=
ssl
.
getFactory
().
getHandShake
();
mySTL
::
auto_ptr
<
HandShakeBase
>
hs
(
hsf
.
CreateObject
(
type_
));
mySTL
::
auto_ptr
<
HandShakeBase
>
hs
(
hsf
.
CreateObject
(
type_
)
,
ysDelete
);
if
(
!
hs
.
get
())
{
ssl
.
SetError
(
factory_error
);
return
;
...
...
@@ -928,7 +928,7 @@ void Data::Process(input_buffer& input, SSL& ssl)
// read data
if
(
dataSz
)
{
input_buffer
*
data
;
ssl
.
addData
(
data
=
new
input_buffer
(
dataSz
));
ssl
.
addData
(
data
=
new
(
ys
)
input_buffer
(
dataSz
));
input
.
read
(
data
->
get_buffer
(),
dataSz
);
data
->
add_size
(
dataSz
);
...
...
@@ -1025,7 +1025,7 @@ void Certificate::Process(input_buffer& input, SSL& ssl)
c24to32
(
tmp
,
cert_sz
);
x509
*
myCert
;
cm
.
AddPeerCert
(
myCert
=
new
x509
(
cert_sz
));
cm
.
AddPeerCert
(
myCert
=
new
(
ys
)
x509
(
cert_sz
));
input
.
read
(
myCert
->
use_buffer
(),
myCert
->
get_length
());
list_sz
-=
cert_sz
+
CERT_HEADER
;
...
...
@@ -1067,9 +1067,9 @@ ServerDHParams::ServerDHParams()
ServerDHParams
::~
ServerDHParams
()
{
delete
[]
Ys_
;
delete
[]
g_
;
delete
[]
p_
;
ysArrayDelete
(
Ys_
)
;
ysArrayDelete
(
g_
)
;
ysArrayDelete
(
p_
)
;
}
...
...
@@ -1111,21 +1111,21 @@ const opaque* ServerDHParams::get_pub() const
opaque
*
ServerDHParams
::
alloc_p
(
int
sz
)
{
p_
=
new
opaque
[
pSz_
=
sz
];
p_
=
new
(
ys
)
opaque
[
pSz_
=
sz
];
return
p_
;
}
opaque
*
ServerDHParams
::
alloc_g
(
int
sz
)
{
g_
=
new
opaque
[
gSz_
=
sz
];
g_
=
new
(
ys
)
opaque
[
gSz_
=
sz
];
return
g_
;
}
opaque
*
ServerDHParams
::
alloc_pub
(
int
sz
)
{
Ys_
=
new
opaque
[
pubSz_
=
sz
];
Ys_
=
new
(
ys
)
opaque
[
pubSz_
=
sz
];
return
Ys_
;
}
...
...
@@ -1466,7 +1466,7 @@ ServerKeyExchange::ServerKeyExchange()
ServerKeyExchange
::~
ServerKeyExchange
()
{
delete
server_key_
;
ysDelete
(
server_key_
)
;
}
...
...
@@ -1537,7 +1537,7 @@ void CertificateRequest::Build()
for
(
int
j
=
0
;
j
<
authCount
;
j
++
)
{
int
sz
=
REQUEST_HEADER
+
MIN_DIS_SIZE
;
DistinguishedName
dn
;
certificate_authorities_
.
push_back
(
dn
=
new
byte
[
sz
]);
certificate_authorities_
.
push_back
(
dn
=
new
(
ys
)
byte
[
sz
]);
opaque
tmp
[
REQUEST_HEADER
];
c16toa
(
MIN_DIS_SIZE
,
tmp
);
...
...
@@ -1584,7 +1584,7 @@ input_buffer& operator>>(input_buffer& input, CertificateRequest& request)
ato16
(
tmp
,
dnSz
);
DistinguishedName
dn
;
request
.
certificate_authorities_
.
push_back
(
dn
=
new
request
.
certificate_authorities_
.
push_back
(
dn
=
new
(
ys
)
byte
[
REQUEST_HEADER
+
dnSz
]);
memcpy
(
dn
,
tmp
,
REQUEST_HEADER
);
input
.
read
(
&
dn
[
REQUEST_HEADER
],
dnSz
);
...
...
@@ -1647,7 +1647,7 @@ CertificateVerify::CertificateVerify() : signature_(0)
CertificateVerify
::~
CertificateVerify
()
{
delete
[]
signature_
;
ysArrayDelete
(
signature_
)
;
}
...
...
@@ -1657,7 +1657,7 @@ void CertificateVerify::Build(SSL& ssl)
uint16
sz
=
0
;
byte
len
[
VERIFY_HEADER
];
mySTL
::
auto_ptr
<
byte
>
sig
;
mySTL
::
auto_ptr
<
byte
>
sig
(
ysArrayDelete
)
;
// sign
const
CertManager
&
cert
=
ssl
.
getCrypto
().
get_certManager
();
...
...
@@ -1665,7 +1665,7 @@ void CertificateVerify::Build(SSL& ssl)
RSA
rsa
(
cert
.
get_privateKey
(),
cert
.
get_privateKeyLength
(),
false
);
sz
=
rsa
.
get_cipherLength
()
+
VERIFY_HEADER
;
sig
.
reset
(
new
byte
[
sz
]);
sig
.
reset
(
new
(
ys
)
byte
[
sz
]);
c16toa
(
sz
-
VERIFY_HEADER
,
len
);
memcpy
(
sig
.
get
(),
len
,
VERIFY_HEADER
);
...
...
@@ -1676,7 +1676,7 @@ void CertificateVerify::Build(SSL& ssl)
DSS
dss
(
cert
.
get_privateKey
(),
cert
.
get_privateKeyLength
(),
false
);
sz
=
DSS_SIG_SZ
+
DSS_ENCODED_EXTRA
+
VERIFY_HEADER
;
sig
.
reset
(
new
byte
[
sz
]);
sig
.
reset
(
new
(
ys
)
byte
[
sz
]);
c16toa
(
sz
-
VERIFY_HEADER
,
len
);
memcpy
(
sig
.
get
(),
len
,
VERIFY_HEADER
);
...
...
@@ -1714,7 +1714,7 @@ input_buffer& operator>>(input_buffer& input, CertificateVerify& request)
ato16
(
tmp
,
sz
);
request
.
set_length
(
sz
);
request
.
signature_
=
new
byte
[
sz
];
request
.
signature_
=
new
(
ys
)
byte
[
sz
];
input
.
read
(
request
.
signature_
,
sz
);
return
input
;
...
...
@@ -1796,7 +1796,7 @@ ClientKeyExchange::ClientKeyExchange()
ClientKeyExchange
::~
ClientKeyExchange
()
{
delete
client_key_
;
ysDelete
(
client_key_
)
;
}
...
...
@@ -1969,13 +1969,13 @@ Connection::Connection(ProtocolVersion v, RandomPool& ran)
Connection
::~
Connection
()
{
CleanMaster
();
CleanPreMaster
();
delete
[]
pre_master_secret_
;
CleanMaster
();
CleanPreMaster
();
ysArrayDelete
(
pre_master_secret_
)
;
}
void
Connection
::
AllocPreSecret
(
uint
sz
)
{
pre_master_secret_
=
new
opaque
[
pre_secret_len_
=
sz
];
pre_master_secret_
=
new
(
ys
)
opaque
[
pre_secret_len_
=
sz
];
}
...
...
@@ -2004,42 +2004,42 @@ void Connection::CleanPreMaster()
volatile
opaque
*
p
=
pre_master_secret_
;
clean
(
p
,
pre_secret_len_
,
random_
);
delete
[]
pre_master_secret_
;
ysArrayDelete
(
pre_master_secret_
)
;
pre_master_secret_
=
0
;
}
}
// Create functions for message factory
Message
*
CreateCipherSpec
()
{
return
new
ChangeCipherSpec
;
}
Message
*
CreateAlert
()
{
return
new
Alert
;
}
Message
*
CreateHandShake
()
{
return
new
HandShakeHeader
;
}
Message
*
CreateData
()
{
return
new
Data
;
}
Message
*
CreateCipherSpec
()
{
return
new
(
ys
)
ChangeCipherSpec
;
}
Message
*
CreateAlert
()
{
return
new
(
ys
)
Alert
;
}
Message
*
CreateHandShake
()
{
return
new
(
ys
)
HandShakeHeader
;
}
Message
*
CreateData
()
{
return
new
(
ys
)
Data
;
}
// Create functions for handshake factory
HandShakeBase
*
CreateHelloRequest
()
{
return
new
HelloRequest
;
}
HandShakeBase
*
CreateClientHello
()
{
return
new
ClientHello
;
}
HandShakeBase
*
CreateServerHello
()
{
return
new
ServerHello
;
}
HandShakeBase
*
CreateCertificate
()
{
return
new
Certificate
;
}
HandShakeBase
*
CreateServerKeyExchange
()
{
return
new
ServerKeyExchange
;}
HandShakeBase
*
CreateCertificateRequest
()
{
return
new
HandShakeBase
*
CreateHelloRequest
()
{
return
new
(
ys
)
HelloRequest
;
}
HandShakeBase
*
CreateClientHello
()
{
return
new
(
ys
)
ClientHello
;
}
HandShakeBase
*
CreateServerHello
()
{
return
new
(
ys
)
ServerHello
;
}
HandShakeBase
*
CreateCertificate
()
{
return
new
(
ys
)
Certificate
;
}
HandShakeBase
*
CreateServerKeyExchange
()
{
return
new
(
ys
)
ServerKeyExchange
;}
HandShakeBase
*
CreateCertificateRequest
()
{
return
new
(
ys
)
CertificateRequest
;
}
HandShakeBase
*
CreateServerHelloDone
()
{
return
new
ServerHelloDone
;
}
HandShakeBase
*
CreateCertificateVerify
()
{
return
new
CertificateVerify
;}
HandShakeBase
*
CreateClientKeyExchange
()
{
return
new
ClientKeyExchange
;}
HandShakeBase
*
CreateFinished
()
{
return
new
Finished
;
}
HandShakeBase
*
CreateServerHelloDone
()
{
return
new
(
ys
)
ServerHelloDone
;
}
HandShakeBase
*
CreateCertificateVerify
()
{
return
new
(
ys
)
CertificateVerify
;}
HandShakeBase
*
CreateClientKeyExchange
()
{
return
new
(
ys
)
ClientKeyExchange
;}
HandShakeBase
*
CreateFinished
()
{
return
new
(
ys
)
Finished
;
}
// Create functions for server key exchange factory
ServerKeyBase
*
CreateRSAServerKEA
()
{
return
new
RSA_Server
;
}
ServerKeyBase
*
CreateDHServerKEA
()
{
return
new
DH_Server
;
}
ServerKeyBase
*
CreateFortezzaServerKEA
()
{
return
new
Fortezza_Server
;
}
ServerKeyBase
*
CreateRSAServerKEA
()
{
return
new
(
ys
)
RSA_Server
;
}
ServerKeyBase
*
CreateDHServerKEA
()
{
return
new
(
ys
)
DH_Server
;
}
ServerKeyBase
*
CreateFortezzaServerKEA
()
{
return
new
(
ys
)
Fortezza_Server
;
}
// Create functions for client key exchange factory
ClientKeyBase
*
CreateRSAClient
()
{
return
new
ClientKeyBase
*
CreateRSAClient
()
{
return
new
(
ys
)
EncryptedPreMasterSecret
;
}
ClientKeyBase
*
CreateDHClient
()
{
return
new
ClientKeyBase
*
CreateDHClient
()
{
return
new
(
ys
)
ClientDiffieHellmanPublic
;
}
ClientKeyBase
*
CreateFortezzaClient
()
{
return
new
FortezzaKeys
;
}
ClientKeyBase
*
CreateFortezzaClient
()
{
return
new
(
ys
)
FortezzaKeys
;
}
// Constructor calls this to Register compile time callbacks
...
...
@@ -2089,29 +2089,5 @@ void InitClientKeyFactory(ClientKeyFactory& ckf)
ckf
.
Register
(
fortezza_kea
,
CreateFortezzaClient
);
}
}
// namespace
#ifdef __GNUC__
namespace
mySTL
{
template
class
mySTL
::
list
<
unsigned
char
*
>;
template
yaSSL
::
del_ptr_zero
mySTL
::
for_each
(
mySTL
::
list
<
unsigned
char
*
>
::
iterator
,
mySTL
::
list
<
unsigned
char
*>::
iterator
,
yaSSL
::
del_ptr_zero
);
template
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()>
*
mySTL
::
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
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()>
*
mySTL
::
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
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
Message
*
(
*
)()
>*
);
template
void
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
HandShakeBase
*
(
*
)()
>*
);
template
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()>
*
mySTL
::
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
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
ServerKeyBase
*
(
*
)()
>*
);
template
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()>
*
mySTL
::
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
mySTL
::
list
<
TaoCrypt
::
Signer
*
>;
template
class
mySTL
::
list
<
yaSSL
::
SSL_SESSION
*
>;
template
class
mySTL
::
list
<
yaSSL
::
input_buffer
*
>;
template
class
mySTL
::
list
<
yaSSL
::
output_buffer
*
>;
template
class
mySTL
::
list
<
yaSSL
::
x509
*
>;
template
void
mySTL
::
destroy
<
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()>
*>
(
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()
>*
,
mySTL
::
pair
<
int
,
yaSSL
::
ClientKeyBase
*
(
*
)()
>*
);
template
yaSSL
::
del_ptr_zero
mySTL
::
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
mySTL
::
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
mySTL
::
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
mySTL
::
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
mySTL
::
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
);
}
#endif
}
// namespace
extra/yassl/src/yassl_int.cpp
View file @
a3fe8602
...
...
@@ -24,19 +24,47 @@
* draft along with type conversion functions.
*/
#include "runtime.hpp"
#include "yassl_int.hpp"
#include "handshake.hpp"
#include "timer.hpp"
#include "openssl/ssl.h" // for DH
void
*
operator
new
(
size_t
sz
,
yaSSL
::
new_t
)
{
void
*
ptr
=
malloc
(
sz
?
sz
:
1
);
if
(
!
ptr
)
abort
();
return
ptr
;
}
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
)
{
if
(
ptr
)
free
(
ptr
);
}
void
operator
delete
[](
void
*
ptr
,
yaSSL
::
new_t
)
{
if
(
ptr
)
free
(
ptr
);
}
namespace
yaSSL
{
using
mySTL
::
min
;
new_t
ys
;
// for yaSSL library new
// convert a 32 bit integer into a 24 bit one
...
...
@@ -284,8 +312,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
AES_256_KEY_SZ
;
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
AES
(
AES_256_KEY_SZ
));
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
AES
(
AES_256_KEY_SZ
));
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_RSA_WITH_AES_256_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -298,8 +326,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
AES_128_KEY_SZ
;
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
AES
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
AES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_RSA_WITH_AES_128_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -312,8 +340,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
DES_EDE_KEY_SZ
;
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
DES_EDE
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
DES_EDE
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_RSA_WITH_3DES_EDE_CBC_SHA
]
,
MAX_SUITE_NAME
);
break
;
...
...
@@ -326,8 +354,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
DES_KEY_SZ
;
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
DES
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
DES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_RSA_WITH_DES_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -340,8 +368,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
RC4_KEY_SZ
;
parms
.
iv_size_
=
0
;
parms
.
cipher_type_
=
stream
;
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
RC4
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
RC4
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_RSA_WITH_RC4_128_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -354,8 +382,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
RC4_KEY_SZ
;
parms
.
iv_size_
=
0
;
parms
.
cipher_type_
=
stream
;
crypto_
.
setDigest
(
new
MD5
);
crypto_
.
setCipher
(
new
RC4
);
crypto_
.
setDigest
(
new
(
ys
)
MD5
);
crypto_
.
setCipher
(
new
(
ys
)
RC4
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_RSA_WITH_RC4_128_MD5
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -370,8 +398,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
DES
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
DES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_DHE_RSA_WITH_DES_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -386,8 +414,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
DES_EDE
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
DES_EDE
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -402,8 +430,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
AES
(
AES_256_KEY_SZ
));
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
AES
(
AES_256_KEY_SZ
));
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_RSA_WITH_AES_256_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -418,8 +446,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
AES
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
AES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -434,8 +462,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
DES
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
DES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_DHE_DSS_WITH_DES_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -450,8 +478,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
DES_EDE
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
DES_EDE
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -466,8 +494,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
AES
(
AES_256_KEY_SZ
));
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
AES
(
AES_256_KEY_SZ
));
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_DSS_WITH_AES_256_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -482,8 +510,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
SHA
);
crypto_
.
setCipher
(
new
AES
);
crypto_
.
setDigest
(
new
(
ys
)
SHA
);
crypto_
.
setCipher
(
new
(
ys
)
AES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_DSS_WITH_AES_128_CBC_SHA
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -496,8 +524,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
AES_256_KEY_SZ
;
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
AES
(
AES_256_KEY_SZ
));
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
AES
(
AES_256_KEY_SZ
));
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_RSA_WITH_AES_256_CBC_RMD160
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -510,8 +538,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
AES_128_KEY_SZ
;
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
AES
);
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
AES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_RSA_WITH_AES_128_CBC_RMD160
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -524,8 +552,8 @@ void SSL::set_pending(Cipher suite)
parms
.
key_size_
=
DES_EDE_KEY_SZ
;
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
DES_EDE
);
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
DES_EDE
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_RSA_WITH_3DES_EDE_CBC_RMD160
],
MAX_SUITE_NAME
);
break
;
...
...
@@ -540,8 +568,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
DES_EDE
);
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
DES_EDE
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_RSA_WITH_3DES_EDE_CBC_RMD160
],
MAX_SUITE_NAME
);
...
...
@@ -557,8 +585,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
AES
(
AES_256_KEY_SZ
));
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
AES
(
AES_256_KEY_SZ
));
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_RSA_WITH_AES_256_CBC_RMD160
],
MAX_SUITE_NAME
);
...
...
@@ -574,8 +602,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
AES
);
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
AES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_RSA_WITH_AES_128_CBC_RMD160
],
MAX_SUITE_NAME
);
...
...
@@ -591,8 +619,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
DES_IV_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
DES_EDE
);
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
DES_EDE
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_DSS_WITH_3DES_EDE_CBC_RMD160
],
MAX_SUITE_NAME
);
...
...
@@ -608,8 +636,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
AES
(
AES_256_KEY_SZ
));
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
AES
(
AES_256_KEY_SZ
));
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_DSS_WITH_AES_256_CBC_RMD160
],
MAX_SUITE_NAME
);
...
...
@@ -625,8 +653,8 @@ void SSL::set_pending(Cipher suite)
parms
.
iv_size_
=
AES_BLOCK_SZ
;
parms
.
cipher_type_
=
block
;
secure_
.
use_connection
().
send_server_key_
=
true
;
// eph
crypto_
.
setDigest
(
new
RMD
);
crypto_
.
setCipher
(
new
AES
);
crypto_
.
setDigest
(
new
(
ys
)
RMD
);
crypto_
.
setCipher
(
new
(
ys
)
AES
);
strncpy
(
parms
.
cipher_name_
,
cipher_names
[
TLS_DHE_DSS_WITH_AES_128_CBC_RMD160
],
MAX_SUITE_NAME
);
...
...
@@ -940,7 +968,7 @@ void SSL::fillData(Data& data)
if
(
readSz
==
frontSz
)
{
buffers_
.
useData
().
pop_front
();
delete
front
;
ysDelete
(
front
)
;
}
if
(
data
.
get_length
()
==
dataSz
)
break
;
...
...
@@ -964,7 +992,7 @@ void SSL::flushBuffer()
out
.
write
(
front
->
get_buffer
(),
front
->
get_size
());
buffers_
.
useHandShake
().
pop_front
();
delete
front
;
ysDelete
(
front
)
;
}
Send
(
out
.
get_buffer
(),
out
.
get_size
());
}
...
...
@@ -1346,7 +1374,7 @@ typedef Mutex::Lock Lock;
void
Sessions
::
add
(
const
SSL
&
ssl
)
{
Lock
guard
(
mutex_
);
list_
.
push_back
(
new
SSL_SESSION
(
ssl
,
random_
));
list_
.
push_back
(
new
(
ys
)
SSL_SESSION
(
ssl
,
random_
));
}
...
...
@@ -1459,9 +1487,9 @@ SSL_CTX::SSL_CTX(SSL_METHOD* meth)
SSL_CTX
::~
SSL_CTX
()
{
delete
method_
;
delete
certificate_
;
delete
privateKey_
;
ysDelete
(
method_
)
;
ysDelete
(
certificate_
)
;
ysDelete
(
privateKey_
)
;
mySTL
::
for_each
(
caList_
.
begin
(),
caList_
.
end
(),
del_ptr_zero
());
}
...
...
@@ -1667,9 +1695,9 @@ Crypto::Crypto()
Crypto
::~
Crypto
()
{
delete
dh_
;
delete
cipher_
;
delete
digest_
;
ysDelete
(
dh_
)
;
ysDelete
(
cipher_
)
;
ysDelete
(
digest_
)
;
}
...
...
@@ -1744,7 +1772,7 @@ void Crypto::SetDH(DiffieHellman* dh)
void
Crypto
::
SetDH
(
const
DH_Parms
&
dh
)
{
if
(
dh
.
set_
)
dh_
=
new
DiffieHellman
(
dh
.
p_
,
dh
.
g_
,
random_
);
dh_
=
new
(
ys
)
DiffieHellman
(
dh
.
p_
,
dh
.
g_
,
random_
);
}
...
...
@@ -1911,7 +1939,7 @@ X509_NAME::X509_NAME(const char* n, size_t sz)
:
name_
(
0
)
{
if
(
sz
)
{
name_
=
new
char
[
sz
];
name_
=
new
(
ys
)
char
[
sz
];
memcpy
(
name_
,
n
,
sz
);
}
}
...
...
@@ -1919,7 +1947,7 @@ X509_NAME::X509_NAME(const char* n, size_t sz)
X509_NAME
::~
X509_NAME
()
{
delete
[]
name_
;
ysArrayDelete
(
name_
)
;
}
...
...
extra/yassl/taocrypt/include/algebra.hpp
View file @
a3fe8602
...
...
@@ -38,7 +38,7 @@ namespace TaoCrypt {
// abcd = group.Add(a, group.Add(b, group.Add(c,d));
// Abstract Group
class
TAOCRYPT_NO_VTABLE
AbstractGroup
class
TAOCRYPT_NO_VTABLE
AbstractGroup
:
public
virtual_base
{
public:
typedef
Integer
Element
;
...
...
@@ -70,8 +70,8 @@ class TAOCRYPT_NO_VTABLE AbstractRing : public AbstractGroup
public:
typedef
Integer
Element
;
AbstractRing
()
{
m_mg
.
m_pRing
=
this
;}
AbstractRing
(
const
AbstractRing
&
source
)
:
AbstractGroup
()
{
m_mg
.
m_pRing
=
this
;}
AbstractRing
()
:
AbstractGroup
()
{
m_mg
.
m_pRing
=
this
;}
AbstractRing
(
const
AbstractRing
&
source
)
{
m_mg
.
m_pRing
=
this
;}
AbstractRing
&
operator
=
(
const
AbstractRing
&
source
)
{
return
*
this
;}
virtual
bool
IsUnit
(
const
Element
&
a
)
const
=
0
;
...
...
extra/yassl/taocrypt/include/asn.hpp
View file @
a3fe8602
...
...
@@ -106,7 +106,7 @@ class DH;
// General BER decoding
class
BER_Decoder
{
class
BER_Decoder
:
public
virtual_base
{
protected:
Source
&
source_
;
public:
...
...
@@ -184,7 +184,7 @@ class PublicKey {
word32
sz_
;
public:
explicit
PublicKey
(
const
byte
*
k
=
0
,
word32
s
=
0
);
~
PublicKey
()
{
delete
[]
key_
;
}
~
PublicKey
()
{
tcArrayDelete
(
key_
)
;
}
const
byte
*
GetKey
()
const
{
return
key_
;
}
word32
size
()
const
{
return
sz_
;
}
...
...
@@ -287,7 +287,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz);
// General DER encoding
class
DER_Encoder
{
class
DER_Encoder
:
public
virtual_base
{
public:
DER_Encoder
()
{}
virtual
~
DER_Encoder
()
{}
...
...
extra/yassl/taocrypt/include/block.hpp
View file @
a3fe8602
...
...
@@ -100,13 +100,13 @@ public:
CheckSize
(
n
);
if
(
n
==
0
)
return
0
;
return
new
T
[
n
];
return
new
(
tc
)
T
[
n
];
}
void
deallocate
(
void
*
p
,
size_type
n
)
{
memset
(
p
,
0
,
n
*
sizeof
(
T
));
delete
[]
(
T
*
)
p
;
tcArrayDelete
((
T
*
)
p
)
;
}
pointer
reallocate
(
T
*
p
,
size_type
oldSize
,
size_type
newSize
,
...
...
extra/yassl/taocrypt/include/hash.hpp
View file @
a3fe8602
...
...
@@ -32,7 +32,7 @@ namespace TaoCrypt {
// HASH
class
HASH
{
class
HASH
:
public
virtual_base
{
public:
virtual
~
HASH
()
{}
...
...
@@ -50,9 +50,9 @@ public:
class
HASHwithTransform
:
public
HASH
{
public:
HASHwithTransform
(
word32
digSz
,
word32
buffSz
)
:
digest_
(
new
word32
[
digSz
]),
buffer_
(
new
byte
[
buffSz
])
{}
virtual
~
HASHwithTransform
()
{
delete
[]
buffer_
;
delete
[]
digest_
;
}
:
digest_
(
new
(
tc
)
word32
[
digSz
]),
buffer_
(
new
(
tc
)
byte
[
buffSz
])
{}
virtual
~
HASHwithTransform
()
{
tcArrayDelete
(
buffer_
);
tcArrayDelete
(
digest_
);
}
virtual
ByteOrder
getByteOrder
()
const
=
0
;
virtual
word32
getPadSize
()
const
=
0
;
...
...
extra/yassl/taocrypt/include/integer.hpp
View file @
a3fe8602
...
...
@@ -136,9 +136,8 @@ public:
~
Integer
()
{}
static
const
Integer
&
Zero
();
static
const
Integer
&
One
();
static
const
Integer
&
Two
();
static
const
Integer
&
Zero
();
static
const
Integer
&
One
();
Integer
&
Ref
()
{
return
*
this
;
}
...
...
@@ -252,9 +251,6 @@ private:
friend
class
ModularArithmetic
;
friend
class
MontgomeryRepresentation
;
static
const
Integer
zero
;
static
const
Integer
one
;
static
const
Integer
two
;
Integer
(
word
value
,
unsigned
int
length
);
int
PositiveCompare
(
const
Integer
&
t
)
const
;
...
...
@@ -267,6 +263,9 @@ 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 @
a3fe8602
...
...
@@ -27,75 +27,59 @@
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "types.hpp"
#include "type_traits.hpp"
/*
namespace GCC_ABI {
extern "C" int __cxa_pure_virtual();
} */
namespace
TaoCrypt
{
// using GCC_ABI::__cxa_pure_virtual;
// define this if running on a big-endian CPU
#if !defined(LITTLE_ENDIAN_ORDER) && (defined(__BIG_ENDIAN__) || \
defined(__sparc) || defined(__sparc__) || defined(__hppa__) || \
defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
#define BIG_ENDIAN_ORDER
#endif
// library allocation
struct
new_t
{};
// TaoCrypt New type
extern
new_t
tc
;
// pass in parameter
#ifndef BIG_ENDIAN_ORDER
#define LITTLE_ENDIAN_ORDER
#endif
}
// namespace TaoCrypt
void
*
operator
new
(
size_t
,
TaoCrypt
::
new_t
);
void
*
operator
new
[](
size_t
,
TaoCrypt
::
new_t
);
typedef
unsigned
char
byte
;
typedef
unsigned
short
word16
;
typedef
unsigned
int
word32
;
#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE)
#define WORD64_AVAILABLE
typedef
unsigned
long
long
word64
;
#define W64LIT(x) x##LL
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE
typedef
unsigned
__int64
word64
;
#define W64LIT(x) x##ui64
#elif defined(__DECCXX)
#define WORD64_AVAILABLE
typedef
unsigned
long
word64
;
#endif
void
operator
delete
(
void
*
,
TaoCrypt
::
new_t
);
void
operator
delete
[](
void
*
,
TaoCrypt
::
new_t
);
// define largest word type
#ifdef WORD64_AVAILABLE
typedef
word64
lword
;
#else
typedef
word32
lword
;
#endif
// FIXME the !defined(__sun) is a temporarely solution until asm for
// __x86_64__ and Solaris is written
#if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \
defined(__mips64) || (defined(__x86_64__) && !defined(__sun))
// 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
// without using assembly, so in order to use word64 as word, the assembly
// instruction must be defined in Dword::Multiply().
typedef
word32
hword
;
typedef
word64
word
;
#else
#define TAOCRYPT_NATIVE_DWORD_AVAILABLE
#ifdef WORD64_AVAILABLE
#define TAOCRYPT_SLOW_WORD64
// define this if your CPU is not64-bit to use alternative code
// that avoids word64
typedef
word16
hword
;
typedef
word32
word
;
typedef
word64
dword
;
#else
typedef
byte
hword
;
typedef
word16
word
;
typedef
word32
dword
;
#endif
#endif
namespace
TaoCrypt
{
const
word32
WORD_SIZE
=
sizeof
(
word
);
const
word32
WORD_BITS
=
WORD_SIZE
*
8
;
template
<
typename
T
>
void
tcDelete
(
T
*
ptr
)
{
if
(
ptr
)
ptr
->~
T
();
::
operator
delete
(
ptr
,
TaoCrypt
::
tc
);
}
template
<
typename
T
>
void
tcArrayDelete
(
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
[
IsFundamentalType
<
T
>::
Yes
?
1
:
-
1
];
(
void
)
sizeof
(
builtin
);
::
operator
delete
[](
ptr
,
TaoCrypt
::
tc
);
}
// to resolve compiler generated operator delete on base classes with
// virtual destructors, make sure doesn't get called
class
virtual_base
{
public:
static
void
operator
delete
(
void
*
)
{
assert
(
0
);
}
};
#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
...
...
extra/yassl/taocrypt/include/modes.hpp
View file @
a3fe8602
...
...
@@ -56,7 +56,7 @@ private:
// Mode Base for block ciphers, static size
class
Mode_BASE
{
class
Mode_BASE
:
public
virtual_base
{
public:
enum
{
MaxBlockSz
=
16
};
...
...
extra/yassl/taocrypt/include/runtime.hpp
View file @
a3fe8602
...
...
@@ -31,30 +31,6 @@
#if __GNUC__ > 2
#include <stdlib.h>
static
void
*
operator
new
(
size_t
sz
)
{
return
malloc
(
sz
?
sz
:
1
);
}
static
void
*
operator
new
[](
size_t
sz
)
{
return
malloc
(
sz
?
sz
:
1
);
}
static
void
operator
delete
(
void
*
ptr
)
{
if
(
ptr
)
free
(
ptr
);
}
static
void
operator
delete
[]
(
void
*
ptr
)
{
if
(
ptr
)
free
(
ptr
);
}
extern
"C"
{
#include <assert.h>
...
...
extra/yassl/taocrypt/include/type_traits.hpp
0 → 100644
View file @
a3fe8602
/* type_traits.hpp
*
* 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
*/
/* type_traits defines fundamental types
* see discussion in C++ Templates, $19.1
*/
#ifndef TAO_CRYPT_TYPE_TRAITS_HPP
#define TAO_CRYPT_TYPE_TRAITS_HPP
#include "types.hpp"
namespace
TaoCrypt
{
// primary template: in general T is not a fundamental type
template
<
typename
T
>
class
IsFundamentalType
{
public:
enum
{
Yes
=
0
,
No
=
1
};
};
// macro to specialize for fundamental types
#define MK_FUNDAMENTAL_TYPE(T) \
template<> class IsFundamentalType<T> { \
public: \
enum { Yes = 1, No = 0 }; \
};
MK_FUNDAMENTAL_TYPE
(
void
)
MK_FUNDAMENTAL_TYPE
(
bool
)
MK_FUNDAMENTAL_TYPE
(
char
)
MK_FUNDAMENTAL_TYPE
(
signed
char
)
MK_FUNDAMENTAL_TYPE
(
unsigned
char
)
MK_FUNDAMENTAL_TYPE
(
signed
short
)
MK_FUNDAMENTAL_TYPE
(
unsigned
short
)
MK_FUNDAMENTAL_TYPE
(
signed
int
)
MK_FUNDAMENTAL_TYPE
(
unsigned
int
)
MK_FUNDAMENTAL_TYPE
(
signed
long
)
MK_FUNDAMENTAL_TYPE
(
unsigned
long
)
MK_FUNDAMENTAL_TYPE
(
float
)
MK_FUNDAMENTAL_TYPE
(
double
)
MK_FUNDAMENTAL_TYPE
(
long
double
)
#ifdef WORD64_AVAILABLE
MK_FUNDAMENTAL_TYPE
(
word64
)
#endif
#undef MK_FUNDAMENTAL_TYPE
}
// namespace
#endif // TAO_CRYPT_TYPE_TRAITS_HPP
extra/yassl/taocrypt/include/types.hpp
0 → 100644
View file @
a3fe8602
/* types.hpp
*
* 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
*/
/* based on Wei Dai's misc.h from CryptoPP, basic crypt types */
#ifndef TAO_CRYPT_TYPES_HPP
#define TAO_CRYPT_TYPES_HPP
namespace
TaoCrypt
{
// define this if running on a big-endian CPU
#if !defined(LITTLE_ENDIAN_ORDER) && (defined(__BIG_ENDIAN__) || \
defined(__sparc) || defined(__sparc__) || defined(__hppa__) || \
defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
#define BIG_ENDIAN_ORDER
#endif
#ifndef BIG_ENDIAN_ORDER
#define LITTLE_ENDIAN_ORDER
#endif
typedef
unsigned
char
byte
;
typedef
unsigned
short
word16
;
typedef
unsigned
int
word32
;
#if defined(__GNUC__) || defined(__MWERKS__) || defined(_LONGLONG_TYPE)
#define WORD64_AVAILABLE
typedef
unsigned
long
long
word64
;
#define W64LIT(x) x##LL
#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
#define WORD64_AVAILABLE
typedef
unsigned
__int64
word64
;
#define W64LIT(x) x##ui64
#elif defined(__DECCXX)
#define WORD64_AVAILABLE
typedef
unsigned
long
word64
;
#endif
// define largest word type
#ifdef WORD64_AVAILABLE
typedef
word64
lword
;
#else
typedef
word32
lword
;
#endif
// TODO: FIXME, add asm multiply for x86_64 on Solaris and remove !__sun
#if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || \
defined(__mips64) || (defined(__x86_64__) && !defined(__sun))
// 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
// without using assembly, so in order to use word64 as word, the assembly
// instruction must be defined in Dword::Multiply().
typedef
word32
hword
;
typedef
word64
word
;
#else
#define TAOCRYPT_NATIVE_DWORD_AVAILABLE
#ifdef WORD64_AVAILABLE
#define TAOCRYPT_SLOW_WORD64
// define this if your CPU is not64-bit to use alternative code
// that avoids word64
typedef
word16
hword
;
typedef
word32
word
;
typedef
word64
dword
;
#else
typedef
byte
hword
;
typedef
word16
word
;
typedef
word32
dword
;
#endif
#endif
const
word32
WORD_SIZE
=
sizeof
(
word
);
const
word32
WORD_BITS
=
WORD_SIZE
*
8
;
}
// namespace
#endif // TAO_CRYPT_TYPES_HPP
extra/yassl/taocrypt/src/Makefile.am
View file @
a3fe8602
...
...
@@ -3,5 +3,6 @@ INCLUDES = -I../include -I../../mySTL
noinst_LIBRARIES
=
libtaocrypt.a
libtaocrypt_a_SOURCES
=
aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp
\
coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp integer.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
EXTRA_DIST
=
../include/
*
.hpp
extra/yassl/taocrypt/src/aestables.cpp
View file @
a3fe8602
...
...
@@ -21,7 +21,6 @@
/* based on Wei Dai's aestables.cpp from CryptoPP */
#include "runtime.hpp"
#include "aes.hpp"
...
...
extra/yassl/taocrypt/src/algebra.cpp
View file @
a3fe8602
...
...
@@ -322,8 +322,6 @@ void AbstractRing::SimultaneousExponentiate(Integer *results,
#ifdef __GNUC__
namespace
mySTL
{
template
TaoCrypt
::
WindowSlider
*
uninit_copy
<
TaoCrypt
::
WindowSlider
*
,
TaoCrypt
::
WindowSlider
*
>(
TaoCrypt
::
WindowSlider
*
,
TaoCrypt
::
WindowSlider
*
,
TaoCrypt
::
WindowSlider
*
);
template
vector
<
TaoCrypt
::
Integer
>
*
uninit_fill_n
<
vector
<
TaoCrypt
::
Integer
>*
,
unsigned
int
,
vector
<
TaoCrypt
::
Integer
>
>
(
vector
<
TaoCrypt
::
Integer
>*
,
unsigned
int
,
vector
<
TaoCrypt
::
Integer
>
const
&
);
template
void
destroy
<
TaoCrypt
::
WindowSlider
*
>(
TaoCrypt
::
WindowSlider
*
,
TaoCrypt
::
WindowSlider
*
);
template
void
destroy
<
vector
<
TaoCrypt
::
Integer
>
*>
(
vector
<
TaoCrypt
::
Integer
>*
,
vector
<
TaoCrypt
::
Integer
>*
);
}
#endif
extra/yassl/taocrypt/src/arc4.cpp
View file @
a3fe8602
...
...
@@ -21,7 +21,6 @@
/* based on Wei Dai's arc4.cpp from CryptoPP */
#include "runtime.hpp"
#include "arc4.hpp"
...
...
extra/yassl/taocrypt/src/asn.cpp
View file @
a3fe8602
...
...
@@ -187,7 +187,7 @@ PublicKey::PublicKey(const byte* k, word32 s) : key_(0), sz_(0)
void
PublicKey
::
SetSize
(
word32
s
)
{
sz_
=
s
;
key_
=
new
byte
[
sz_
];
key_
=
new
(
tc
)
byte
[
sz_
];
}
...
...
@@ -199,14 +199,14 @@ void PublicKey::SetKey(const byte* k)
void
PublicKey
::
AddToEnd
(
const
byte
*
data
,
word32
len
)
{
mySTL
::
auto_ptr
<
byte
>
tmp
(
new
byte
[
sz_
+
len
]
);
mySTL
::
auto_ptr
<
byte
>
tmp
(
new
(
tc
)
byte
[
sz_
+
len
],
tcArrayDelete
);
memcpy
(
tmp
.
get
(),
key_
,
sz_
);
memcpy
(
tmp
.
get
()
+
sz_
,
data
,
len
);
byte
*
del
=
0
;
mySTL
::
swap
(
del
,
key_
);
delete
[]
del
;
tcArrayDelete
(
del
)
;
key_
=
tmp
.
release
();
sz_
+=
len
;
...
...
@@ -218,7 +218,7 @@ Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h)
{
if
(
n
)
{
int
sz
=
strlen
(
n
);
name_
=
new
char
[
sz
+
1
];
name_
=
new
(
tc
)
char
[
sz
+
1
];
memcpy
(
name_
,
n
,
sz
);
name_
[
sz
]
=
0
;
}
...
...
@@ -228,7 +228,7 @@ Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h)
Signer
::~
Signer
()
{
delete
[]
name_
;
tcArrayDelete
(
name_
)
;
}
...
...
@@ -433,9 +433,9 @@ CertDecoder::CertDecoder(Source& s, bool decode, SignerList* signers)
CertDecoder
::~
CertDecoder
()
{
delete
[]
subject_
;
delete
[]
issuer_
;
delete
[]
signature_
;
tcArrayDelete
(
subject_
)
;
tcArrayDelete
(
issuer_
)
;
tcArrayDelete
(
signature_
)
;
}
...
...
@@ -632,7 +632,7 @@ word32 CertDecoder::GetSignature()
}
sigLength_
--
;
signature_
=
new
byte
[
sigLength_
];
signature_
=
new
(
tc
)
byte
[
sigLength_
];
memcpy
(
signature_
,
source_
.
get_current
(),
sigLength_
);
source_
.
advance
(
sigLength_
);
...
...
@@ -653,7 +653,7 @@ word32 CertDecoder::GetDigest()
sigLength_
=
GetLength
(
source_
);
signature_
=
new
byte
[
sigLength_
];
signature_
=
new
(
tc
)
byte
[
sigLength_
];
memcpy
(
signature_
,
source_
.
get_current
(),
sigLength_
);
source_
.
advance
(
sigLength_
);
...
...
@@ -693,7 +693,7 @@ void CertDecoder::GetName(NameType nt)
if
(
id
==
COMMON_NAME
)
{
char
*&
ptr
=
(
nt
==
ISSUER
)
?
issuer_
:
subject_
;
ptr
=
new
char
[
strLen
+
1
];
ptr
=
new
(
tc
)
char
[
strLen
+
1
];
memcpy
(
ptr
,
source_
.
get_current
(),
strLen
);
ptr
[
strLen
]
=
0
;
}
...
...
@@ -807,18 +807,18 @@ bool CertDecoder::ValidateSignature(SignerList* signers)
bool
CertDecoder
::
ConfirmSignature
(
Source
&
pub
)
{
HashType
ht
;
mySTL
::
auto_ptr
<
HASH
>
hasher
;
mySTL
::
auto_ptr
<
HASH
>
hasher
(
tcDelete
)
;
if
(
signatureOID_
==
MD5wRSA
)
{
hasher
.
reset
(
new
MD5
);
hasher
.
reset
(
new
(
tc
)
MD5
);
ht
=
MD5h
;
}
else
if
(
signatureOID_
==
MD2wRSA
)
{
hasher
.
reset
(
new
MD2
);
hasher
.
reset
(
new
(
tc
)
MD2
);
ht
=
MD2h
;
}
else
if
(
signatureOID_
==
SHAwRSA
||
signatureOID_
==
SHAwDSA
)
{
hasher
.
reset
(
new
SHA
);
hasher
.
reset
(
new
(
tc
)
SHA
);
ht
=
SHAh
;
}
else
{
...
...
extra/yassl/taocrypt/src/coding.cpp
View file @
a3fe8602
...
...
@@ -22,7 +22,6 @@
/* coding.cpp implements hex and base64 encoding/decoing
*/
#include "runtime.hpp"
#include "coding.hpp"
#include "file.hpp"
...
...
extra/yassl/taocrypt/src/dh.cpp
View file @
a3fe8602
...
...
@@ -23,7 +23,6 @@
/* dh.cpp implements Diffie-Hellman support
*/
#include "runtime.hpp"
#include "dh.hpp"
#include "asn.hpp"
...
...
extra/yassl/taocrypt/src/dsa.cpp
View file @
a3fe8602
...
...
@@ -20,7 +20,6 @@
*/
#include "runtime.hpp"
#include "dsa.hpp"
#include "sha.hpp"
#include "asn.hpp"
...
...
extra/yassl/taocrypt/src/file.cpp
View file @
a3fe8602
...
...
@@ -22,7 +22,6 @@
/* file.cpp implements File Sources and Sinks
*/
#include "runtime.hpp"
#include "file.hpp"
...
...
extra/yassl/taocrypt/src/integer.cpp
View file @
a3fe8602
...
...
@@ -32,7 +32,6 @@
# pragma warning(disable: 4250 4660 4661 4786 4355)
#endif
#include "runtime.hpp"
#include "integer.hpp"
#include "modarith.hpp"
#include "asn.hpp"
...
...
@@ -108,7 +107,7 @@ CPP_TYPENAME AllocatorBase<T>::pointer AlignedAllocator<T>::allocate(
assert
(
IsAlignedOn
(
p
,
16
));
return
(
T
*
)
p
;
}
return
new
T
[
n
];
return
new
(
tc
)
T
[
n
];
}
...
...
@@ -129,7 +128,7 @@ void AlignedAllocator<T>::deallocate(void* p, size_type n)
#endif
}
else
delete
[]
(
T
*
)
p
;
tcArrayDelete
((
T
*
)
p
)
;
}
#endif // SSE2
...
...
@@ -2691,25 +2690,19 @@ unsigned int Integer::Encode(byte* output, unsigned int outputLen,
}
const
Integer
Integer
::
zero
(
1
,
2
)
;
const
Integer
Integer
::
zero
_
;
const
Integer
&
Integer
::
Zero
()
{
return
zero
;
return
zero
_
;
}
const
Integer
Integer
::
one
(
1
,
2
);
const
Integer
&
Integer
::
One
()
{
return
one
;
}
const
Integer
Integer
::
one_
(
1
,
2
);
const
Integer
Integer
::
two
(
1
,
2
);
const
Integer
&
Integer
::
Two
()
const
Integer
&
Integer
::
One
()
{
return
two
;
return
one_
;
}
...
...
@@ -3948,9 +3941,6 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq,
#ifdef __GNUC__
template
unsigned
int
DivideThreeWordsByTwo
<
unsigned
int
,
DWord
>(
unsigned
int
*
,
unsigned
int
,
unsigned
int
,
DWord
*
);
#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
#endif
}
// namespace
...
...
extra/yassl/taocrypt/src/misc.cpp
View file @
a3fe8602
...
...
@@ -22,14 +22,73 @@
/* based on Wei Dai's misc.cpp from CryptoPP */
#include "runtime.hpp"
#include "misc.hpp"
#include <new> // for NewHandler
void
*
operator
new
(
size_t
sz
,
TaoCrypt
::
new_t
)
{
void
*
ptr
=
malloc
(
sz
?
sz
:
1
);
if
(
!
ptr
)
abort
();
return
ptr
;
}
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
)
{
if
(
ptr
)
free
(
ptr
);
}
void
operator
delete
[](
void
*
ptr
,
TaoCrypt
::
new_t
)
{
if
(
ptr
)
free
(
ptr
);
}
/* uncomment to test
// make sure not using globals anywhere by forgetting to use overloaded
void* operator new(size_t sz)
{
assert(0);
return malloc(sz);
}
void operator delete(void* ptr)
{
assert(0);
}
void* operator new[](size_t sz)
{
assert(0);
return malloc(sz);
}
void operator delete[](void* ptr)
{
assert(0);
}
*/
/* namespace GCC_ABI {
extern "C" int __cxa_pure_virtual() { assert(0); return 0; }
} */
namespace
TaoCrypt
{
new_t
tc
;
// for library new
inline
void
XorWords
(
word
*
r
,
const
word
*
a
,
unsigned
int
n
)
{
for
(
unsigned
int
i
=
0
;
i
<
n
;
i
++
)
...
...
extra/yassl/taocrypt/src/random.cpp
View file @
a3fe8602
...
...
@@ -24,7 +24,6 @@
specific seed, switch to /dev/random for more security but may block
*/
#include "runtime.hpp"
#include "random.hpp"
#if defined(WIN32)
...
...
extra/yassl/taocrypt/src/rsa.cpp
View file @
a3fe8602
...
...
@@ -21,7 +21,6 @@
/* based on Wei Dai's rsa.cpp from CryptoPP */
#include "runtime.hpp"
#include "rsa.hpp"
#include "asn.hpp"
#include "modarith.hpp"
...
...
@@ -210,22 +209,5 @@ word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain)
lengths
.
PaddedBlockBitLength
(),
plain
);
}
#ifdef __GNUC__
template
AllocatorWithCleanup
<
unsigned
char
>
::
pointer
StdReallocate
<
unsigned
char
,
AllocatorWithCleanup
<
unsigned
char
>
>
(
AllocatorWithCleanup
<
unsigned
char
>&
,
unsigned
char
*
,
AllocatorWithCleanup
<
unsigned
char
>::
size_type
,
AllocatorWithCleanup
<
unsigned
char
>::
size_type
,
bool
);
template
AllocatorWithCleanup
<
unsigned
int
>
::
pointer
StdReallocate
<
unsigned
int
,
AllocatorWithCleanup
<
unsigned
int
>
>
(
AllocatorWithCleanup
<
unsigned
int
>&
,
unsigned
int
*
,
AllocatorWithCleanup
<
unsigned
int
>::
size_type
,
AllocatorWithCleanup
<
unsigned
int
>::
size_type
,
bool
);
template
class
RSA_Decryptor
<
RSA_BlockType2
>;
template
class
RSA_Encryptor
<
RSA_BlockType1
>;
template
class
RSA_Encryptor
<
RSA_BlockType2
>;
#endif
}
// namespace
#ifdef __GNUC__
namespace
mySTL
{
template
TaoCrypt
::
Integer
*
uninit_copy
<
TaoCrypt
::
Integer
*
,
TaoCrypt
::
Integer
*
>(
TaoCrypt
::
Integer
*
,
TaoCrypt
::
Integer
*
,
TaoCrypt
::
Integer
*
);
template
TaoCrypt
::
Integer
*
uninit_fill_n
<
TaoCrypt
::
Integer
*
,
unsigned
int
,
TaoCrypt
::
Integer
>(
TaoCrypt
::
Integer
*
,
unsigned
int
,
TaoCrypt
::
Integer
const
&
);
template
void
destroy
<
TaoCrypt
::
Integer
*
>(
TaoCrypt
::
Integer
*
,
TaoCrypt
::
Integer
*
);
}
#endif
extra/yassl/taocrypt/src/template_instnt.cpp
0 → 100644
View file @
a3fe8602
#include "integer.hpp"
#include "rsa.hpp"
#include "algebra.hpp"
#include "vector.hpp"
#include "hash.hpp"
#ifdef __GNUC__
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
AllocatorWithCleanup
<
unsigned
char
>
::
pointer
StdReallocate
<
unsigned
char
,
AllocatorWithCleanup
<
unsigned
char
>
>
(
AllocatorWithCleanup
<
unsigned
char
>&
,
unsigned
char
*
,
AllocatorWithCleanup
<
unsigned
char
>::
size_type
,
AllocatorWithCleanup
<
unsigned
char
>::
size_type
,
bool
);
template
AllocatorWithCleanup
<
unsigned
int
>
::
pointer
StdReallocate
<
unsigned
int
,
AllocatorWithCleanup
<
unsigned
int
>
>
(
AllocatorWithCleanup
<
unsigned
int
>&
,
unsigned
int
*
,
AllocatorWithCleanup
<
unsigned
int
>::
size_type
,
AllocatorWithCleanup
<
unsigned
int
>::
size_type
,
bool
);
template
class
RSA_Decryptor
<
RSA_BlockType2
>;
template
class
RSA_Encryptor
<
RSA_BlockType1
>;
template
class
RSA_Encryptor
<
RSA_BlockType2
>;
}
namespace
mySTL
{
template
vector
<
TaoCrypt
::
Integer
>
*
uninit_fill_n
<
vector
<
TaoCrypt
::
Integer
>*
,
unsigned
int
,
vector
<
TaoCrypt
::
Integer
>
>
(
vector
<
TaoCrypt
::
Integer
>*
,
unsigned
int
,
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
*
,
unsigned
int
,
TaoCrypt
::
Integer
>(
TaoCrypt
::
Integer
*
,
unsigned
int
,
TaoCrypt
::
Integer
const
&
);
template
void
destroy
<
TaoCrypt
::
Integer
*
>(
TaoCrypt
::
Integer
*
,
TaoCrypt
::
Integer
*
);
}
template
void
TaoCrypt
::
tcDelete
<
TaoCrypt
::
HASH
>(
TaoCrypt
::
HASH
*
);
template
void
TaoCrypt
::
tcArrayDelete
<
unsigned
>(
unsigned
*
);
template
void
TaoCrypt
::
tcArrayDelete
<
unsigned
char
>(
unsigned
char
*
);
template
void
TaoCrypt
::
tcArrayDelete
<
char
>(
char
*
);
#endif
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