[Asterisk-cvs] asterisk/res res_crypto.c,1.26,1.27
markster
markster
Sat Oct 15 23:14:47 CDT 2005
Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv7333/res
Modified Files:
res_crypto.c
Log Message:
Make crypto loading optional
Index: res_crypto.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_crypto.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- res_crypto.c 14 Sep 2005 20:46:50 -0000 1.26
+++ res_crypto.c 16 Oct 2005 03:08:58 -0000 1.27
@@ -129,7 +129,7 @@
return -1;
}
-struct ast_key *ast_key_get(char *kname, int ktype)
+static struct ast_key *__ast_key_get(const char *kname, int ktype)
{
struct ast_key *key;
ast_mutex_lock(&keylock);
@@ -314,7 +314,7 @@
#endif
-int ast_sign_bin(struct ast_key *key, char *msg, int msglen, unsigned char *dsig)
+static int __ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *dsig)
{
unsigned char digest[20];
unsigned int siglen = 128;
@@ -345,7 +345,7 @@
}
-extern int ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
+static int __ast_decrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
{
int res;
int pos = 0;
@@ -371,7 +371,7 @@
return pos;
}
-extern int ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
+static int __ast_encrypt_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
{
int res;
int bytes;
@@ -399,7 +399,7 @@
return pos;
}
-int ast_sign(struct ast_key *key, char *msg, char *sig)
+static int __ast_sign(struct ast_key *key, char *msg, char *sig)
{
unsigned char dsig[128];
int siglen = sizeof(dsig);
@@ -412,7 +412,7 @@
}
-int ast_check_signature_bin(struct ast_key *key, char *msg, int msglen, unsigned char *dsig)
+static int __ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *dsig)
{
unsigned char digest[20];
int res;
@@ -428,7 +428,7 @@
SHA1((unsigned char *)msg, msglen, digest);
/* Verify signature */
- res = RSA_verify(NID_sha1, digest, sizeof(digest), dsig, 128, key->rsa);
+ res = RSA_verify(NID_sha1, digest, sizeof(digest), (unsigned char *)dsig, 128, key->rsa);
if (!res) {
ast_log(LOG_DEBUG, "Key failed verification: %s\n", key->name);
@@ -438,7 +438,7 @@
return 0;
}
-int ast_check_signature(struct ast_key *key, char *msg, char *sig)
+static int __ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
{
unsigned char dsig[128];
int res;
@@ -571,6 +571,15 @@
ERR_load_crypto_strings();
ast_cli_register(&cli_show_keys);
ast_cli_register(&cli_init_keys);
+
+ /* 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 svn-commits
mailing list