openssl_cipher_ctx.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2003-2004 The Apache Software Foundation.
00003  *
00004  *   Licensed under the Apache License, Version 2.0 (the "License");
00005  *   you may not use this file except in compliance with the License.
00006  *   You may obtain a copy of the License at
00007  *
00008  *       http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *   Unless required by applicable law or agreed to in writing, software
00011  *   distributed under the License is distributed on an "AS IS" BASIS,
00012  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *   See the License for the specific language governing permissions and
00014  *   limitations under the License.
00015  */
00016 #include <axis2_defines.h>
00017 #include <axis2_env.h>
00018 #include <openssl/evp.h>
00019 #include <oxs_key.h>
00024 #ifndef OPENSSL_CIPHER_CTX_H
00025 #define OPENSSL_CIPHER_CTX_H
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 
00033     typedef struct openssl_cipher_ctx_ops openssl_cipher_ctx_ops_t;
00035     typedef struct openssl_cipher_ctx openssl_cipher_ctx_t;
00036 
00037 
00038     struct openssl_cipher_ctx_ops
00039     {
00046         axis2_status_t (AXIS2_CALL *
00047         free)(openssl_cipher_ctx_t *ctx,
00048             const axis2_env_t *env
00049             );
00056         const EVP_CIPHER* (AXIS2_CALL *
00057         get_cipher)(openssl_cipher_ctx_t *ctx,
00058             const axis2_env_t *env
00059             );
00066         oxs_key_t *(AXIS2_CALL *
00067         get_key)(openssl_cipher_ctx_t *ctx,
00068             const axis2_env_t *env
00069             );
00076         axis2_char_t *(AXIS2_CALL *
00077         get_iv)(openssl_cipher_ctx_t *ctx,
00078             const axis2_env_t *env
00079             );
00086         axis2_char_t *(AXIS2_CALL *
00087         get_pad)(openssl_cipher_ctx_t *ctx,
00088             const axis2_env_t *env
00089             );
00090     
00091         axis2_status_t (AXIS2_CALL *
00092         set_cipher)(openssl_cipher_ctx_t *ctx,
00093             const axis2_env_t *env,
00094             const EVP_CIPHER* cipher
00095             );
00096         
00097         axis2_status_t (AXIS2_CALL *
00098         set_key_value)(openssl_cipher_ctx_t *ctx,
00099             const axis2_env_t *env,
00100             oxs_key_t *key
00101             );
00102 
00103         axis2_status_t (AXIS2_CALL *
00104         set_iv)(openssl_cipher_ctx_t *ctx,
00105             const axis2_env_t *env,
00106             axis2_char_t *iv 
00107             );
00108 
00109         axis2_status_t (AXIS2_CALL *
00110         set_pad)(openssl_cipher_ctx_t *ctx,
00111             const axis2_env_t *env,
00112             axis2_char_t *pad 
00113             );
00114 
00115     };
00116 
00117     struct openssl_cipher_ctx
00118     {
00120         openssl_cipher_ctx_ops_t *ops;
00121     };
00122 
00123     /*Create function*/
00124     AXIS2_EXTERN openssl_cipher_ctx_t *AXIS2_CALL
00125     openssl_cipher_ctx_create(const axis2_env_t *env);
00126 
00127 /**********************Macros******************************************/
00128 #define OPENSSL_CIPHER_CTX_FREE(ctx, env)\
00129         ((ctx)->ops->free(ctx, env))
00130 
00131 #define OPENSSL_CIPHER_CTX_GET_CIPHER(ctx, env)\
00132         ((ctx)->ops->get_cipher(ctx, env)) 
00133 
00134 #define OPENSSL_CIPHER_CTX_GET_KEY(ctx, env)\
00135         ((ctx)->ops->get_key(ctx, env))
00136 
00137 #define OPENSSL_CIPHER_CTX_GET_IV(ctx, env)\
00138         ((ctx)->ops->get_iv(ctx, env)) 
00139 
00140 #define OPENSSL_CIPHER_CTX_GET_PAD(ctx, env)\
00141         ((ctx)->ops->get_pad(ctx, env)) 
00142 
00143 #define OPENSSL_CIPHER_CTX_SET_CIPHER(ctx, env, cipher)\
00144         ((ctx)->ops->set_cipher(ctx, env, cipher)) 
00145 
00146 #define OPENSSL_CIPHER_CTX_SET_IV(ctx, env, iv)\
00147         ((ctx)->ops->set_iv(ctx, env, iv)) 
00148 
00149 #define OPENSSL_CIPHER_CTX_SET_KEY(ctx, env, key)\
00150         ((ctx)->ops->set_key_value(ctx, env, key)) 
00151 
00152 #define OPENSSL_CIPHER_CTX_SET_PAD(ctx, env, pad)\
00153         ((ctx)->ops->set_pad(ctx, env, pad)) 
00154 
00155 /* @} */
00156 #ifdef __cplusplus
00157 }
00158 #endif
00159 
00160 #endif    /* OPENSSL_CIPHER_CTX_H */

Generated on Wed Dec 20 20:14:10 2006 for Axis2/C by  doxygen 1.5.1