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
99c0fdb5
Commit
99c0fdb5
authored
Sep 27, 2016
by
Robert Golebiowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #24740291: YASSL UPDATE TO 2.4.2
parent
d933b881
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
274 additions
and
122 deletions
+274
-122
extra/yassl/README
extra/yassl/README
+18
-0
extra/yassl/certs/dsa-cert.pem
extra/yassl/certs/dsa-cert.pem
+19
-19
extra/yassl/include/openssl/ssl.h
extra/yassl/include/openssl/ssl.h
+1
-1
extra/yassl/src/ssl.cpp
extra/yassl/src/ssl.cpp
+44
-16
extra/yassl/taocrypt/include/aes.hpp
extra/yassl/taocrypt/include/aes.hpp
+58
-0
extra/yassl/taocrypt/include/integer.hpp
extra/yassl/taocrypt/include/integer.hpp
+3
-0
extra/yassl/taocrypt/src/aes.cpp
extra/yassl/taocrypt/src/aes.cpp
+106
-66
extra/yassl/taocrypt/src/asn.cpp
extra/yassl/taocrypt/src/asn.cpp
+12
-12
extra/yassl/taocrypt/src/dsa.cpp
extra/yassl/taocrypt/src/dsa.cpp
+9
-7
extra/yassl/taocrypt/test/test.cpp
extra/yassl/taocrypt/test/test.cpp
+3
-0
extra/yassl/testsuite/test.hpp
extra/yassl/testsuite/test.hpp
+1
-1
No files found.
extra/yassl/README
View file @
99c0fdb5
...
...
@@ -12,6 +12,24 @@ before calling SSL_new();
*** end Note ***
yaSSL Release notes, version 2.4.2 (9/22/2016)
This release of yaSSL fixes a medium security vulnerability. A fix for
potential AES side channel leaks is included that a local user monitoring
the same CPU core cache could exploit. VM users, hyper-threading users,
and users where potential attackers have access to the CPU cache will need
to update if they utilize AES.
DSA padding fixes for unusual sizes is included as well. Users with DSA
certficiates should update.
yaSSL Release notes, version 2.4.0 (5/20/2016)
This release of yaSSL fixes the OpenSSL compatibility function
SSL_CTX_load_verify_locations() when using the path directory to allow
unlimited path sizes. Minor Windows build fixes are included.
No high level security fixes in this version but we always recommend
updating.
yaSSL Release notes, version 2.3.9b (2/03/2016)
This release of yaSSL fixes the OpenSSL compatibility function
X509_NAME_get_index_by_NID() to use the actual index of the common name
...
...
extra/yassl/certs/dsa-cert.pem
View file @
99c0fdb5
-----BEGIN CERTIFICATE-----
MIID
qzCCA2ugAwIBAgIJAMGqrgDU6DyhMAkGByqGSM44BAMwgY4
xCzAJBgNVBAYT
MIID
rzCCA2+gAwIBAgIJAK1zRM7YFcNjMAkGByqGSM44BAMwgZA
xCzAJBgNVBAYT
AlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQK
DAd3b2xmU1NMMRAwDgYDVQQLDAd0ZXN0aW5nMR
YwFAYDVQQDDA13d3cueWFzc2wu
Y29tMR8wHQYJKoZIhvcNAQkBFhBpbmZvQHdvbGZzc2wuY29tMB4XDTEzMDQyMjIw
M
Dk0NFoXDTE2MDExNzIwMDk0NFowgY4xCzAJBgNVBAYTAlVTMQ8wDQYDVQQIDAZP
cmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQKDAd3b2xmU1NMMRAwDgYD
VQQLDAd0ZXN0aW5nMRYwFAYDVQQDDA13d3cueWFzc2wuY29tMR8wHQYJKoZIhvcN
AQkBFhBpbmZvQHdvbGZzc2wuY29tMIIBuDCCASwGByqGSM44BA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AMMD3d3dy53b2xmc3NsLmNvbTEfMB0GCSqG
SIb3DQEJARYQaW5mb0B3b2xmc3NsLmNvbTCCAbgwggEsBgcqhkjOOAQBMIIBHwKB
gQC9Ue5KMuCKx+rG4epwxFFDzyoH4ccSwlglXsRdvqswDRK/oQvTNNNoWiVxTn3k
vQ8qDlhWy9KjGTrqr/ttgmh56FFpe6tz4yTgCNyR9D+eGclD7lNfdPUc4E3SA6ef
opG6+ymI55bS+9xUFTG402UCrYSKT59zI2HBfuI6dltsxQIVAJHJ7WDQ+jBn/nmM
yCQzdi+0qJx1AoGBAJJacRK36s5yGY1b6qhxWqvpoAC+SfEKylZnYWGYf2PM+Iw
o
6AgPKEw6BSsX+7Nmc4Gjyr4JWhComKi6onPamO/A2CbMM0DCxb47BeLBWfqWAgXV
j0CODT4MQos5yugnviR/YpEgbzLxvrXr469lKWsAyB19/gFmGmQWcCgAwGm6A4GF
A
AKBgQCdy2PPch8r0P07EOs5WG6L425P6IJ3bDKj3TVLy+Ebj04CT/3Gmgw2tFye
2pOgO0yfkIXizcDl6GT2CQuBBhUgwF6WJ4hoW1iK1UwhnupZmQ358eNFl0tJJN5v
wx2gtNxJSwIsm8VRscqqFH2092b9ScH7VjLoqhx+bgA4XV7l1aNQME4wHQYDVR0O
BBYEFCCY5ONeqOL/KqR/SwbV5Ufb/IHHMB8GA1UdIwQYMBaAFCCY5ONeqOL/KqR/
SwbV5Ufb/IHHMAwGA1UdEwQFMAMBAf8wCQYHKoZIzjgEAwMvADAsAhQRYSCVN/Ge
agV3mffU3qNZ92fI0QIUPH7Jp+iASI7U1ocaYDc10qXGaGY
=
-----END CERTIFICATE-----
extra/yassl/include/openssl/ssl.h
View file @
99c0fdb5
...
...
@@ -35,7 +35,7 @@
#include "rsa.h"
#define YASSL_VERSION "2.
3.9b
"
#define YASSL_VERSION "2.
4.2
"
#if defined(__cplusplus)
...
...
extra/yassl/src/ssl.cpp
View file @
99c0fdb5
...
...
@@ -161,7 +161,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
TaoCrypt
::
DSA_PrivateKey
dsaKey
;
dsaKey
.
Initialize
(
dsaSource
);
if
(
r
saSource
.
GetError
().
What
())
{
if
(
d
saSource
.
GetError
().
What
())
{
// neither worked
ret
=
SSL_FAILURE
;
}
...
...
@@ -784,40 +784,67 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
WIN32_FIND_DATA
FindFileData
;
HANDLE
hFind
;
char
name
[
MAX_PATH
+
1
];
// directory specification
strncpy
(
name
,
path
,
MAX_PATH
-
3
);
strncat
(
name
,
"
\\
*"
,
3
);
const
int
DELIMITER_SZ
=
2
;
const
int
DELIMITER_STAR_SZ
=
3
;
int
pathSz
=
(
int
)
strlen
(
path
);
int
nameSz
=
pathSz
+
DELIMITER_STAR_SZ
+
1
;
// plus 1 for terminator
char
*
name
=
NEW_YS
char
[
nameSz
];
// directory specification
memset
(
name
,
0
,
nameSz
);
strncpy
(
name
,
path
,
nameSz
-
DELIMITER_STAR_SZ
-
1
);
strncat
(
name
,
"
\\
*"
,
DELIMITER_STAR_SZ
);
hFind
=
FindFirstFile
(
name
,
&
FindFileData
);
if
(
hFind
==
INVALID_HANDLE_VALUE
)
return
SSL_BAD_PATH
;
if
(
hFind
==
INVALID_HANDLE_VALUE
)
{
ysArrayDelete
(
name
);
return
SSL_BAD_PATH
;
}
do
{
if
(
FindFileData
.
dwFileAttributes
!=
FILE_ATTRIBUTE_DIRECTORY
)
{
strncpy
(
name
,
path
,
MAX_PATH
-
2
-
HALF_PATH
);
strncat
(
name
,
"
\\
"
,
2
);
strncat
(
name
,
FindFileData
.
cFileName
,
HALF_PATH
);
if
(
!
(
FindFileData
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
int
curSz
=
(
int
)
strlen
(
FindFileData
.
cFileName
);
if
(
pathSz
+
curSz
+
DELIMITER_SZ
+
1
>
nameSz
)
{
ysArrayDelete
(
name
);
// plus 1 for terminator
nameSz
=
pathSz
+
curSz
+
DELIMITER_SZ
+
1
;
name
=
NEW_YS
char
[
nameSz
];
}
memset
(
name
,
0
,
nameSz
);
strncpy
(
name
,
path
,
nameSz
-
curSz
-
DELIMITER_SZ
-
1
);
strncat
(
name
,
"
\\
"
,
DELIMITER_SZ
);
strncat
(
name
,
FindFileData
.
cFileName
,
nameSz
-
pathSz
-
DELIMITER_SZ
-
1
);
ret
=
read_file
(
ctx
,
name
,
SSL_FILETYPE_PEM
,
CA
);
}
}
while
(
ret
==
SSL_SUCCESS
&&
FindNextFile
(
hFind
,
&
FindFileData
));
ysArrayDelete
(
name
);
FindClose
(
hFind
);
#else // _WIN32
const
int
MAX_PATH
=
260
;
DIR
*
dir
=
opendir
(
path
);
if
(
!
dir
)
return
SSL_BAD_PATH
;
struct
dirent
*
entry
;
struct
stat
buf
;
char
name
[
MAX_PATH
+
1
];
const
int
DELIMITER_SZ
=
1
;
int
pathSz
=
(
int
)
strlen
(
path
);
int
nameSz
=
pathSz
+
DELIMITER_SZ
+
1
;
//plus 1 for null terminator
char
*
name
=
NEW_YS
char
[
nameSz
];
// directory specification
while
(
ret
==
SSL_SUCCESS
&&
(
entry
=
readdir
(
dir
)))
{
strncpy
(
name
,
path
,
MAX_PATH
-
1
-
HALF_PATH
);
strncat
(
name
,
"/"
,
1
);
strncat
(
name
,
entry
->
d_name
,
HALF_PATH
);
int
curSz
=
(
int
)
strlen
(
entry
->
d_name
);
if
(
pathSz
+
curSz
+
DELIMITER_SZ
+
1
>
nameSz
)
{
ysArrayDelete
(
name
);
nameSz
=
pathSz
+
DELIMITER_SZ
+
curSz
+
1
;
name
=
NEW_YS
char
[
nameSz
];
}
memset
(
name
,
0
,
nameSz
);
strncpy
(
name
,
path
,
nameSz
-
curSz
-
1
);
strncat
(
name
,
"/"
,
DELIMITER_SZ
);
strncat
(
name
,
entry
->
d_name
,
nameSz
-
pathSz
-
DELIMITER_SZ
-
1
);
if
(
stat
(
name
,
&
buf
)
<
0
)
{
ysArrayDelete
(
name
);
closedir
(
dir
);
return
SSL_BAD_STAT
;
}
...
...
@@ -826,6 +853,7 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
ret
=
read_file
(
ctx
,
name
,
SSL_FILETYPE_PEM
,
CA
);
}
ysArrayDelete
(
name
);
closedir
(
dir
);
#endif
...
...
extra/yassl/taocrypt/include/aes.hpp
View file @
99c0fdb5
...
...
@@ -60,6 +60,7 @@ private:
static
const
word32
Te
[
5
][
256
];
static
const
word32
Td
[
5
][
256
];
static
const
byte
CTd4
[
256
];
static
const
word32
*
Te0
;
static
const
word32
*
Te1
;
...
...
@@ -80,11 +81,68 @@ private:
void
ProcessAndXorBlock
(
const
byte
*
,
const
byte
*
,
byte
*
)
const
;
word32
PreFetchTe
()
const
;
word32
PreFetchTd
()
const
;
word32
PreFetchCTd4
()
const
;
AES
(
const
AES
&
);
// hide copy
AES
&
operator
=
(
const
AES
&
);
// and assign
};
#if defined(__x86_64__) || defined(_M_X64) || \
(defined(__ILP32__) && (__ILP32__ >= 1))
#define TC_CACHE_LINE_SZ 64
#else
/* default cache line size */
#define TC_CACHE_LINE_SZ 32
#endif
inline
word32
AES
::
PreFetchTe
()
const
{
word32
x
=
0
;
/* 4 tables of 256 entries */
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
/* each entry is 4 bytes */
for
(
int
j
=
0
;
j
<
256
;
j
+=
TC_CACHE_LINE_SZ
/
4
)
{
x
&=
Te
[
i
][
j
];
}
}
return
x
;
}
inline
word32
AES
::
PreFetchTd
()
const
{
word32
x
=
0
;
/* 4 tables of 256 entries */
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
/* each entry is 4 bytes */
for
(
int
j
=
0
;
j
<
256
;
j
+=
TC_CACHE_LINE_SZ
/
4
)
{
x
&=
Td
[
i
][
j
];
}
}
return
x
;
}
inline
word32
AES
::
PreFetchCTd4
()
const
{
word32
x
=
0
;
int
i
;
for
(
i
=
0
;
i
<
256
;
i
+=
TC_CACHE_LINE_SZ
)
{
x
&=
CTd4
[
i
];
}
return
x
;
}
typedef
BlockCipher
<
ENCRYPTION
,
AES
,
ECB
>
AES_ECB_Encryption
;
typedef
BlockCipher
<
DECRYPTION
,
AES
,
ECB
>
AES_ECB_Decryption
;
...
...
extra/yassl/taocrypt/include/integer.hpp
View file @
99c0fdb5
...
...
@@ -119,6 +119,9 @@ namespace TaoCrypt {
#ifdef _WIN32
#undef max // avoid name clash
#endif
// general MAX
template
<
typename
T
>
inline
const
T
&
max
(
const
T
&
a
,
const
T
&
b
)
...
...
extra/yassl/taocrypt/src/aes.cpp
View file @
99c0fdb5
This diff is collapsed.
Click to expand it.
extra/yassl/taocrypt/src/asn.cpp
View file @
99c0fdb5
...
...
@@ -1209,17 +1209,17 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
}
word32
rLen
=
GetLength
(
source
);
if
(
rLen
!=
20
)
{
if
(
rLen
==
21
)
{
// zero
at front, eat
while
(
rLen
>
20
&&
source
.
remaining
()
>
0
)
{
// zero's
at front, eat
source
.
next
();
--
rLen
;
}
else
if
(
rLen
==
19
)
{
// add zero to front so 20 bytes
if
(
rLen
<
20
)
{
// add zero's to front so 20 bytes
word32
tmpLen
=
rLen
;
while
(
tmpLen
<
20
)
{
decoded
[
0
]
=
0
;
decoded
++
;
tmpLen
++
;
}
else
{
source
.
SetError
(
DSA_SZ_E
);
return
0
;
}
}
memcpy
(
decoded
,
source
.
get_buffer
()
+
source
.
get_index
(),
rLen
);
...
...
@@ -1232,17 +1232,17 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
}
word32
sLen
=
GetLength
(
source
);
if
(
sLen
!=
20
)
{
if
(
sLen
==
21
)
{
source
.
next
();
// zero at front, eat
while
(
sLen
>
20
&&
source
.
remaining
()
>
0
)
{
source
.
next
();
// zero
's
at front, eat
--
sLen
;
}
else
if
(
sLen
==
19
)
{
decoded
[
rLen
]
=
0
;
// add zero to front so 20 bytes
if
(
sLen
<
20
)
{
// add zero's to front so 20 bytes
word32
tmpLen
=
sLen
;
while
(
tmpLen
<
20
)
{
decoded
[
rLen
]
=
0
;
decoded
++
;
tmpLen
++
;
}
else
{
source
.
SetError
(
DSA_SZ_E
);
return
0
;
}
}
memcpy
(
decoded
+
rLen
,
source
.
get_buffer
()
+
source
.
get_index
(),
sLen
);
...
...
extra/yassl/taocrypt/src/dsa.cpp
View file @
99c0fdb5
...
...
@@ -172,6 +172,7 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig,
const
Integer
&
q
=
key_
.
GetSubGroupOrder
();
const
Integer
&
g
=
key_
.
GetSubGroupGenerator
();
const
Integer
&
x
=
key_
.
GetPrivatePart
();
byte
*
tmpPtr
=
sig
;
// initial signature output
Integer
k
(
rng
,
1
,
q
-
1
);
...
...
@@ -187,22 +188,23 @@ word32 DSA_Signer::Sign(const byte* sha_digest, byte* sig,
return
-
1
;
int
rSz
=
r_
.
ByteCount
();
int
tmpSz
=
rSz
;
if
(
rSz
==
19
)
{
sig
[
0
]
=
0
;
sig
++
;
while
(
tmpSz
++
<
SHA
::
DIGEST_SIZE
)
{
*
sig
++
=
0
;
}
r_
.
Encode
(
sig
,
rSz
);
sig
=
tmpPtr
+
SHA
::
DIGEST_SIZE
;
// advance sig output to s
int
sSz
=
s_
.
ByteCount
();
tmpSz
=
sSz
;
if
(
sSz
==
19
)
{
sig
[
rSz
]
=
0
;
sig
++
;
while
(
tmpSz
++
<
SHA
::
DIGEST_SIZE
)
{
*
sig
++
=
0
;
}
s_
.
Encode
(
sig
+
rSz
,
sSz
);
s_
.
Encode
(
sig
,
sSz
);
return
40
;
}
...
...
extra/yassl/taocrypt/test/test.cpp
View file @
99c0fdb5
...
...
@@ -1277,6 +1277,9 @@ int dsa_test()
if
(
!
verifier
.
Verify
(
digest
,
decoded
))
return
-
90
;
if
(
!
verifier
.
Verify
(
digest
,
signature
))
return
-
91
;
return
0
;
}
...
...
extra/yassl/testsuite/test.hpp
View file @
99c0fdb5
...
...
@@ -22,7 +22,6 @@
#define yaSSL_TEST_HPP
#include "runtime.hpp"
#include "openssl/ssl.h"
/* openssl compatibility test */
#include "error.hpp"
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -56,6 +55,7 @@
#endif
#define SOCKET_T int
#endif
/* _WIN32 */
#include "openssl/ssl.h"
/* openssl compatibility test */
#ifdef _MSC_VER
...
...
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