secur32: Use VERS-ALL priority string only on recent gnutls versions.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2018-12-07 15:30:16 +01:00 committed by Alexandre Julliard
parent 9dd0f8f4b7
commit 179ee89e65
1 changed files with 21 additions and 4 deletions

View File

@ -199,7 +199,8 @@ DWORD schan_imp_enabled_protocols(void)
BOOL schan_imp_create_session(schan_imp_session *session, schan_credentials *cred)
{
gnutls_session_t *s = (gnutls_session_t*)session;
char priority[128] = "NORMAL:%LATEST_RECORD_VERSION:-VERS-ALL", *p;
char priority[128] = "NORMAL:%LATEST_RECORD_VERSION", *p;
BOOL using_vers_all = FALSE, disabled;
unsigned i;
int err = pgnutls_init(s, cred->credential_use == SECPKG_CRED_INBOUND ? GNUTLS_SERVER : GNUTLS_CLIENT);
@ -210,10 +211,26 @@ BOOL schan_imp_create_session(schan_imp_session *session, schan_credentials *cre
}
p = priority + strlen(priority);
for(i = 0; i < ARRAY_SIZE(protocol_priority_flags); i++) {
if (!(cred->enabled_protocols & protocol_priority_flags[i].enable_flag)) continue;
/* VERS-ALL is nice to use for forward compatibility. It was introduced before support for TLS1.3,
* so if TLS1.3 is supported, we may safely use it. Otherwise explicitly disable all known
* disabled protocols. */
if (supported_protocols & SP_PROT_TLS1_3_CLIENT)
{
strcpy(p, ":-VERS-ALL");
p += strlen(p);
using_vers_all = TRUE;
}
for (i = 0; i < ARRAY_SIZE(protocol_priority_flags); i++)
{
if (!(supported_protocols & protocol_priority_flags[i].enable_flag)) continue;
disabled = !(cred->enabled_protocols & protocol_priority_flags[i].enable_flag);
if (using_vers_all && disabled) continue;
*p++ = ':';
*p++ = '+';
*p++ = disabled ? '-' : '+';
strcpy(p, protocol_priority_flags[i].gnutls_flag);
p += strlen(p);
}