ccipher.h

00001 /*
00002  * Copyright (c) 2005-2012 by KoanLogic s.r.l. <http://www.koanlogic.com>
00003  * All rights reserved.
00004  *
00005  * This file is part of KLone, and as such it is subject to the license stated
00006  * in the LICENSE file which you have received as part of this distribution.
00007  *
00008  * $Id: ccipher.h,v 1.8 2006/01/09 12:38:37 tat Exp $
00009  */
00010 
00011 #ifndef _KLONE_CODEC_CIPHER_H_
00012 #define _KLONE_CODEC_CIPHER_H_
00013 
00014 #include "klone_conf.h"
00015 #include <klone/codec.h>
00016 
00017 #ifdef SSL_ON
00018 #include <openssl/evp.h>
00019 
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif 
00023 
00024 #ifdef SSL_CYASSL
00025 #define EVP_MAX_KEY_LENGTH      32
00026 #define EVP_MAX_IV_LENGTH       16
00027 #define EVP_MAX_BLOCK_LENGTH        32
00028 #define EVP_aes_256_cbc()       "AES-CBC-256"
00029 
00030 #endif
00031 
00032 /* possibile values for io_gzip_create */
00033 enum { CIPHER_ENCRYPT, CIPHER_DECRYPT };
00034 
00035 enum {
00036     CODEC_CIPHER_KEY_LEN = EVP_MAX_KEY_LENGTH, 
00037     CODEC_CIPHER_KEY_BUFSZ = 2 * EVP_MAX_KEY_LENGTH, 
00038     CODEC_CIPHER_IV_LEN = EVP_MAX_IV_LENGTH,
00039     CODEC_CIPHER_BLOCK_LEN = EVP_MAX_BLOCK_LENGTH,
00040 };
00041 
00042 int codec_cipher_create(int op, const EVP_CIPHER *cipher, 
00043     unsigned char *key, unsigned char *iv, codec_t **pcc);
00044 
00045 #ifdef __cplusplus
00046 }
00047 #endif 
00048 
00049 #else /* SSL_ON */
00050 /* to avoid ifdefs in local variable declaration (such vars will not be used 
00051    anyway because the code that use them is ifdef-out) */
00052 enum {
00053     CODEC_CIPHER_KEY_LEN = 0, 
00054     CODEC_CIPHER_KEY_BUFSZ = 0, 
00055     CODEC_CIPHER_IV_LEN = 0
00056 };
00057 
00058 #endif /* SSL_ON */
00059 
00060 #endif /* !_KLONE_CODEC_CIPHER_H_ */

←Products
Copyright © 2005-2012 - KoanLogic S.r.l. - All rights reserved