94{
96 char *tmp;
97 char *tmpP;
98 int data_len, encrypt;
101
105 );
106
108
111 return -1;
112 }
113
115 ast_log(
LOG_WARNING,
"Syntax: %s(<key>,<data>) - <key> parameter must be exactly 16 characters!\n", cmd);
116 return -1;
117 }
118
122 if (!tmp) {
124 return -1;
125 }
126 tmpP = tmp;
127 encrypt = strcmp("AES_DECRYPT", cmd);
128
129 if (encrypt) {
131 data_len = strlen(tmp);
132 } else {
134 }
135
136 if (data_len >=
len) {
137 ast_log(
LOG_WARNING,
"Syntax: %s(<keys>,<data>) - <data> exceeds buffer length. Result may be truncated!\n", cmd);
139 }
140
141 while (data_len > 0) {
144 if (encrypt) {
146 } else {
148 }
151 }
152
153 if (encrypt) {
155 } else {
157 }
159
160 return 0;
161}
#define ast_calloc(num, len)
A wrapper for calloc()
int ast_aes_set_encrypt_key(const unsigned char *key, ast_aes_encrypt_key *ctx)
Set an encryption key.
int ast_aes_set_decrypt_key(const unsigned char *key, ast_aes_decrypt_key *ctx)
Set a decryption key.
int ast_aes_encrypt(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *key)
AES encrypt data.
int ast_aes_decrypt(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *key)
AES decrypt data.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
int ast_base64decode(unsigned char *dst, const char *src, int max)
Decode data from base64.
int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max)
Encode data in base64.