xref: /netbsd-src/external/mpl/bind/dist/lib/isc/safe.c (revision bcda20f65a8566e103791ec395f7f499ef322704)
1*bcda20f6Schristos /*	$NetBSD: safe.c,v 1.7 2025/01/26 16:25:38 christos Exp $	*/
25606745fSchristos 
35606745fSchristos /*
45606745fSchristos  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
55606745fSchristos  *
68596601aSchristos  * SPDX-License-Identifier: MPL-2.0
78596601aSchristos  *
85606745fSchristos  * This Source Code Form is subject to the terms of the Mozilla Public
95606745fSchristos  * License, v. 2.0. If a copy of the MPL was not distributed with this
10fce770bdSchristos  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
115606745fSchristos  *
125606745fSchristos  * See the COPYRIGHT file distributed with this work for additional
135606745fSchristos  * information regarding copyright ownership.
145606745fSchristos  */
155606745fSchristos 
165606745fSchristos #include <openssl/crypto.h>
175606745fSchristos 
185606745fSchristos #include <isc/safe.h>
195606745fSchristos 
205606745fSchristos int
215606745fSchristos isc_safe_memequal(const void *s1, const void *s2, size_t len) {
22*bcda20f6Schristos 	return !CRYPTO_memcmp(s1, s2, len);
235606745fSchristos }
245606745fSchristos 
255606745fSchristos void
265606745fSchristos isc_safe_memwipe(void *ptr, size_t len) {
275606745fSchristos 	OPENSSL_cleanse(ptr, len);
285606745fSchristos }
29