[gnutls-devel] GnuTLS | locks: couple of improvements using Gnulib glthread (!1485)
Read-only notification of GnuTLS library development activities
gnutls-devel at lists.gnutls.org
Tue Nov 16 17:16:44 CET 2021
Daiki Ueno commented on a discussion on lib/tpm2_esys.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1485#note_734806728
>
> -int install_tpm2_key(struct tpm2_info_st *info, gnutls_privkey_t pkey,
> - unsigned int parent, bool emptyauth,
> - gnutls_datum_t *privdata, gnutls_datum_t *pubdata)
> +GNUTLS_ONCE(tcti_once);
> +
> +void
> +tpm2_tcti_deinit(void)
> +{
> + if (tcti_ctx) {
> + Tss2_TctiLdr_Finalize(&tcti_ctx);
> + }
> +}
> +
> +static void
> +tcti_once_init(void)
Looking more closely at `gnutls_global_set_mutex`, the reinitialization logic seems to be added to support the implicit initialization of the library (i.e., in that case there is no way to call `gnutls_global_set_mutex` before "any other gnutls function"). The actual effect of this reinitialization, as far as I understand, is to re-init (dynamic) mutexes created at `gnutls_global_init`; which are:
- `_gnutls_file_mutex`
- `_gnutls_pkcs11_mutex`
I wonder if those could be turned into a static mutex, then we wouldn't need library reinitialization.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1485#note_734806728
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20211116/3ec9ea72/attachment.html>
More information about the Gnutls-devel
mailing list