summaryrefslogtreecommitdiff
path: root/res/res_crypto.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2010-07-21 19:11:32 +0000
committerTerry Wilson <twilson@digium.com>2010-07-21 19:11:32 +0000
commitd6e1c724e59a0b01b7ed23ba3cbfc1accdc11035 (patch)
tree702c8203da791c3e168d1a0ef5d07dbafea3dd54 /res/res_crypto.c
parent318798e93236e24cd5820ee23a15561ba9b54b9e (diff)
Remove built-in AES code and use optional_api instead
Review: https://reviewboard.asterisk.org/r/793/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278538 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_crypto.c')
-rw-r--r--res/res_crypto.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/res/res_crypto.c b/res/res_crypto.c
index cb87eeec3..e7793a6aa 100644
--- a/res/res_crypto.c
+++ b/res/res_crypto.c
@@ -37,6 +37,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/paths.h" /* use ast_config_AST_KEY_DIR */
#include <openssl/ssl.h>
#include <openssl/err.h>
+#include <openssl/aes.h>
#include <dirent.h>
#include "asterisk/module.h"
@@ -453,6 +454,26 @@ int AST_OPTIONAL_API_NAME(ast_crypto_loaded)(void)
return 1;
}
+int AST_OPTIONAL_API_NAME(ast_aes_set_encrypt_key)(const unsigned char *key, ast_aes_encrypt_key *ctx)
+{
+ return AES_set_encrypt_key(key, 128, ctx);
+}
+
+int AST_OPTIONAL_API_NAME(ast_aes_set_decrypt_key)(const unsigned char *key, ast_aes_decrypt_key *ctx)
+{
+ return AES_set_decrypt_key(key, 128, ctx);
+}
+
+void AST_OPTIONAL_API_NAME(ast_aes_encrypt)(const unsigned char *in, unsigned char *out, const ast_aes_encrypt_key *ctx)
+{
+ return AES_encrypt(in, out, ctx);
+}
+
+void AST_OPTIONAL_API_NAME(ast_aes_decrypt)(const unsigned char *in, unsigned char *out, const ast_aes_decrypt_key *ctx)
+{
+ return AES_decrypt(in, out, ctx);
+}
+
/*!
* \brief refresh RSA keys from file
* \param ifd file descriptor