Skip to content

Commit 36820de

Browse files
scottmayhewchucklever
authored andcommitted
tlshd: fix priority cache initialization
Commit 9253f9d added the use of the @System keyword as the initial keyword in the priority string used by tlshd. Unfortunately @System doesn't appear to work on systems that do not have a system-wide library configuration set up. Instead of trying to pick an initial keyword that will work on all systems, let's instead use gnutls_priority_init2() with the GNUTLS_PRIORITY_INIT_DEF_APPEND flag instead. That will *append* our priority string to the default options. Fixes: 9253f9d ("tlshd: Fix priority string to allow PQC") Signed-off-by: Scott Mayhew <[email protected]> Tested-by: Alistair Francis <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent db7727d commit 36820de

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/tlshd/ktls.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static int tlshd_gnutls_priority_init_list(const unsigned int *ciphers,
357357
const char *errpos;
358358
int ret, i;
359359

360-
pstring = strdup("@SYSTEM:-COMP-ALL");
360+
pstring = strdup("-COMP-ALL");
361361
if (!pstring)
362362
return -ENOMEM;
363363

@@ -425,7 +425,8 @@ static int tlshd_gnutls_priority_init_list(const unsigned int *ciphers,
425425
}
426426

427427
tlshd_log_debug("x.509 priority string: %s\n", pstring);
428-
ret = gnutls_priority_init(&tlshd_gnutls_priority_x509, pstring, &errpos);
428+
ret = gnutls_priority_init2(&tlshd_gnutls_priority_x509, pstring, &errpos,
429+
GNUTLS_PRIORITY_INIT_DEF_APPEND);
429430
if (ret != GNUTLS_E_SUCCESS) {
430431
free(pstring_sha256);
431432
free(pstring_sha384);
@@ -442,7 +443,8 @@ static int tlshd_gnutls_priority_init_list(const unsigned int *ciphers,
442443
}
443444

444445
tlshd_log_debug("PSK priority string: %s\n", pstring);
445-
ret = gnutls_priority_init(&tlshd_gnutls_priority_psk, pstring, &errpos);
446+
ret = gnutls_priority_init2(&tlshd_gnutls_priority_psk, pstring, &errpos,
447+
GNUTLS_PRIORITY_INIT_DEF_APPEND);
446448
if (ret != GNUTLS_E_SUCCESS) {
447449
free(pstring_sha256);
448450
free(pstring_sha384);
@@ -461,8 +463,9 @@ static int tlshd_gnutls_priority_init_list(const unsigned int *ciphers,
461463
}
462464

463465
tlshd_log_debug("PSK SHA256 priority string: %s\n", pstring);
464-
ret = gnutls_priority_init(&tlshd_gnutls_priority_psk_sha256,
465-
pstring, &errpos);
466+
ret = gnutls_priority_init2(&tlshd_gnutls_priority_psk_sha256,
467+
pstring, &errpos,
468+
GNUTLS_PRIORITY_INIT_DEF_APPEND);
466469
if (ret != GNUTLS_E_SUCCESS) {
467470
free(pstring);
468471
free(pstring_sha384);
@@ -482,8 +485,9 @@ static int tlshd_gnutls_priority_init_list(const unsigned int *ciphers,
482485
}
483486

484487
tlshd_log_debug("PSK SHA384 priority string: %s\n", pstring);
485-
ret = gnutls_priority_init(&tlshd_gnutls_priority_psk_sha384,
486-
pstring, &errpos);
488+
ret = gnutls_priority_init2(&tlshd_gnutls_priority_psk_sha384,
489+
pstring, &errpos,
490+
GNUTLS_PRIORITY_INIT_DEF_APPEND);
487491
if (ret != GNUTLS_E_SUCCESS) {
488492
free(pstring);
489493
gnutls_priority_deinit(tlshd_gnutls_priority_psk_sha256);

0 commit comments

Comments
 (0)