xref: /netbsd-src/usr.bin/dc/misc.c (revision fc8ee2f577a06855648d534cfaeafda777e59180)
1*fc8ee2f5Schristos /*	$NetBSD: misc.c,v 1.1 2017/04/10 16:37:48 christos Exp $	*/
2*fc8ee2f5Schristos 
3*fc8ee2f5Schristos /*-
4*fc8ee2f5Schristos  * Copyright (c) 2017 The NetBSD Foundation, Inc.
5*fc8ee2f5Schristos  * All rights reserved.
6*fc8ee2f5Schristos  *
7*fc8ee2f5Schristos  * Redistribution and use in source and binary forms, with or without
8*fc8ee2f5Schristos  * modification, are permitted provided that the following conditions
9*fc8ee2f5Schristos  * are met:
10*fc8ee2f5Schristos  * 1. Redistributions of source code must retain the above copyright
11*fc8ee2f5Schristos  *    notice, this list of conditions and the following disclaimer.
12*fc8ee2f5Schristos  * 2. Redistributions in binary form must reproduce the above copyright
13*fc8ee2f5Schristos  *    notice, this list of conditions and the following disclaimer in the
14*fc8ee2f5Schristos  *    documentation and/or other materials provided with the distribution.
15*fc8ee2f5Schristos  *
16*fc8ee2f5Schristos  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17*fc8ee2f5Schristos  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18*fc8ee2f5Schristos  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19*fc8ee2f5Schristos  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20*fc8ee2f5Schristos  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21*fc8ee2f5Schristos  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22*fc8ee2f5Schristos  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23*fc8ee2f5Schristos  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24*fc8ee2f5Schristos  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25*fc8ee2f5Schristos  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26*fc8ee2f5Schristos  * POSSIBILITY OF SUCH DAMAGE.
27*fc8ee2f5Schristos  */
28*fc8ee2f5Schristos #include <sys/cdefs.h>
29*fc8ee2f5Schristos __RCSID("$NetBSD: misc.c,v 1.1 2017/04/10 16:37:48 christos Exp $")
30*fc8ee2f5Schristos 
31*fc8ee2f5Schristos #include <stdlib.h>
32*fc8ee2f5Schristos #include <err.h>
33*fc8ee2f5Schristos #include <string.h>
34*fc8ee2f5Schristos #include <openssl/crypto.h>
35*fc8ee2f5Schristos #include <openssl/err.h>
36*fc8ee2f5Schristos 
37*fc8ee2f5Schristos void *
CRYPTO_malloc(int len,const char * file,int line)38*fc8ee2f5Schristos CRYPTO_malloc(int len, const char *file, int line)
39*fc8ee2f5Schristos {
40*fc8ee2f5Schristos 	void *p = malloc(len);
41*fc8ee2f5Schristos 	if (p == NULL)
42*fc8ee2f5Schristos 		err(1, "%s,%d: Can't allocate %d bytes", file, line, len);
43*fc8ee2f5Schristos 	return p;
44*fc8ee2f5Schristos }
45*fc8ee2f5Schristos 
46*fc8ee2f5Schristos void
CRYPTO_free(void * p)47*fc8ee2f5Schristos CRYPTO_free(void *p)
48*fc8ee2f5Schristos {
49*fc8ee2f5Schristos 	free(p);
50*fc8ee2f5Schristos }
51*fc8ee2f5Schristos 
52*fc8ee2f5Schristos void
CRYPTO_lock(int mode,int type,const char * file,int line)53*fc8ee2f5Schristos CRYPTO_lock(int mode, int type, const char *file, int line)
54*fc8ee2f5Schristos {
55*fc8ee2f5Schristos }
56*fc8ee2f5Schristos 
57*fc8ee2f5Schristos unsigned long
ERR_get_error(void)58*fc8ee2f5Schristos ERR_get_error(void)
59*fc8ee2f5Schristos {
60*fc8ee2f5Schristos 
61*fc8ee2f5Schristos 	return 0;
62*fc8ee2f5Schristos }
63*fc8ee2f5Schristos 
64*fc8ee2f5Schristos void
ERR_put_error(int lib,int func,int reason,const char * file,int line)65*fc8ee2f5Schristos ERR_put_error(int lib, int func, int reason, const char *file, int line)
66*fc8ee2f5Schristos {
67*fc8ee2f5Schristos }
68*fc8ee2f5Schristos 
69*fc8ee2f5Schristos void
OPENSSL_cleanse(void * p,size_t l)70*fc8ee2f5Schristos OPENSSL_cleanse(void *p, size_t l)
71*fc8ee2f5Schristos {
72*fc8ee2f5Schristos 	explicit_memset(p, 0, l);
73*fc8ee2f5Schristos }
74