Skip to content

Commit

Permalink
kill redundant free_certs argument to GnuTLS assign_privkey() function
Browse files Browse the repository at this point in the history
This was added in commit 04ccc26 ("Simplify extra_certs handling
w.r.t. assign_privkey()") because GnuTLS 2 didn't take a copy of the
certs which were assigned to the creds, and we needed to keep track of
which extra certs were used and which weren't.

The GnuTLS 3 variant of assign_privkey() didn't use it, since GnuTLS 3
takes a copy of the certs and we can just free them normally.

Now that we've dropped GnuTLS 2 support, we can drop this argument too
and simplify assign_privkey() a little bit.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dwmw2 committed May 7, 2021
1 parent 80f90dc commit 36166b0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions gnutls.c
Expand Up @@ -610,8 +610,7 @@ static int get_cert_name(gnutls_x509_crt_t cert, char *name, size_t namelen)
static int assign_privkey(struct openconnect_info *vpninfo,
gnutls_privkey_t pkey,
gnutls_x509_crt_t *certs,
unsigned int nr_certs,
uint8_t *free_certs)
unsigned int nr_certs)
{
gnutls_pcert_st *pcerts = gnutls_calloc(nr_certs, sizeof(*pcerts));
unsigned int i;
Expand Down Expand Up @@ -1776,8 +1775,7 @@ static int load_certificate(struct openconnect_info *vpninfo)
#endif
err = assign_privkey(vpninfo, pkey,
supporting_certs,
nr_supporting_certs,
free_supporting_certs);
nr_supporting_certs);
if (!err) {
pkey = NULL; /* we gave it away, and potentially also some
of extra_certs[] may have been zeroed. */
Expand Down

0 comments on commit 36166b0

Please sign in to comment.