Skip to content

Commit 271fed4

Browse files
committed
Merge branch '5.5' into 10.0
2 parents ff26d93 + e1385f2 commit 271fed4

File tree

116 files changed

+2625
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2625
-533
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ include/mysql_version.h
5959
include/mysqld_ername.h
6060
include/mysqld_error.h
6161
include/sql_state.h
62+
include/probes_mysql.d
63+
include/probes_mysql_dtrace.h
64+
include/probes_mysql_nodtrace.h
6265
info_macros.cmake
6366
libmysql*/libmysql*_exports_file.cc
6467
libmysql*/merge_archives_mysql*.cmake

client/mysql_upgrade.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ static const char *load_default_groups[]=
184184
static void free_used_memory(void)
185185
{
186186
/* Free memory allocated by 'load_defaults' */
187-
free_defaults(defaults_argv);
187+
if (defaults_argv)
188+
free_defaults(defaults_argv);
188189

189190
dynstr_free(&ds_args);
190191
dynstr_free(&conn_args);
@@ -1096,7 +1097,6 @@ int main(int argc, char **argv)
10961097
if (opt_systables_only && !opt_silent)
10971098
printf("The --upgrade-system-tables option was used, user tables won't be touched.\n");
10981099

1099-
11001100
/*
11011101
Read the mysql_upgrade_info file to check if mysql_upgrade
11021102
already has been run for this installation of MySQL

cmake/dtrace.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ IF(ENABLE_DTRACE)
8686
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
8787
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
8888
)
89+
ELSE()
90+
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/probes_mysql_nodtrace.h.in
91+
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h COPYONLY)
8992
ENDIF()
9093

9194
FUNCTION(DTRACE_INSTRUMENT target)

configure.cmake

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,16 +790,36 @@ ENDIF()
790790
#
791791
# Test for how the C compiler does inline, if at all
792792
#
793+
# SunPro is weird, apparently it only supports inline at -xO3 or -xO4.
794+
# And if CMAKE_C_FLAGS has -xO4 but CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} has -xO2
795+
# then CHECK_C_SOURCE_COMPILES will succeed but the built will fail.
796+
# We must test all flags here.
797+
# XXX actually, we can do this for all compilers, not only SunPro
798+
IF (CMAKE_CXX_COMPILER_ID MATCHES "SunPro" AND
799+
CMAKE_GENERATOR MATCHES "Makefiles")
800+
STRING(TOUPPER "CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}" flags)
801+
SET(CMAKE_REQUIRED_FLAGS "${${flags}}")
802+
ENDIF()
793803
CHECK_C_SOURCE_COMPILES("
794-
static inline int foo(){return 0;}
804+
extern int bar(int x);
805+
static inline int foo(){return bar(1);}
795806
int main(int argc, char *argv[]){return 0;}"
796807
C_HAS_inline)
797808
IF(NOT C_HAS_inline)
798809
CHECK_C_SOURCE_COMPILES("
799-
static __inline int foo(){return 0;}
810+
extern int bar(int x);
811+
static __inline int foo(){return bar(1);}
800812
int main(int argc, char *argv[]){return 0;}"
801813
C_HAS___inline)
802-
SET(C_INLINE __inline)
814+
IF(C_HAS___inline)
815+
SET(C_INLINE __inline)
816+
ElSE()
817+
SET(C_INLINE)
818+
MESSAGE(WARNING "C compiler does not support funcion inlining")
819+
IF(NOT NOINLINE)
820+
MESSAGE(FATAL_ERROR "Use -DNOINLINE=TRUE to allow compilation without inlining")
821+
ENDIF()
822+
ENDIF()
803823
ENDIF()
804824

805825
IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)

extra/yassl/README

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

1313
*** end Note ***
1414

15+
yaSSL Release notes, version 2.3.9 (12/01/2015)
16+
This release of yaSSL fixes two client side Diffie-Hellman problems.
17+
yaSSL was only handling the cases of zero or one leading zeros for the key
18+
agreement instead of potentially any number. This caused about 1 in 50,000
19+
connections to fail when using DHE cipher suites. The second problem was
20+
the case where a server would send a public value shorter than the prime
21+
value, causing about 1 in 128 client connections to fail, and also
22+
caused the yaSSL client to read off the end of memory. All client side
23+
DHE cipher suite users should update.
24+
Thanks to Adam Langely (agl@imperialviolet.org) for the detailed report!
25+
1526
yaSSL Release notes, version 2.3.8 (9/17/2015)
1627
This release of yaSSL fixes a high security vulnerability. All users
1728
SHOULD update. If using yaSSL for TLS on the server side with private

extra/yassl/include/crypto_wrapper.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ class DiffieHellman {
378378

379379
uint get_agreedKeyLength() const;
380380
const byte* get_agreedKey() const;
381+
uint get_publicKeyLength() const;
381382
const byte* get_publicKey() const;
382383
void makeAgreement(const byte*, unsigned int);
383384

extra/yassl/include/openssl/ssl.h

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

3636

37-
#define YASSL_VERSION "2.3.8"
37+
#define YASSL_VERSION "2.3.9"
3838

3939

4040
#if defined(__cplusplus)

extra/yassl/src/crypto_wrapper.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,10 @@ struct DiffieHellman::DHImpl {
751751
byte* publicKey_;
752752
byte* privateKey_;
753753
byte* agreedKey_;
754+
uint pubKeyLength_;
754755

755756
DHImpl(TaoCrypt::RandomNumberGenerator& r) : ranPool_(r), publicKey_(0),
756-
privateKey_(0), agreedKey_(0) {}
757+
privateKey_(0), agreedKey_(0), pubKeyLength_(0) {}
757758
~DHImpl()
758759
{
759760
ysArrayDelete(agreedKey_);
@@ -762,7 +763,7 @@ struct DiffieHellman::DHImpl {
762763
}
763764

764765
DHImpl(const DHImpl& that) : dh_(that.dh_), ranPool_(that.ranPool_),
765-
publicKey_(0), privateKey_(0), agreedKey_(0)
766+
publicKey_(0), privateKey_(0), agreedKey_(0), pubKeyLength_(0)
766767
{
767768
uint length = dh_.GetByteLength();
768769
AllocKeys(length, length, length);
@@ -810,7 +811,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g,
810811
using TaoCrypt::Integer;
811812

812813
pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref());
813-
pimpl_->publicKey_ = NEW_YS opaque[pubSz];
814+
pimpl_->publicKey_ = NEW_YS opaque[pimpl_->pubKeyLength_ = pubSz];
814815
memcpy(pimpl_->publicKey_, pub, pubSz);
815816
}
816817

@@ -869,6 +870,10 @@ const byte* DiffieHellman::get_agreedKey() const
869870
return pimpl_->agreedKey_;
870871
}
871872

873+
uint DiffieHellman::get_publicKeyLength() const
874+
{
875+
return pimpl_->pubKeyLength_;
876+
}
872877

873878
const byte* DiffieHellman::get_publicKey() const
874879
{

extra/yassl/src/yassl_imp.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,12 @@ void ClientDiffieHellmanPublic::build(SSL& ssl)
109109
uint keyLength = dhClient.get_agreedKeyLength(); // pub and agree same
110110

111111
alloc(keyLength, true);
112-
dhClient.makeAgreement(dhServer.get_publicKey(), keyLength);
112+
dhClient.makeAgreement(dhServer.get_publicKey(),
113+
dhServer.get_publicKeyLength());
113114
c16toa(keyLength, Yc_);
114115
memcpy(Yc_ + KEY_OFFSET, dhClient.get_publicKey(), keyLength);
115116

116-
// because of encoding first byte might be zero, don't use it for preMaster
117-
if (*dhClient.get_agreedKey() == 0)
118-
ssl.set_preMaster(dhClient.get_agreedKey() + 1, keyLength - 1);
119-
else
120-
ssl.set_preMaster(dhClient.get_agreedKey(), keyLength);
117+
ssl.set_preMaster(dhClient.get_agreedKey(), keyLength);
121118
}
122119

123120

@@ -321,11 +318,7 @@ void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input)
321318
}
322319
dh.makeAgreement(Yc_, keyLength);
323320

324-
// because of encoding, first byte might be 0, don't use for preMaster
325-
if (*dh.get_agreedKey() == 0)
326-
ssl.set_preMaster(dh.get_agreedKey() + 1, dh.get_agreedKeyLength() - 1);
327-
else
328-
ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength());
321+
ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength());
329322
ssl.makeMasterSecret();
330323
}
331324

extra/yassl/src/yassl_int.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,19 @@ void SSL::set_random(const opaque* random, ConnectionEnd sender)
807807
// store client pre master secret
808808
void SSL::set_preMaster(const opaque* pre, uint sz)
809809
{
810+
uint i(0); // trim leading zeros
811+
uint fullSz(sz);
812+
813+
while (i++ < fullSz && *pre == 0) {
814+
sz--;
815+
pre++;
816+
}
817+
818+
if (sz == 0) {
819+
SetError(bad_input);
820+
return;
821+
}
822+
810823
secure_.use_connection().AllocPreSecret(sz);
811824
memcpy(secure_.use_connection().pre_master_secret_, pre, sz);
812825
}
@@ -924,6 +937,8 @@ void SSL::order_error()
924937
// Create and store the master secret see page 32, 6.1
925938
void SSL::makeMasterSecret()
926939
{
940+
if (GetError()) return;
941+
927942
if (isTLS())
928943
makeTLSMasterSecret();
929944
else {

0 commit comments

Comments
 (0)