summaryrefslogtreecommitdiff
path: root/lib/tpm2.h
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2021-11-14 14:57:15 +0100
committerDaiki Ueno <ueno@gnu.org>2021-11-17 08:08:29 +0100
commit90bbc9b76d381bccbfe370f1926941b35b5b56ec (patch)
tree0540a1ee9079cfa755b929eea86aa15c0f6f2b34 /lib/tpm2.h
parentbcffed047f7a228cf99028eb2b8249e5a02eb2e6 (diff)
downloadgnutls-90bbc9b76d381bccbfe370f1926941b35b5b56ec.tar.gz
locks: use once execution for on-demand initialization of globals
This makes sure that the global variables are initialized only once. Most of those variables are initialized at ELF constructor, though a couple of occasions they are initialized on-demand: the global keylog file pointer and TPM2 TCTI context. To properly protect the initialization this patch uses gl_once provided by Gnulib. Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/tpm2.h')
-rw-r--r--lib/tpm2.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/tpm2.h b/lib/tpm2.h
index b55c2e1331..e40dc01df7 100644
--- a/lib/tpm2.h
+++ b/lib/tpm2.h
@@ -26,13 +26,20 @@
#include "pin.h"
+/* Functions used outside tpm2.c */
+
+void _gnutls_tpm2_deinit(void);
+int _gnutls_load_tpm2_key(gnutls_privkey_t pkey, const gnutls_datum_t *fdata);
+
+/* Functions only used in tpm2.c */
+
struct tpm2_info_st;
struct tpm2_info_st *tpm2_info_init(struct pin_info_st *pin);
-void release_tpm2_ctx(struct tpm2_info_st *info);
+void tpm2_tcti_deinit(void);
-int _gnutls_load_tpm2_key(gnutls_privkey_t pkey, const gnutls_datum_t *fdata);
+void release_tpm2_ctx(struct tpm2_info_st *info);
int install_tpm2_key(struct tpm2_info_st *info, gnutls_privkey_t pkey,
unsigned int parent, bool emptyauth,