Skip to content

Commit 1bb9d16

Browse files
committed
starttls-gnutls: Avoid building a priority cache
Use gnutls_priority_set_direct to avoid the extra step of building a priority cache, as we only use it once.
1 parent ace87e2 commit 1bb9d16

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

starttls-gnutls.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ const response* starttls_init(void)
9393
{
9494
int ret;
9595
gnutls_dh_params_t dh_params;
96-
gnutls_priority_t priority_cache;
9796
gnutls_certificate_credentials_t x509_cred;
9897
const char *my_priority = getenv("TLS_PRIORITY");
9998
const char* certfile = getenv("TLS_CERTFILE");
@@ -115,9 +114,11 @@ const response* starttls_init(void)
115114
return 0;
116115
}
117116

117+
gnutls_init(&gsession, GNUTLS_SERVER);
118+
118119
if (!my_priority)
119120
my_priority = "NORMAL";
120-
ret = gnutls_priority_init(&priority_cache, my_priority, NULL);
121+
ret = gnutls_priority_set_direct(gsession, my_priority, NULL);
121122
if (ret != GNUTLS_E_SUCCESS) {
122123
msg2("TLS priority error: ", gnutls_strerror(ret));
123124
return 0;
@@ -141,10 +142,6 @@ const response* starttls_init(void)
141142
/* Don't deinit the dh_params, since the above only stores a pointer to the params. */
142143
}
143144

144-
gnutls_init(&gsession, GNUTLS_SERVER);
145-
146-
gnutls_priority_set(gsession, priority_cache);
147-
148145
gnutls_credentials_set(gsession, GNUTLS_CRD_CERTIFICATE, x509_cred);
149146

150147
/* Set maximum compatibility mode. */

0 commit comments

Comments
 (0)