34 #include "asterisk/module.h"
39 #define AES_BLOCK_SIZE 16
88 char *buf,
size_t len)
93 int data_len, encrypt;
110 ast_log(
LOG_WARNING,
"Syntax: %s(<key>,<data>) - <key> parameter must be exactly 16 characters!\n", cmd);
122 encrypt = strcmp(
"AES_DECRYPT", cmd);
126 data_len = strlen(tmp);
131 if (data_len >= len) {
132 ast_log(
LOG_WARNING,
"Syntax: %s(<keys>,<data>) - <data> exceeds buffer length. Result may be truncated!\n", cmd);
136 while (data_len > 0) {
151 memcpy(buf, tmp, len);
159 .
name =
"AES_ENCRYPT",
164 .
name =
"AES_DECRYPT",
184 .nonoptreq =
"res_crypto",
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
static int load_module(void)
static int unload_module(void)
int ast_aes_set_encrypt_key(const unsigned char *key, ast_aes_encrypt_key *ctx)
Set an encryption key.
Provide cryptographic signature routines.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
void ast_aes_decrypt(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *ctx)
AES decrypt data.
AES_KEY ast_aes_encrypt_key
int ast_base64decode(unsigned char *dst, const char *src, int max)
Decode data from base64.
void ast_aes_encrypt(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *ctx)
AES encrypt data.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
static struct ast_custom_function aes_decrypt_function
static int aes_helper(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Core PBX routines and definitions.
int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max)
Encode data in base64.
int ast_aes_set_decrypt_key(const unsigned char *key, ast_aes_decrypt_key *ctx)
Set a decryption key.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
AES_KEY ast_aes_decrypt_key
static struct ast_custom_function aes_encrypt_function
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define AST_APP_ARG(name)
Define an application argument.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_custom_function_register(acf)
Register a custom function.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.