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 {
|
||||
WOLFSSL_MSG("SSL version error");
|
||||
/* send alert per RFC5246 Appendix E. Backward Compatibility */
|
||||
if (ssl->options.side == WOLFSSL_CLIENT_END) {
|
||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
||||
SendAlert(ssl, alert_fatal, wc_protocol_version);
|
||||
#else
|
||||
SendAlert(ssl, alert_fatal, protocol_version);
|
||||
#endif
|
||||
}
|
||||
if (ssl->options.side == WOLFSSL_CLIENT_END)
|
||||
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
||||
WOLFSSL_ERROR_VERBOSE(VERSION_ERROR);
|
||||
return VERSION_ERROR; /* only use requested version */
|
||||
}
|
||||
@ -18471,24 +18466,12 @@ const char* AlertTypeToString(int type)
|
||||
return decrypt_error_str;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
||||
/* 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:
|
||||
case wolfssl_alert_protocol_version:
|
||||
{
|
||||
static const char protocol_version_str[] =
|
||||
"protocol_version";
|
||||
return protocol_version_str;
|
||||
}
|
||||
|
||||
#endif
|
||||
case insufficient_security:
|
||||
{
|
||||
static const char insufficient_security_str[] =
|
||||
|
@ -6038,11 +6038,7 @@ static int TLSX_SupportedVersions_Parse(WOLFSSL* ssl, const byte* input,
|
||||
set = 1;
|
||||
}
|
||||
if (!set) {
|
||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
||||
SendAlert(ssl, alert_fatal, wc_protocol_version);
|
||||
#else
|
||||
SendAlert(ssl, alert_fatal, protocol_version);
|
||||
#endif
|
||||
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
||||
WOLFSSL_ERROR_VERBOSE(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) */
|
||||
if (args->pv.major < SSLv3_MAJOR) {
|
||||
WOLFSSL_MSG("Legacy version field contains unsupported value");
|
||||
#ifdef WOLFSSL_MYSQL_COMPATIBLE
|
||||
SendAlert(ssl, alert_fatal, wc_protocol_version);
|
||||
#else
|
||||
SendAlert(ssl, alert_fatal, protocol_version);
|
||||
#endif
|
||||
SendAlert(ssl, alert_fatal, wolfssl_alert_protocol_version);
|
||||
ERROR_OUT(INVALID_PARAMETER, exit_dch);
|
||||
}
|
||||
|
||||
|
@ -768,6 +768,11 @@ enum AlertDescription {
|
||||
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 {
|
||||
alert_none = 0, /* Used to indicate no alert level is set */
|
||||
|
Reference in New Issue
Block a user