xref: /netbsd-src/external/mpl/dhcp/bind/dist/lib/isc/safe.c (revision 4afad4b7fa6d4a0d3dedf41d1587a7250710ae54)
1*4afad4b7Schristos /*	$NetBSD: safe.c,v 1.1 2024/02/18 20:57:50 christos Exp $	*/
2*4afad4b7Schristos 
3*4afad4b7Schristos /*
4*4afad4b7Schristos  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
5*4afad4b7Schristos  *
6*4afad4b7Schristos  * SPDX-License-Identifier: MPL-2.0
7*4afad4b7Schristos  *
8*4afad4b7Schristos  * This Source Code Form is subject to the terms of the Mozilla Public
9*4afad4b7Schristos  * License, v. 2.0. If a copy of the MPL was not distributed with this
10*4afad4b7Schristos  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
11*4afad4b7Schristos  *
12*4afad4b7Schristos  * See the COPYRIGHT file distributed with this work for additional
13*4afad4b7Schristos  * information regarding copyright ownership.
14*4afad4b7Schristos  */
15*4afad4b7Schristos 
16*4afad4b7Schristos #include <openssl/crypto.h>
17*4afad4b7Schristos 
18*4afad4b7Schristos #include <isc/safe.h>
19*4afad4b7Schristos 
20*4afad4b7Schristos int
isc_safe_memequal(const void * s1,const void * s2,size_t len)21*4afad4b7Schristos isc_safe_memequal(const void *s1, const void *s2, size_t len) {
22*4afad4b7Schristos 	return (!CRYPTO_memcmp(s1, s2, len));
23*4afad4b7Schristos }
24*4afad4b7Schristos 
25*4afad4b7Schristos void
isc_safe_memwipe(void * ptr,size_t len)26*4afad4b7Schristos isc_safe_memwipe(void *ptr, size_t len) {
27*4afad4b7Schristos 	OPENSSL_cleanse(ptr, len);
28*4afad4b7Schristos }
29