xref: /freebsd/contrib/libfido2/openbsd-compat/freezero.c (revision 0afa8e065e14bb8fd338d75690e0238c00167d40)
1*0afa8e06SEd Maste /*
2*0afa8e06SEd Maste  * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
3*0afa8e06SEd Maste  *
4*0afa8e06SEd Maste  * Permission to use, copy, modify, and distribute this software for any
5*0afa8e06SEd Maste  * purpose with or without fee is hereby granted, provided that the above
6*0afa8e06SEd Maste  * copyright notice and this permission notice appear in all copies.
7*0afa8e06SEd Maste  *
8*0afa8e06SEd Maste  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9*0afa8e06SEd Maste  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10*0afa8e06SEd Maste  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11*0afa8e06SEd Maste  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12*0afa8e06SEd Maste  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13*0afa8e06SEd Maste  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14*0afa8e06SEd Maste  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*0afa8e06SEd Maste  */
16*0afa8e06SEd Maste 
17*0afa8e06SEd Maste #include "openbsd-compat.h"
18*0afa8e06SEd Maste 
19*0afa8e06SEd Maste #ifndef HAVE_FREEZERO
20*0afa8e06SEd Maste 
21*0afa8e06SEd Maste void
freezero(void * ptr,size_t sz)22*0afa8e06SEd Maste freezero(void *ptr, size_t sz)
23*0afa8e06SEd Maste {
24*0afa8e06SEd Maste 	if (ptr == NULL)
25*0afa8e06SEd Maste 		return;
26*0afa8e06SEd Maste 	explicit_bzero(ptr, sz);
27*0afa8e06SEd Maste 	free(ptr);
28*0afa8e06SEd Maste }
29*0afa8e06SEd Maste 
30*0afa8e06SEd Maste #endif /* HAVE_FREEZERO */
31