Fri Jun 19 12:09:24 2009

Asterisk developer's documentation


aes.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 20075, Digium, Inc.
00005  *
00006  * Kevin P. Fleming <kpfleming@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 /*! \file
00020  * Wrappers for AES encryption/decryption
00021  *
00022  * \author Kevin P. Fleming <kpfleming@digium.com>
00023  *
00024  * These wrappers provided a generic interface to either the
00025  * AES methods provided by OpenSSL's crypto library, or the
00026  * AES implementation included with Asterisk.
00027  */
00028 
00029 #ifndef _ASTERISK_AES_H
00030 #define _ASTERISK_AES_H
00031 
00032 #ifdef HAVE_CRYPTO
00033 
00034 /* Use the OpenSSL crypto library */
00035 #include "openssl/aes.h"
00036 
00037 typedef AES_KEY ast_aes_encrypt_key;
00038 typedef AES_KEY ast_aes_decrypt_key;
00039 
00040 #define ast_aes_encrypt_key(key, context) AES_set_encrypt_key(key, 128, context)
00041 
00042 #define ast_aes_decrypt_key(key, context) AES_set_decrypt_key(key, 128, context)
00043 
00044 #define ast_aes_encrypt(in, out, context) AES_encrypt(in, out, context)
00045 
00046 #define ast_aes_decrypt(in, out, context) AES_decrypt(in, out, context)
00047 
00048 #else /* !HAVE_CRYPTO */
00049 
00050 /* Use the included AES implementation */
00051 
00052 #include "aes_internal.h"
00053 
00054 typedef aes_encrypt_ctx ast_aes_encrypt_key;
00055 typedef aes_decrypt_ctx ast_aes_decrypt_key;
00056 
00057 #define ast_aes_encrypt_key(key, context) aes_encrypt_key128(key, context)
00058 
00059 #define ast_aes_decrypt_key(key, context) aes_decrypt_key128(key, context)
00060 
00061 #define ast_aes_encrypt(in, out, context) aes_encrypt(in, out, context)
00062 
00063 #define ast_aes_decrypt(in, out, context) aes_decrypt(in, out, context)
00064 
00065 #endif /* !HAVE_CRYPTO */
00066 
00067 #endif /* _ASTERISK_AES_H */

Generated on Fri Jun 19 12:09:24 2009 for Asterisk - the Open Source PBX by  doxygen 1.4.7