![]() |
Home page |
Mailing list |
Docs
Asterisk developer's documentation :: Codename Pineapple
cryptostub.c
Go to the documentation of this file.
00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * Copyright (C) 1999 - 2005, Digium, Inc. 00005 * 00006 * Mark Spencer <markster@digium.com> 00007 * 00008 * See http://www.asterisk.org for more information about 00009 * the Asterisk project. Please do not directly contact 00010 * any of the maintainers of this project for assistance; 00011 * the project provides a web site, mailing lists and IRC 00012 * channels for your use. 00013 * 00014 * This program is free software, distributed under the terms of 00015 * the GNU General Public License Version 2. See the LICENSE file 00016 * at the top of the source tree. 00017 */ 00018 00019 /*! \file 00020 * 00021 * \brief Stubs for res_crypto routines 00022 * 00023 * \author Mark Spencer <markster@digium.com> 00024 */ 00025 00026 #include "asterisk.h" 00027 00028 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 40722 $") 00029 00030 #include <unistd.h> 00031 #include <stdlib.h> 00032 00033 #include "asterisk/crypto.h" 00034 #include "asterisk/logger.h" 00035 00036 /* Hrm, I wonder if the compiler is smart enough to only create two functions 00037 for all these... I could force it to only make two, but those would be some 00038 really nasty looking casts. */ 00039 00040 static struct ast_key *stub_ast_key_get(const char *kname, int ktype) 00041 { 00042 ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); 00043 return NULL; 00044 } 00045 00046 static int stub_ast_check_signature(struct ast_key *key, const char *msg, const char *sig) 00047 { 00048 ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); 00049 return -1; 00050 } 00051 00052 static int stub_ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig) 00053 { 00054 ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); 00055 return -1; 00056 } 00057 00058 static int stub_ast_sign(struct ast_key *key, char *msg, char *sig) 00059 { 00060 ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); 00061 return -1; 00062 } 00063 00064 static int stub_ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *sig) 00065 { 00066 ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); 00067 return -1; 00068 } 00069 00070 static int stub_ast_encdec_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) 00071 { 00072 ast_log(LOG_NOTICE, "Crypto support not loaded!\n"); 00073 return -1; 00074 } 00075 00076 struct ast_key *(*ast_key_get)(const char *key, int type) = 00077 stub_ast_key_get; 00078 00079 int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig) = 00080 stub_ast_check_signature; 00081 00082 int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig) = 00083 stub_ast_check_signature_bin; 00084 00085 int (*ast_sign)(struct ast_key *key, char *msg, char *sig) = 00086 stub_ast_sign; 00087 00088 int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig) = 00089 stub_ast_sign_bin; 00090 00091 int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) = 00092 stub_ast_encdec_bin; 00093 00094 int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) = 00095 stub_ast_encdec_bin;