Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:53 2009

## Asterisk developer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Directories

# 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 #include <unistd.h>
    00020 #include <stdlib.h>
    00021
    00022 #include "asterisk/crypto.h"
    00023 #include "asterisk/logger.h"
    00024
    00025 /* Hrm, I wonder if the compiler is smart enough to only create two functions
    00026    for all these...  I could force it to only make two, but those would be some
    00027    really nasty looking casts. */
    00028
    00029 static struct ast_key *stub_ast_key_get(const char *kname, int ktype)
    00030 {
    00031    ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
    00032    return NULL;
    00033 }
    00034
    00035 static int stub_ast_check_signature(struct ast_key *key, const char *msg, const char *sig)
    00036 {
    00037    ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
    00038    return -1;
    00039 }
    00040
    00041 static int stub_ast_check_signature_bin(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig)
    00042 {
    00043    ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
    00044    return -1;
    00045 }
    00046
    00047 static int stub_ast_sign(struct ast_key *key, char *msg, char *sig)
    00048 {
    00049    ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
    00050    return -1;
    00051 }
    00052
    00053 static int stub_ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *sig)
    00054 {
    00055    ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
    00056    return -1;
    00057 }
    00058
    00059 static int stub_ast_encdec_bin(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key)
    00060 {
    00061    ast_log(LOG_NOTICE, "Crypto support not loaded!\n");
    00062    return -1;
    00063 }
    00064
    00065 struct ast_key *(*ast_key_get)(const char *key, int type) =
    00066    stub_ast_key_get;
    00067
    00068 int (*ast_check_signature)(struct ast_key *key, const char *msg, const char *sig) =
    00069    stub_ast_check_signature;
    00070
    00071 int (*ast_check_signature_bin)(struct ast_key *key, const char *msg, int msglen, const unsigned char *sig) =
    00072    stub_ast_check_signature_bin;
    00073
    00074 int (*ast_sign)(struct ast_key *key, char *msg, char *sig) =
    00075    stub_ast_sign;
    00076
    00077 int (*ast_sign_bin)(struct ast_key *key, const char *msg, int msglen, unsigned char *sig) =
    00078    stub_ast_sign_bin;
    00079
    00080 int (*ast_encrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) =
    00081    stub_ast_encdec_bin;
    00082
    00083 int (*ast_decrypt_bin)(unsigned char *dst, const unsigned char *src, int srclen, struct ast_key *key) =
    00084    stub_ast_encdec_bin;