[asterisk-commits] kpfleming: branch kpfleming/nostubs r70902 - in /team/kpfleming/nostubs: ./ c...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 21 17:03:30 CDT 2007
Author: kpfleming
Date: Thu Jun 21 17:03:30 2007
New Revision: 70902
URL: http://svn.digium.com/view/asterisk?view=rev&rev=70902
Log:
put this stuff into a branch so i can back it up and others can see what i am breaking
Added:
team/kpfleming/nostubs/
- copied from r70805, trunk/
Removed:
team/kpfleming/nostubs/main/cryptostub.c
Modified:
team/kpfleming/nostubs/channels/chan_iax2.c
team/kpfleming/nostubs/include/asterisk/crypto.h
team/kpfleming/nostubs/main/Makefile
team/kpfleming/nostubs/res/ (props changed)
team/kpfleming/nostubs/res/Makefile
team/kpfleming/nostubs/res/res_crypto.c
Modified: team/kpfleming/nostubs/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/nostubs/channels/chan_iax2.c?view=diff&rev=70902&r1=70805&r2=70902
==============================================================================
--- team/kpfleming/nostubs/channels/chan_iax2.c (original)
+++ team/kpfleming/nostubs/channels/chan_iax2.c Thu Jun 21 17:03:30 2007
@@ -30,7 +30,7 @@
/*** MODULEINFO
<use>zaptel</use>
- <use>crypto</use>
+ <use>res_crypto</use>
***/
#include "asterisk.h"
Modified: team/kpfleming/nostubs/include/asterisk/crypto.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/nostubs/include/asterisk/crypto.h?view=diff&rev=70902&r1=70805&r2=70902
==============================================================================
--- team/kpfleming/nostubs/include/asterisk/crypto.h (original)
+++ team/kpfleming/nostubs/include/asterisk/crypto.h Thu Jun 21 17:03:30 2007
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2007, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -32,13 +32,19 @@
struct ast_key;
+#if defined(AST_MODULE_RES_CRYPTO)
+#define crypto_api(name, returntype, default, ...) returntype name(__VA_ARGS__)
+#else
+#define crypto_api(name, returntype, default, ...) static inline returntype name(__VA_ARGS__) { return default; }
+#endif
+
/*! \brief Retrieve a key
* \param name of the key we are retrieving
* \param int type of key (AST_KEY_PUBLIC or AST_KEY_PRIVATE)
*
* Returns the key on success or NULL on failure
*/
-struct ast_key *(*ast_key_get)(const char *key, int type);
+crypto_api(ast_key_get, struct ast_key *, NULL, const char *key, int type);
/*! \brief Check the authenticity of a message signature using a given public key
* \param key a public key to use to verify
@@ -48,7 +54,7 @@
* Returns 0 if the signature is valid, or -1 otherwise
*
*/
-int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig);
+crypto_api(ast_check_signature, int, -1, struct ast_key *key, const char *msg, const char *sig);
/*! \brief Check the authenticity of a message signature using a given public key
* \param key a public key to use to verify
@@ -58,7 +64,7 @@
* Returns 0 if the signature is valid, or -1 otherwise
*
*/
-int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig);
+crypto_api(ast_check_signature_bin, int, -1, struct ast_key *key, const char *msg, int msglen, const unsigned char *sig);
/*!
* \param key a private key to use to create the signature
@@ -69,7 +75,7 @@
* Returns 0 on success or -1 on failure.
*
*/
-int (*ast_sign)(struct ast_key *key, char *msg, char *sig);
+crypto_api(ast_sign, int, -1, struct ast_key *key, char *msg, char *sig);
/*!
* \param key a private key to use to create the signature
@@ -80,7 +86,7 @@
* Returns 0 on success or -1 on failure.
*
*/
-int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig);
+crypto_api(ast_sign_bin, int, -1, struct ast_key *key, const char *msg, int msglen, unsigned char *sig);
/*!
* \param key a private key to use to encrypt
@@ -92,7 +98,7 @@
* Returns length of encrypted data on success or -1 on failure.
*
*/
-int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+crypto_api(ast_encrypt_bin, int, -1, unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
/*!
* \param key a private key to use to decrypt
@@ -104,7 +110,10 @@
* Returns length of decrypted data on success or -1 on failure.
*
*/
-int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+crypto_api(ast_decrypt_bin, int, -1, unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key);
+
+#undef crypto_api
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
Modified: team/kpfleming/nostubs/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/kpfleming/nostubs/main/Makefile?view=diff&rev=70902&r1=70805&r2=70902
==============================================================================
--- team/kpfleming/nostubs/main/Makefile (original)
+++ team/kpfleming/nostubs/main/Makefile Thu Jun 21 17:03:30 2007
@@ -25,7 +25,7 @@
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 \
- cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
+ sha1.o http.o fixedjitterbuf.o abstract_jb.o \
strcompat.o threadstorage.o dial.o event.o adsistub.o
# we need to link in the objects statically, not as a library, because
Propchange: team/kpfleming/nostubs/res/
------------------------------------------------------------------------------
--- svn:externals (added)
+++ svn:externals Thu Jun 21 17:03:30 2007
@@ -1,0 +1,1 @@
+libtomcrypt https://origsvn.digium.com/svn/libtomcrypt/trunk
Modified: team/kpfleming/nostubs/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/kpfleming/nostubs/res/Makefile?view=diff&rev=70902&r1=70805&r2=70902
==============================================================================
--- team/kpfleming/nostubs/res/Makefile (original)
+++ team/kpfleming/nostubs/res/Makefile Thu Jun 21 17:03:30 2007
@@ -27,5 +27,11 @@
$(if $(filter res_snmp,$(EMBEDDED_MODS)),modules.link,res_snmp.so): snmp/agent.o
+$(if $(filter res_crypto,$(EMBEDDED_MODS)),modules.link,res_crypto.so): libtomcrypt/libtomcrypt.a
+
+libtomcrypt/libtomcrypt.a:
+ $(MAKE) -C libtomcrypt -f Makefile.asterisk all
+
clean::
rm -f snmp/*.o
+ @$(MAKE) -C libtomcrypt -f Makefile.asterisk clean
Modified: team/kpfleming/nostubs/res/res_crypto.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/nostubs/res/res_crypto.c?view=diff&rev=70902&r1=70805&r2=70902
==============================================================================
--- team/kpfleming/nostubs/res/res_crypto.c (original)
+++ team/kpfleming/nostubs/res/res_crypto.c Thu Jun 21 17:03:30 2007
@@ -137,7 +137,7 @@
return -1;
}
-static struct ast_key *__ast_key_get(const char *kname, int ktype)
+struct ast_key *ast_key_get(const char *kname, int ktype)
{
struct ast_key *key;
ast_mutex_lock(&keylock);
@@ -318,7 +318,7 @@
#endif
-static int __ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *dsig)
+int ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *dsig)
{
unsigned char digest[20];
unsigned int siglen = 128;
@@ -349,7 +349,7 @@
}
-static int __ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
+int ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
{
int res;
int pos = 0;
@@ -375,7 +375,7 @@
return pos;
}
-static int __ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
+int ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
{
int res;
int bytes;
@@ -403,7 +403,7 @@
return pos;
}
-static int __ast_sign(struct ast_key *key, char *msg, char *sig)
+int ast_sign(struct ast_key *key, char *msg, char *sig)
{
unsigned char dsig[128];
int siglen = sizeof(dsig);
@@ -416,7 +416,7 @@
}
-static int __ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *dsig)
+int ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *dsig)
{
unsigned char digest[20];
int res;
@@ -442,7 +442,7 @@
return 0;
}
-static int __ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
+int ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
{
unsigned char dsig[128];
int res;
@@ -579,14 +579,6 @@
ERR_load_crypto_strings();
ast_cli_register_multiple(cli_crypto, sizeof(cli_crypto) / sizeof(struct ast_cli_entry));
- /* Install ourselves into stubs */
- ast_key_get = __ast_key_get;
- ast_check_signature = __ast_check_signature;
- ast_check_signature_bin = __ast_check_signature_bin;
- ast_sign = __ast_sign;
- ast_sign_bin = __ast_sign_bin;
- ast_encrypt_bin = __ast_encrypt_bin;
- ast_decrypt_bin = __ast_decrypt_bin;
return 0;
}
More information about the asterisk-commits
mailing list