xref: /openbsd/lib/libcrypto/buffer/buf_err.c (revision 3dca7526)
1*3dca7526Stb /* $OpenBSD: buf_err.c,v 1.14 2024/06/24 06:43:22 tb Exp $ */
2913ec974Sbeck /* ====================================================================
30a5d6edeSdjm  * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
45b37fcf3Sryker  *
55b37fcf3Sryker  * Redistribution and use in source and binary forms, with or without
65b37fcf3Sryker  * modification, are permitted provided that the following conditions
75b37fcf3Sryker  * are met:
8913ec974Sbeck  *
9913ec974Sbeck  * 1. Redistributions of source code must retain the above copyright
105b37fcf3Sryker  *    notice, this list of conditions and the following disclaimer.
11913ec974Sbeck  *
125b37fcf3Sryker  * 2. Redistributions in binary form must reproduce the above copyright
13913ec974Sbeck  *    notice, this list of conditions and the following disclaimer in
14913ec974Sbeck  *    the documentation and/or other materials provided with the
15913ec974Sbeck  *    distribution.
165b37fcf3Sryker  *
17913ec974Sbeck  * 3. All advertising materials mentioning features or use of this
18913ec974Sbeck  *    software must display the following acknowledgment:
19913ec974Sbeck  *    "This product includes software developed by the OpenSSL Project
20913ec974Sbeck  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
215b37fcf3Sryker  *
22913ec974Sbeck  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
23913ec974Sbeck  *    endorse or promote products derived from this software without
24913ec974Sbeck  *    prior written permission. For written permission, please contact
25913ec974Sbeck  *    openssl-core@OpenSSL.org.
26913ec974Sbeck  *
27913ec974Sbeck  * 5. Products derived from this software may not be called "OpenSSL"
28913ec974Sbeck  *    nor may "OpenSSL" appear in their names without prior written
29913ec974Sbeck  *    permission of the OpenSSL Project.
30913ec974Sbeck  *
31913ec974Sbeck  * 6. Redistributions of any form whatsoever must retain the following
32913ec974Sbeck  *    acknowledgment:
33913ec974Sbeck  *    "This product includes software developed by the OpenSSL Project
34913ec974Sbeck  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35913ec974Sbeck  *
36913ec974Sbeck  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
37913ec974Sbeck  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38913ec974Sbeck  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39913ec974Sbeck  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
40913ec974Sbeck  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41913ec974Sbeck  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42913ec974Sbeck  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43913ec974Sbeck  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44913ec974Sbeck  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45913ec974Sbeck  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46913ec974Sbeck  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47913ec974Sbeck  * OF THE POSSIBILITY OF SUCH DAMAGE.
48913ec974Sbeck  * ====================================================================
49913ec974Sbeck  *
50913ec974Sbeck  * This product includes cryptographic software written by Eric Young
51913ec974Sbeck  * (eay@cryptsoft.com).  This product includes software written by Tim
52913ec974Sbeck  * Hudson (tjh@cryptsoft.com).
53913ec974Sbeck  *
545b37fcf3Sryker  */
55913ec974Sbeck 
565b37fcf3Sryker #include <stdio.h>
578cf4d6a6Sjsing 
588cf4d6a6Sjsing #include <openssl/opensslconf.h>
598cf4d6a6Sjsing 
60913ec974Sbeck #include <openssl/err.h>
61913ec974Sbeck #include <openssl/buffer.h>
625b37fcf3Sryker 
63*3dca7526Stb #include "err_local.h"
64*3dca7526Stb 
65da347917Sbeck #ifndef OPENSSL_NO_ERR
666d388760Sdjm 
676d388760Sdjm #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0)
686d388760Sdjm #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason)
696d388760Sdjm 
70*3dca7526Stb static const ERR_STRING_DATA BUF_str_functs[] = {
715067ae9fSbeck 	{ERR_FUNC(0xfff), "CRYPTO_internal"},
72913ec974Sbeck 	{0, NULL}
73913ec974Sbeck };
74913ec974Sbeck 
75*3dca7526Stb static const ERR_STRING_DATA BUF_str_reasons[] = {
76913ec974Sbeck 	{0, NULL}
775b37fcf3Sryker };
785b37fcf3Sryker 
795b37fcf3Sryker #endif
805b37fcf3Sryker 
8179e8bed4Sjsing void
ERR_load_BUF_strings(void)8279e8bed4Sjsing ERR_load_BUF_strings(void)
835b37fcf3Sryker {
84da347917Sbeck #ifndef OPENSSL_NO_ERR
8579e8bed4Sjsing 	if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) {
86*3dca7526Stb 		ERR_load_const_strings(BUF_str_functs);
87*3dca7526Stb 		ERR_load_const_strings(BUF_str_reasons);
885b37fcf3Sryker 	}
894fcf65c5Sdjm #endif
905b37fcf3Sryker }
91ead8f799Sbeck LCRYPTO_ALIAS(ERR_load_BUF_strings);
92