Don't include logger.h in asterisk.h by default as it is causing problems building
[asterisk/asterisk.git] / main / cryptostub.c
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18
19 /*! \file
20  *
21  * \brief Stubs for res_crypto routines
22  *
23  * \author Mark Spencer <markster@digium.com>
24  */
25
26 #include "asterisk.h"
27
28 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
29
30 #include "asterisk/crypto.h"
31 #include "asterisk/logger.h"
32
33 static struct ast_key *stub_ast_key_get(const char *kname, int ktype)
34 {
35         ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
36         return NULL;
37 }
38
39 #ifdef SKREP
40 #define build_stub(func_name,...) \
41 static int stub_ ## func_name(__VA_ARGS__) \
42 { \
43         ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
44         return -1; \
45 } \
46 \
47 int (*func_name)(__VA_ARGS__) = \
48         stub_ ## func_name;
49 #endif
50 #define build_stub(func_name,...) \
51 static int stub_##func_name(__VA_ARGS__) \
52 { \
53         ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); \
54         return -1; \
55 } \
56 \
57 int (*func_name)(__VA_ARGS__) = \
58         stub_##func_name;
59
60 struct ast_key *(*ast_key_get)(const char *key, int type) =
61 stub_ast_key_get;
62
63 build_stub(ast_check_signature, struct ast_key *key, const char *msg, const char *sig);
64 build_stub(ast_check_signature_bin, struct ast_key *key, const char *msg, int msglen, const unsigned char *sig);
65 build_stub(ast_sign, struct ast_key *key, char *msg, char *sig);
66 build_stub(ast_sign_bin, struct ast_key *key, const char *msg, int msglen, unsigned char *sig);
67 build_stub(ast_encrypt_bin, unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
68 build_stub(ast_decrypt_bin, unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);