Skip to content

Commit ede745c

Browse files
Robert Golebiowskiarnabray21
authored andcommitted
Bug #24740291: YASSL UPDATE TO 2.4.2
(cherry picked from commit 14f8b268cd55d15b9d39b90a0af5bb375bbcf543)
1 parent 13d34ee commit ede745c

File tree

11 files changed

+274
-122
lines changed

11 files changed

+274
-122
lines changed

extra/yassl/README

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ before calling SSL_new();
1212

1313
*** end Note ***
1414

15+
yaSSL Release notes, version 2.4.2 (9/22/2016)
16+
This release of yaSSL fixes a medium security vulnerability. A fix for
17+
potential AES side channel leaks is included that a local user monitoring
18+
the same CPU core cache could exploit. VM users, hyper-threading users,
19+
and users where potential attackers have access to the CPU cache will need
20+
to update if they utilize AES.
21+
22+
DSA padding fixes for unusual sizes is included as well. Users with DSA
23+
certficiates should update.
24+
25+
yaSSL Release notes, version 2.4.0 (5/20/2016)
26+
This release of yaSSL fixes the OpenSSL compatibility function
27+
SSL_CTX_load_verify_locations() when using the path directory to allow
28+
unlimited path sizes. Minor Windows build fixes are included.
29+
No high level security fixes in this version but we always recommend
30+
updating.
31+
32+
1533
yaSSL Release notes, version 2.3.9b (2/03/2016)
1634
This release of yaSSL fixes the OpenSSL compatibility function
1735
X509_NAME_get_index_by_NID() to use the actual index of the common name

extra/yassl/certs/dsa-cert.pem

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
-----BEGIN CERTIFICATE-----
2-
MIIDqzCCA2ugAwIBAgIJAMGqrgDU6DyhMAkGByqGSM44BAMwgY4xCzAJBgNVBAYT
2+
MIIDrzCCA2+gAwIBAgIJAK1zRM7YFcNjMAkGByqGSM44BAMwgZAxCzAJBgNVBAYT
33
AlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMRAwDgYDVQQK
4-
DAd3b2xmU1NMMRAwDgYDVQQLDAd0ZXN0aW5nMRYwFAYDVQQD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9ScH7VjLoqhx+bgA4XV7l1aNQME4wHQYDVR0O
19+
BBYEFCCY5ONeqOL/KqR/SwbV5Ufb/IHHMB8GA1UdIwQYMBaAFCCY5ONeqOL/KqR/
20+
SwbV5Ufb/IHHMAwGA1UdEwQFMAMBAf8wCQYHKoZIzjgEAwMvADAsAhQRYSCVN/Ge
21+
agV3mffU3qNZ92fI0QIUPH7Jp+iASI7U1ocaYDc10qXGaGY=
2222
-----END CERTIFICATE-----

extra/yassl/include/openssl/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include "rsa.h"
3636

3737

38-
#define YASSL_VERSION "2.3.9b"
38+
#define YASSL_VERSION "2.4.2"
3939

4040

4141
#if defined(__cplusplus)

extra/yassl/src/ssl.cpp

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
161161
TaoCrypt::DSA_PrivateKey dsaKey;
162162
dsaKey.Initialize(dsaSource);
163163

