Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv7333

Modified Files:
        Makefile 
Added Files:
        cryptostub.c 
Log Message:
Make crypto loading optional


--- NEW FILE: cryptostub.c ---
/*
 * Asterisk -- An open source telephony toolkit.
 *
 * Copyright (C) 1999 - 2005, Digium, Inc.
 *
 * Mark Spencer <[EMAIL PROTECTED]>
 *
 * See http://www.asterisk.org for more information about
 * the Asterisk project. Please do not directly contact
 * any of the maintainers of this project for assistance;
 * the project provides a web site, mailing lists and IRC
 * channels for your use.
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */

#include <asterisk/crypto.h>


/* Hrm, I wonder if the compiler is smart enough to only create two functions
   for all these...  I could force it to only make two, but those would be some
   really nasty looking casts. */
   
static struct ast_key *stub_ast_key_get(const char *kname, int ktype)
{
        ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
        return NULL;
}

static int stub_ast_check_signature(struct ast_key *key, const char *msg, const 
char *sig)
{
        ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
        return -1;
}

static int stub_ast_check_signature_bin(struct ast_key *key, const char *msg, 
int msglen, const unsigned char *sig)
{
        ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
        return -1;
}

static int stub_ast_sign(struct ast_key *key, char *msg, char *sig) 
{
        ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
        return -1;
}

static int stub_ast_sign_bin(struct ast_key *key, const char *msg, int msglen, 
unsigned char *sig)
{
        ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
        return -1;
}

static int stub_ast_encdec_bin(unsigned char *dst, const unsigned char *src, 
int srclen, struct ast_key *key)
{
        ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
        return -1;
}

struct ast_key *(*ast_key_get)(const char *key, int type) = 
        stub_ast_key_get;

int (*ast_check_signature)(struct ast_key *key, const char *msg, const char 
*sig) =
        stub_ast_check_signature;
        
int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int 
msglen, const unsigned char *sig) =
        stub_ast_check_signature_bin;
        
int (*ast_sign)(struct ast_key *key, char *msg, char *sig) = 
        stub_ast_sign;

int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned 
char *sig) =
        stub_ast_sign_bin;
        
int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int 
srclen, struct ast_key *key) =
        stub_ast_encdec_bin;

int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int 
srclen, struct ast_key *key) =
        stub_ast_encdec_bin;

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/asterisk/Makefile,v
retrieving revision 1.215
retrieving revision 1.216
diff -u -d -r1.215 -r1.216
--- Makefile    14 Oct 2005 00:07:14 -0000      1.215
+++ Makefile    16 Oct 2005 03:08:58 -0000      1.216
@@ -51,6 +51,10 @@
 #Include debug symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g #-pg
 
+#Set NOCRYPTO to yes if you do not want to have crypto support or 
+#dependencies
+#NOCRYPTO=yes
+
 # If you are running a radio application, define RADIO_RELAX so that the DTMF
 # will be received more reliably
 #OPTIONS += -DRADIO_RELAX
@@ -299,7 +303,8 @@
        dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
        astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
        utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
-       netsock.o slinfactory.o ast_expr2.o ast_expr2f.o
+       netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
+       cryptostub.o
 
 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
   OBJS+= poll.o

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to