From 91f2f5a957f85f33bbfc7f793711a28d1f454f47 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Sat, 6 May 2017 20:57:46 +0000 Subject: 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@ --- lib/libtls/tls_util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/libtls/tls_util.c') diff --git a/lib/libtls/tls_util.c b/lib/libtls/tls_util.c index dbb2d170d5b..c643b4a9f62 100644 --- a/lib/libtls/tls_util.c +++ b/lib/libtls/tls_util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_util.c,v 1.5 2016/11/04 15:59:16 jsing Exp $ */ +/* $OpenBSD: tls_util.c,v 1.6 2017/05/06 20:57:45 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing * Copyright (c) 2015 Reyk Floeter @@ -178,3 +178,9 @@ tls_load_file(const char *name, size_t *len, char *password) return (NULL); } + +void +tls_unload_file(uint8_t *buf, size_t len) +{ + freezero(buf, len); +} -- cgit v1.2.3