164-
if (rsaSource.GetError().What()) {
164+
if (dsaSource.GetError().What()) {
165165
// neither worked
166166
ret = SSL_FAILURE;
167167
}
@@ -784,40 +784,67 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
784784
WIN32_FIND_DATA FindFileData;
785785
HANDLE hFind;
786786

787-
char name[MAX_PATH + 1]; // directory specification
788-
strncpy(name, path, MAX_PATH - 3);
789-
strncat(name, "\\*", 3);
787+
const int DELIMITER_SZ = 2;
788+
const int DELIMITER_STAR_SZ = 3;
789+
int pathSz = (int)strlen(path);
790+
int nameSz = pathSz + DELIMITER_STAR_SZ + 1; // plus 1 for terminator
791+
char* name = NEW_YS char[nameSz]; // directory specification
792+
memset(name, 0, nameSz);
793+
strncpy(name, path, nameSz - DELIMITER_STAR_SZ - 1);
794+
strncat(name, "\\*", DELIMITER_STAR_SZ);
790795

791796
hFind = FindFirstFile(name, &FindFileData);
792-
if (hFind == INVALID_HANDLE_VALUE) return SSL_BAD_PATH;
797+
if (hFind == INVALID_HANDLE_VALUE) {
798+
ysArrayDelete(name);
799+
return SSL_BAD_PATH;
800+
}
793801

794802
do {
795-
if (FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY) {
796-
strncpy(name, path, MAX_PATH - 2 - HALF_PATH);
797-
strncat(name, "\\", 2);
798-
strncat(name, FindFileData.cFileName, HALF_PATH);
803+
if (!(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
804+
int curSz = (int)strlen(FindFileData.cFileName);
805+
if (pathSz + curSz + DELIMITER_SZ + 1 > nameSz) {
806+
ysArrayDelete(name);
807+
// plus 1 for terminator
808+
nameSz = pathSz + curSz + DELIMITER_SZ + 1;
809+
name = NEW_YS char[nameSz];
810+
}
811+
memset(name, 0, nameSz);
812+
strncpy(name, path, nameSz - curSz - DELIMITER_SZ - 1);
813+
strncat(name, "\\", DELIMITER_SZ);
814+
strncat(name, FindFileData.cFileName,
815+
nameSz - pathSz - DELIMITER_SZ - 1);
799816
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
800817
}
801818
} while (ret == SSL_SUCCESS && FindNextFile(hFind, &FindFileData));
802819

820+
ysArrayDelete(name);
803821
FindClose(hFind);
804822

805823
#else // _WIN32
806-
807-
const int MAX_PATH = 260;
808-
809824
DIR* dir = opendir(path);
810825
if (!dir) return SSL_BAD_PATH;
811826

812827
struct dirent* entry;
813828
struct stat buf;
814-
char name[MAX_PATH + 1];
829+
const int DELIMITER_SZ = 1;
830+
int pathSz = (int)strlen(path);
831+
int nameSz = pathSz + DELIMITER_SZ + 1; //plus 1 for null terminator
832+
char* name = NEW_YS char[nameSz]; // directory specification
815833

816834
while (ret == SSL_SUCCESS && (entry = readdir(dir))) {
817-
strncpy(name, path, MAX_PATH - 1 - HALF_PATH);
818-
strncat(name, "/", 1);
819-
strncat(name, entry->d_name, HALF_PATH);
835+
int curSz = (int)strlen(entry->d_name);
836+
if (pathSz + curSz + DELIMITER_SZ + 1 > nameSz) {
837+
ysArrayDelete(name);
838+
nameSz = pathSz + DELIMITER_SZ + curSz + 1;
839+
name = NEW_YS char[nameSz];
840+
}
841+
memset(name, 0, nameSz);
842+
strncpy(name, path, nameSz - curSz - 1);
843+
strncat(name, "/", DELIMITER_SZ);
844+
strncat(name, entry->d_name, nameSz - pathSz - DELIMITER_SZ - 1);
845+
820846
if (stat(name, &buf) < 0) {
847+
ysArrayDelete(name);
821848
closedir(dir);
822849
return SSL_BAD_STAT;
823850
}
@@ -826,6 +853,7 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
826853
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
827854
}
828855

856+
ysArrayDelete(name);
829857
closedir(dir);
830858

831859
#endif

extra/yassl/taocrypt/include/aes.hpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class AES : public Mode_BASE {
6060

6161
static const word32 Te[5][256];
6262
static const word32 Td[5][256];
63+
static const byte CTd4[256];
6364

6465
static const word32* Te0;
6566
static const word32* Te1;
@@ -80,11 +81,68 @@ class AES : public Mode_BASE {
8081

8182
void ProcessAndXorBlock(const byte*, const byte*, byte*) const;
8283

84+
word32 PreFetchTe() const;
85+
word32 PreFetchTd() const;
86+
word32 PreFetchCTd4() const;
87+
8388
AES(const AES&); // hide copy
8489
AES& operator=(const AES&); // and assign
8590
};
8691

8792

93+
#if defined(__x86_64__) || defined(_M_X64) || \
94+
(defined(__ILP32__) && (__ILP32__ >= 1))
95+
#define TC_CACHE_LINE_SZ 64
96+
#else
97+
/* default cache line size */
98+
#define TC_CACHE_LINE_SZ 32
99+
#endif
100+
101+
inline word32 AES::PreFetchTe() const
102+
{
103+
word32 x = 0;
104+
105+
/* 4 tables of 256 entries */
106+
for (int i = 0; i < 4; i++) {
107+
/* each entry is 4 bytes */
108+
for (int j = 0; j < 256; j += TC_CACHE_LINE_SZ/4) {
109+
x &= Te[i][j];
110+
}
111+
}
112+
113+
return x;
114+
}
115+
116+
117+
inline word32 AES::PreFetchTd() const
118+
{
119+
word32 x = 0;
120+
121+
/* 4 tables of 256 entries */
122+
for (int i = 0; i < 4; i++) {
123+
/* each entry is 4 bytes */
124+
for (int j = 0; j < 256; j += TC_CACHE_LINE_SZ/4) {
125+
x &= Td[i][j];
126+
}
127+
}
128+
129+
return x;
130+
}
131+
132+
133+
inline word32 AES::PreFetchCTd4() const
134+
{
135+
word32 x = 0;
136+
int i;
137+
138+
for (i = 0; i < 256; i += TC_CACHE_LINE_SZ) {
139+
x &= CTd4[i];
140+
}
141+
142+
return x;
143+
}
144+
145+
88146
typedef BlockCipher<ENCRYPTION, AES, ECB> AES_ECB_Encryption;
89147
typedef BlockCipher<DECRYPTION, AES, ECB> AES_ECB_Decryption;
90148

extra/yassl/taocrypt/include/integer.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ namespace TaoCrypt {
119119

120120

121121

122+
#ifdef _WIN32
123+
#undef max // avoid name clash
124+
#endif
122125
// general MAX
123126
template<typename T> inline
124127
const T& max(const T& a, const T& b)

0 commit comments

Comments
 (0)