forked from wolfSSL/wolfssl
refactor: new define to remove some preprocessor directives
This commit is contained in:
@ -10400,13 +10400,8 @@ static int GetRecordHeader(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
else {
|
else {
|
||||||
WOLFSSL_MSG("SSL version error");
|
WOLFSSL_MSG("SSL version error");
|
||||||
/* send alert per RFC5246 Appendix E. Backward Compatibility */
|
/* send alert per RFC5246 Appendix E. Backward Compatibility */
|
||||||
if (ssl->options.side == WOLFSSL_CLIENT_END) {
|
if (ssl->options.side == WOLFSSL_CLIENT_END)
|
||||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
||||||
SendAlert(ssl, alert_fatal, wc_protocol_version);
|
|
||||||
#else
|
|
||||||
SendAlert(ssl, alert_fatal, protocol_version);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
||||||
return VERSION_ERROR; /* only use requested version */
|
return VERSION_ERROR; /* only use requested version */
|
||||||
}
|
}
|
||||||
@ -18471,24 +18466,12 @@ const char* AlertTypeToString(int type)
|
|||||||
return decrypt_error_str;
|
return decrypt_error_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
case wolfssl_alert_protocol_version:
|
||||||
/* catch name conflict for enum protocol with MYSQL build */
|
|
||||||
case wc_protocol_version:
|
|
||||||
{
|
|
||||||
static const char wc_protocol_version_str[] =
|
|
||||||
"wc_protocol_version";
|
|
||||||
return wc_protocol_version_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
case protocol_version:
|
|
||||||
{
|
{
|
||||||
static const char protocol_version_str[] =
|
static const char protocol_version_str[] =
|
||||||
"protocol_version";
|
"protocol_version";
|
||||||
return protocol_version_str;
|
return protocol_version_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
case insufficient_security:
|
case insufficient_security:
|
||||||
{
|
{
|
||||||
static const char insufficient_security_str[] =
|
static const char insufficient_security_str[] =
|
||||||
|
@ -6038,11 +6038,7 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, const byte* input,
|
|||||||
set = 1;
|
set = 1;
|
||||||
}
|
}
|
||||||
if (!set) {
|
if (!set) {
|
||||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
||||||
SendAlert(ssl, alert_fatal, wc_protocol_version);
|
|
||||||
#else
|
|
||||||
SendAlert(ssl, alert_fatal, protocol_version);
|
|
||||||
#endif
|
|
||||||
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
||||||
return VERSION_ERROR;
|
return VERSION_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -5671,11 +5671,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
|
|||||||
/* this check pass for DTLS Major (0xff) */
|
/* this check pass for DTLS Major (0xff) */
|
||||||
if (args->pv.major < SSLv3_MAJOR) {
|
if (args->pv.major < SSLv3_MAJOR) {
|
||||||
WOLFSSL_MSG("Legacy version field contains unsupported value");
|
WOLFSSL_MSG("Legacy version field contains unsupported value");
|
||||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
||||||
SendAlert(ssl, alert_fatal, wc_protocol_version);
|
|
||||||
#else
|
|
||||||
SendAlert(ssl, alert_fatal, protocol_version);
|
|
||||||
#endif
|
|
||||||
ERROR_OUT(INVALID_PARAMETER, exit_dch);
|
ERROR_OUT(INVALID_PARAMETER, exit_dch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,6 +768,11 @@ enum AlertDescription {
|
|||||||
no_application_protocol = 120
|
no_application_protocol = 120
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
||||||
|
#define wolfssl_alert_protocol_version wc_protocol_version
|
||||||
|
#else
|
||||||
|
#define wolfssl_alert_protocol_version protocol_version
|
||||||
|
#endif
|
||||||
|
|
||||||
enum AlertLevel {
|
enum AlertLevel {
|
||||||
alert_none = 0, /* Used to indicate no alert level is set */
|
alert_none = 0, /* Used to indicate no alert level is set */
|
||||||
|
Reference in New Issue
Block a user