diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2017-05-06 20:57:46 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2017-05-06 20:57:46 +0000 |
commit | 91f2f5a957f85f33bbfc7f793711a28d1f454f47 (patch) | |
tree | 654a49b4454874654d7f69d7eea14184f72b0b23 /lib/libtls/tls_util.c | |
parent | 98e38b08f970b68a8cfde1cb96ac702b258a03e6 (diff) |
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 'lib/libtls/tls_util.c')
-rw-r--r-- | lib/libtls/tls_util.c | 8 |
1 files changed, 7 insertions, 1 deletions
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 <jsing@openbsd.org> * Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> @@ -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); +} |