summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_util.c
diff options
context:
space:
mode:
authorjsing <>2017-05-06 20:57:45 +0000
committerjsing <>2017-05-06 20:57:45 +0000
commite09c50ecb0edf1f7c4f6a7b1dee1285ccbf08d5a (patch)
treeebe437a0263ffd3bc7f16f0f1244fea73c05603c /src/lib/libtls/tls_util.c
parent270fd63e5d8c3683472108ff30860e5f0eb33ef1 (diff)
downloadopenbsd-e09c50ecb0edf1f7c4f6a7b1dee1285ccbf08d5a.tar.gz
openbsd-e09c50ecb0edf1f7c4f6a7b1dee1285ccbf08d5a.tar.bz2
openbsd-e09c50ecb0edf1f7c4f6a7b1dee1285ccbf08d5a.zip
Provide a tls_unload_file() function, that frees the memory returned from
a tls_load_file() call, ensuring that it the contents become inaccessible. This is specifically needed on platforms where the library allocators may be different from the application allocator. ok beck@
Diffstat (limited to '')
-rw-r--r--src/lib/libtls/tls_util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_util.c b/src/lib/libtls/tls_util.c
index dbb2d170d5..c643b4a9f6 100644
--- a/src/lib/libtls/tls_util.c
+++ b/src/lib/libtls/tls_util.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_util.c,v 1.5 2016/11/04 15:59:16 jsing Exp $ */ 1/* $OpenBSD: tls_util.c,v 1.6 2017/05/06 20:57:45 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> 4 * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -178,3 +178,9 @@ tls_load_file(const char *name, size_t *len, char *password)
178 178
179 return (NULL); 179 return (NULL);
180} 180}
181
182void
183tls_unload_file(uint8_t *buf, size_t len)
184{
185 freezero(buf, len);
186}