You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/03/26 07:31:27 UTC

svn commit: r522424 [1/2] - in /webservices/axis2/trunk/c/rampart: include/ src/omxmlsec/ src/omxmlsec/openssl/ src/util/ test/openssl/sign/

Author: kaushalye
Date: Sun Mar 25 22:31:25 2007
New Revision: 522424

URL: http://svn.apache.org/viewvc?view=rev&rev=522424
Log:
Applying patch in JIRA AXIS2C-558.
Plus some other minor modifications... 

Modified:
    webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h
    webservices/axis2/trunk/c/rampart/include/openssl_cipher_property.h
    webservices/axis2/trunk/c/rampart/include/openssl_pkey.h
    webservices/axis2/trunk/c/rampart/include/openssl_rsa.h
    webservices/axis2/trunk/c/rampart/include/oxs_buffer.h
    webservices/axis2/trunk/c/rampart/include/oxs_ctx.h
    webservices/axis2/trunk/c/rampart/include/oxs_key.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkey.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_util.c
    webservices/axis2/trunk/c/rampart/test/openssl/sign/test.c

Modified: webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h Sun Mar 25 22:31:25 2007
@@ -28,129 +28,88 @@
 extern "C" {
 #endif
 
-
-    /** Type name for struct openssl_cipher_ctx_ops */
-    typedef struct openssl_cipher_ctx_ops openssl_cipher_ctx_ops_t;
     /** Type name for struct openssl_cipher_ctx */
-    typedef struct openssl_cipher_ctx openssl_cipher_ctx_t;
-
+    typedef struct openssl_cipher_ctx_t openssl_cipher_ctx_t;
 
-    struct openssl_cipher_ctx_ops
-    {
-        /**
-         * Free function
-         * @param ctx to the openssl cipher ctx struct
-         * @param env pointer to environment struct
-         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
-         */	
-        axis2_status_t (AXIS2_CALL *
-        free)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env
-            );
-        /**
-         * Given the ctx return the CIPHER
-         * @param ctx to the openssl cipher ctx struct
-         * @param env pointer to environment struct
-         * @return RVP_CIPHER the cipher 
-         */	       
-        const EVP_CIPHER* (AXIS2_CALL *
-        get_cipher)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env
-            );
-        /**
-         * Given the ctx return key
-         * @param ctx to the openssl cipher ctx struct
-         * @param env pointer to environment struct
-         * @return key 
-         */	 
-        oxs_key_t *(AXIS2_CALL *
-        get_key)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env
-            );
-        /**
-         * Given the ctx return iv
-         * @param ctx to the openssl cipher ctx struct
-         * @param env pointer to environment struct
-         * @return iv 
-         */	        
-        axis2_char_t *(AXIS2_CALL *
-        get_iv)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env
-            );
-        /**
-         * Given the ctx return the padding
-         * @param ctx to the openssl cipher ctx struct
-         * @param env pointer to environment struct
-         * @return padding
-         */	        
-        axis2_char_t *(AXIS2_CALL *
-        get_pad)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env
-            );
+    /**
+     * Free function
+     * @param ctx to the openssl cipher ctx struct
+     * @param env pointer to environment struct
+     * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+     */	
+	axis2_status_t AXIS2_CALL
+			openssl_cipher_ctx_free(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env);
+    /**
+     * Given the ctx return the CIPHER
+     * @param ctx to the openssl cipher ctx struct
+     * @param env pointer to environment struct
+     * @return RVP_CIPHER the cipher 
+     */	       
+	const EVP_CIPHER* AXIS2_CALL
+			openssl_cipher_ctx_get_cipher(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env);
+    /**
+     * Given the ctx return key
+     * @param ctx to the openssl cipher ctx struct
+     * @param env pointer to environment struct
+     * @return key 
+     */	 
+	oxs_key_t *AXIS2_CALL
+			openssl_cipher_ctx_get_key(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env);
+    /**
+     * Given the ctx return iv
+     * @param ctx to the openssl cipher ctx struct
+     * @param env pointer to environment struct
+     * @return iv 
+     */	        
+	axis2_char_t *AXIS2_CALL
+			openssl_cipher_ctx_get_iv(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env);
+    /**
+     * Given the ctx return the padding
+     * @param ctx to the openssl cipher ctx struct
+     * @param env pointer to environment struct
+     * @return padding
+     */	        
+	axis2_char_t *AXIS2_CALL
+			openssl_cipher_ctx_get_pad(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env);
     
-        axis2_status_t (AXIS2_CALL *
-        set_cipher)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env,
-            const EVP_CIPHER* cipher
-            );
+	axis2_status_t AXIS2_CALL
+			openssl_cipher_ctx_set_cipher(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env,
+						const EVP_CIPHER*);
         
-        axis2_status_t (AXIS2_CALL *
-        set_key_value)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env,
-            oxs_key_t *key
-            );
-
-        axis2_status_t (AXIS2_CALL *
-        set_iv)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env,
-            axis2_char_t *iv 
-            );
-
-        axis2_status_t (AXIS2_CALL *
-        set_pad)(openssl_cipher_ctx_t *ctx,
-            const axis2_env_t *env,
-            axis2_char_t *pad 
-            );
-
-    };
-
-    struct openssl_cipher_ctx
-    {
-        /** operations of openssl_cipher_ctx */
-        openssl_cipher_ctx_ops_t *ops;
-    };
+	axis2_status_t AXIS2_CALL
+			openssl_cipher_ctx_set_key(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env,
+						oxs_key_t *key);
+
+	axis2_status_t AXIS2_CALL
+			openssl_cipher_ctx_set_iv(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env,
+						axis2_char_t *iv);
+
+	axis2_status_t AXIS2_CALL
+			openssl_cipher_ctx_set_pad(
+						openssl_cipher_ctx_t *ctx,
+						const axis2_env_t *env,
+						axis2_char_t *pad);
+    
 
     /*Create function*/
     AXIS2_EXTERN openssl_cipher_ctx_t *AXIS2_CALL
-    openssl_cipher_ctx_create(const axis2_env_t *env);
-
-/**********************Macros******************************************/
-#define OPENSSL_CIPHER_CTX_FREE(ctx, env)\
-        ((ctx)->ops->free(ctx, env))
-
-#define OPENSSL_CIPHER_CTX_GET_CIPHER(ctx, env)\
-        ((ctx)->ops->get_cipher(ctx, env)) 
-
-#define OPENSSL_CIPHER_CTX_GET_KEY(ctx, env)\
-        ((ctx)->ops->get_key(ctx, env))
-
-#define OPENSSL_CIPHER_CTX_GET_IV(ctx, env)\
-        ((ctx)->ops->get_iv(ctx, env)) 
-
-#define OPENSSL_CIPHER_CTX_GET_PAD(ctx, env)\
-        ((ctx)->ops->get_pad(ctx, env)) 
-
-#define OPENSSL_CIPHER_CTX_SET_CIPHER(ctx, env, cipher)\
-        ((ctx)->ops->set_cipher(ctx, env, cipher)) 
-
-#define OPENSSL_CIPHER_CTX_SET_IV(ctx, env, iv)\
-        ((ctx)->ops->set_iv(ctx, env, iv)) 
-
-#define OPENSSL_CIPHER_CTX_SET_KEY(ctx, env, key)\
-        ((ctx)->ops->set_key_value(ctx, env, key)) 
-
-#define OPENSSL_CIPHER_CTX_SET_PAD(ctx, env, pad)\
-        ((ctx)->ops->set_pad(ctx, env, pad)) 
+			openssl_cipher_ctx_create(const axis2_env_t *env);
 
 /* @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/include/openssl_cipher_property.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_cipher_property.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_cipher_property.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_cipher_property.h Sun Mar 25 22:31:25 2007
@@ -29,91 +29,80 @@
 #endif
 
 
-    /** Type name for struct  openssl_cipher_property_ops */
-    typedef struct openssl_cipher_property_ops openssl_cipher_property_ops_t;
+/** Type name for struct  openssl_cipher_property */
+typedef struct openssl_cipher_property_t openssl_cipher_property_t;
 
-    /** Type name for struct  openssl_cipher_property */
-    typedef struct openssl_cipher_property openssl_cipher_property_t;
 
-    struct openssl_cipher_property_ops
-    {
-        EVP_CIPHER *(AXIS2_CALL *
-                get_cipher)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
-
-        axis2_char_t *(AXIS2_CALL *
-                get_name)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
-
-        axis2_char_t *(AXIS2_CALL *
-                get_url)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
-
-        int (AXIS2_CALL *
-                get_key_size)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
-
-        int (AXIS2_CALL *
-                get_block_size)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
-
-        int (AXIS2_CALL *
-                get_iv_size)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
+EVP_CIPHER * AXIS2_CALL
+openssl_cipher_property_get_cipher(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+axis2_char_t * AXIS2_CALL
+openssl_cipher_property_get_name(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+axis2_char_t * AXIS2_CALL
+openssl_cipher_property_get_url(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+openssl_cipher_property_get_key_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+openssl_cipher_property_get_block_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+openssl_cipher_property_get_iv_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
     
-        axis2_status_t (AXIS2_CALL *
-                set_cipher)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env,
-                    EVP_CIPHER *cipher);
-
-        axis2_status_t (AXIS2_CALL *
-                set_name)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env,
-                    axis2_char_t *name);
-
-        axis2_status_t (AXIS2_CALL *
-                set_url)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env,
-                    axis2_char_t *url);
-
-        axis2_status_t (AXIS2_CALL *
-                set_key_size)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env,
-                    int key_size);
-
-        axis2_status_t (AXIS2_CALL *
-                set_block_size)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env,
-                    int block_size);
-
-        axis2_status_t (AXIS2_CALL *
-                set_iv_size)(
-                    const openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env,
-                    int iv_size);
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_cipher(
+    openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    EVP_CIPHER *cipher);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_name(
+    openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    axis2_char_t *name);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_url(
+    openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    axis2_char_t *name);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_key_size(
+    openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int   key_size);
+
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_block_size(
+    openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int  block_size);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_iv_size(
+    openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int   iv_size);
  
-        axis2_status_t (AXIS2_CALL *
-                free)(
-                    openssl_cipher_property_t *cprop,
-                    const axis2_env_t *env);
-
-    };
-
-    struct openssl_cipher_property
-    {
-        openssl_cipher_property_ops_t *ops;    
-    };
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_free(openssl_cipher_property_t * cprop, const axis2_env_t *env);
+
 
 /**
 * Create a fresh block cipher property
@@ -122,46 +111,7 @@
 AXIS2_EXTERN openssl_cipher_property_t *AXIS2_CALL
 openssl_cipher_property_create(const axis2_env_t *env);
 
-/******** Macros ***************/
-
-#define OPENSSL_CIPHER_PROPERTY_GET_CIPHER(cprop, env)\
-    ((cprop)->ops->get_cipher(cprop, env))
-
-#define OPENSSL_CIPHER_PROPERTY_GET_NAME(cprop, env)\
-    ((cprop)->ops->get_name(cprop, env))
-
-#define OPENSSL_CIPHER_PROPERTY_GET_URL(cprop, env)\
-    ((cprop)->ops->get_url(cprop, env))
-
-#define OPENSSL_CIPHER_PROPERTY_GET_KEY_SIZE(cprop, env)\
-    ((cprop)->ops->get_key_size(cprop, env))
-
-#define OPENSSL_CIPHER_PROPERTY_GET_BLOCK_SIZE(cprop, env)\
-    ((cprop)->ops->get_block_size(cprop, env))
-
-#define OPENSSL_CIPHER_PROPERTY_GET_IV_SIZE(cprop, env)\
-    ((cprop)->ops->get_iv_size(cprop, env))
-
-#define OPENSSL_CIPHER_PROPERTY_SET_CIPHER(cprop, env, cipher)\
-    ((cprop)->ops->set_cipher(cprop, env, cipher))
-
-#define OPENSSL_CIPHER_PROPERTY_SET_NAME(cprop, env, name)\
-    ((cprop)->ops->set_name(cprop, env, name))
-
-#define OPENSSL_CIPHER_PROPERTY_SET_URL(cprop, env, url)\
-    ((cprop)->ops->set_url(cprop, env, url))
-
-#define OPENSSL_CIPHER_PROPERTY_SET_KEY_SIZE(cprop, env, key_size)\
-    ((cprop)->ops->set_key_size(cprop, env, key_size))
-
-#define OPENSSL_CIPHER_PROPERTY_SET_BLOCK_SIZE(cprop, env, block_size)\
-    ((cprop)->ops->set_block_size(cprop, env, block_size))
-
-#define OPENSSL_CIPHER_PROPERTY_SET_IV_SIZE(cprop, env, iv_size)\
-    ((cprop)->ops->set_iv_size(cprop, env, iv_size))
 
-#define OPENSSL_CIPHER_PROPERTY_FREE(cprop, env)\
-    ((cprop)->ops->free(cprop, env))
 
 /* @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/include/openssl_pkey.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_pkey.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_pkey.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_pkey.h Sun Mar 25 22:31:25 2007
@@ -43,123 +43,84 @@
 #define OPENSSL_PKEY_TYPE_PUBLIC_KEY     1
 #define OPENSSL_PKEY_TYPE_PRIVATE_KEY    2
 
-    /** Type name for struct openssl_pkey_ops */
-    typedef struct openssl_pkey_ops openssl_pkey_ops_t;
+
     /** Type name for struct openssl_pkey */
-    typedef struct openssl_pkey openssl_pkey_t;
+    typedef struct openssl_pkey_t openssl_pkey_t;
 
 
-    struct openssl_pkey_ops
-    {
 
-        EVP_PKEY *(AXIS2_CALL *
-        get_key)(
-                    const openssl_pkey_t *pkey,
-                    const axis2_env_t *env
-                    );
-        axis2_char_t *(AXIS2_CALL *
-        get_name) (
-                    const openssl_pkey_t *pkey,
-                    const axis2_env_t *env
-                    );
-        int (AXIS2_CALL *
-        get_size)(
-                    const openssl_pkey_t *pkey,
-                    const axis2_env_t *env
-                    );
-        int (AXIS2_CALL *
-        get_type) (
-                    const openssl_pkey_t *pkey,
-                    const axis2_env_t *env
-                    );
-
-        axis2_status_t (AXIS2_CALL *
-        set_key )(
-                    openssl_pkey_t *pkey,
-                    const axis2_env_t *env,
-                    EVP_PKEY *key
-                    );
-
-        axis2_status_t (AXIS2_CALL*
-        set_name )(
-                    openssl_pkey_t *pkey,
-                    const axis2_env_t *env,
-                    axis2_char_t *name
-                    );
-        axis2_status_t (AXIS2_CALL*
-        set_type )(
-                    openssl_pkey_t *pkey,
-                    const axis2_env_t *env,
-                    int type
-                    );
-
-        axis2_status_t (AXIS2_CALL*
-        load )(
-                    openssl_pkey_t *pkey,
-                    const axis2_env_t *env,
-                    axis2_char_t *filename,
-                    axis2_char_t *password
-                    );
-
-        axis2_status_t (AXIS2_CALL*
-        populate)(
-                    openssl_pkey_t *pkey,
-                    const axis2_env_t *env,
-                    EVP_PKEY *key,
-                    axis2_char_t *name,
-                    int type
-                    );
-
-        axis2_status_t (AXIS2_CALL*
-        free )(
-                   openssl_pkey_t *pkey,
-                   const axis2_env_t *env
-                   );
+	EVP_PKEY *AXIS2_CALL
+	openssl_pkey_get_key(
+		const openssl_pkey_t *pkey,
+		const axis2_env_t *env
+	);
+
+	axis2_char_t *AXIS2_CALL
+	openssl_pkey_get_name(
+		const openssl_pkey_t *pkey,
+		const axis2_env_t *env
+	);
+
+	int AXIS2_CALL
+	openssl_pkey_get_size(
+		const openssl_pkey_t *pkey,
+		const axis2_env_t *env
+	);
+
+	int AXIS2_CALL
+	openssl_pkey_get_type(
+		const openssl_pkey_t *pkey,
+		const axis2_env_t *env
+	);
+
+
+	axis2_status_t AXIS2_CALL
+	openssl_pkey_set_key(
+		openssl_pkey_t *pkey,
+		const axis2_env_t *env,
+		EVP_PKEY *key
+	);
+
+	axis2_status_t AXIS2_CALL
+	openssl_pkey_set_name(
+		openssl_pkey_t *pkey,
+		const axis2_env_t *env,
+		axis2_char_t *name
+	);
+
+	axis2_status_t AXIS2_CALL
+	openssl_pkey_set_type(
+		openssl_pkey_t *pkey,
+		const axis2_env_t *env,
+		int type
+	);
+
+	axis2_status_t AXIS2_CALL
+	openssl_pkey_load(
+		openssl_pkey_t *pkey,
+		const axis2_env_t *env,
+		axis2_char_t *filename,
+		axis2_char_t *password
+	);
+
+	axis2_status_t AXIS2_CALL
+	openssl_pkey_populate(
+		openssl_pkey_t *pkey,
+		const axis2_env_t *env,
+		EVP_PKEY *key,
+		axis2_char_t *name,
+		int type
+	);
+
+	axis2_status_t AXIS2_CALL
+	openssl_pkey_free(
+		openssl_pkey_t *pkey,
+		const axis2_env_t *env
+	);
         
-    };
-
-    struct openssl_pkey
-    {
-        /** operations of openssl_pkey */
-        openssl_pkey_ops_t *ops;
-    };
-
     /*Create function*/
     AXIS2_EXTERN openssl_pkey_t *AXIS2_CALL
     openssl_pkey_create(const axis2_env_t *env);
-
-
-/**********************Macros******************************************/
-#define OPENSSL_PKEY_GET_KEY(pkey, env) \
-        ((pkey)->ops->get_key(pkey, env))
-
-#define OPENSSL_PKEY_GET_NAME(pkey, env) \
-        ((pkey)->ops->get_name(pkey, env))
-
-#define OPENSSL_PKEY_GET_SIZE(pkey, env) \
-        ((pkey)->ops->get_size(pkey, env))
-
-#define OPENSSL_PKEY_GET_TYPE(pkey, env) \
-        ((pkey)->ops->get_type(pkey, env))
-
-#define OPENSSL_PKEY_SET_KEY(pkey, env, key) \
-        ((pkey)->ops->set_key(pkey, env, key))
-
-#define OPENSSL_PKEY_SET_NAME(pkey, env, name) \
-        ((pkey)->ops->set_name(pkey, env, name))
-
-#define OPENSSL_PKEY_SET_TYPE(pkey, env, type) \
-        ((pkey)->ops->set_type(pkey, env, type))
-
-#define OPENSSL_PKEY_LOAD(pkey, env, filename, password) \
-        ((pkey)->ops->load(pkey, env, filename, password))
-
-#define OPENSSL_PKEY_POPULATE(pkey, env, key, name, type) \
-        ((pkey)->ops->populate(pkey, env, key, name, type))
-
-#define OPENSSL_PKEY_FREE(pkey, env) \
-        ((pkey)->ops->free(pkey, env))
-
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/include/openssl_rsa.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_rsa.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_rsa.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_rsa.h Sun Mar 25 22:31:25 2007
@@ -40,125 +40,73 @@
  * @{
  */
 
-    /** Type name for struct openssl_rsa_ops */
-    typedef struct openssl_rsa_ops      openssl_rsa_ops_t;
-    /** Type name for struct openssl_rsa */
-    typedef struct openssl_rsa          openssl_rsa_t;
-
-
-    struct openssl_rsa_ops
-    {
-    
-      /**
-        * Free function
-        * @rsa pointer to openssl_rsa struct
-        * @env pointer to environment struct
-        * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
-        **/
-
-        axis2_status_t (AXIS2_CALL *
-        free)(
-            openssl_rsa_t *rsa,
-            const axis2_env_t *env);
-
-      /**
-        * Decrypts data using a private key specified in @pkey
-        * @rsa pointer to openssl_rsa struct
-        * @env pointer to environment struct
-        * @pkey private key for decryption
-        * @in input data
-        * @out output data
-        * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
-        **/
-        int (AXIS2_CALL *
-        prv_decrypt)(
-            openssl_rsa_t *rsa,
-            const axis2_env_t *env,
-            const openssl_pkey_t *pkey,
-            const axis2_char_t *padding,
-            oxs_buffer_t *in,
-            oxs_buffer_t *out );
-
-      /**
-        * Encrypts data using a public key specified in @pkey
-        * @rsa pointer to openssl_rsa struct
-        * @env pointer to environment struct
-        * @pkey public key for encryption
-        * @in input data
-        * @out output data
-        * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
-        **/
-        int (AXIS2_CALL*
-        pub_encrypt)(
-            openssl_rsa_t *rsa,
-            const axis2_env_t *env,
-            const openssl_pkey_t *pkey,
-            const axis2_char_t *padding,
-            oxs_buffer_t *in,
-            oxs_buffer_t *out );
+  /**
+    * Decrypts data using a private key specified in @pkey
+    * @rsa pointer to openssl_rsa struct
+    * @env pointer to environment struct
+    * @pkey private key for decryption
+    * @in input data
+    * @out output data
+    * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+    **/
+	int AXIS2_CALL
+	openssl_rsa_prv_decrypt(
+		const axis2_env_t *env,
+		const openssl_pkey_t *pkey,
+		const axis2_char_t *padding,
+		oxs_buffer_t *in,
+		oxs_buffer_t *out);
+
+  /**
+    * Encrypts data using a public key specified in @pkey
+    * @rsa pointer to openssl_rsa struct
+    * @env pointer to environment struct
+    * @pkey public key for encryption
+    * @in input data
+    * @out output data
+    * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+    **/
+	int AXIS2_CALL
+	openssl_rsa_pub_encrypt(
+		const axis2_env_t *env,
+		const openssl_pkey_t *pkey,
+		const axis2_char_t *padding,
+		oxs_buffer_t *in,
+		oxs_buffer_t *out);
       
-      /**
-        * Sign data using a private key specified in @pkey
-        * @rsa pointer to openssl_rsa struct
-        * @env pointer to environment struct
-        * @pkey private key for decryption
-        * @in input data
-        * @out output data
-        * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
-        **/
-        int (AXIS2_CALL *
-        prv_encrypt)(
-            openssl_rsa_t *rsa,
-            const axis2_env_t *env,
-            const openssl_pkey_t *pkey,
-            const axis2_char_t *padding,
-            oxs_buffer_t *in,
-            oxs_buffer_t *out );
+  /**
+    * Sign data using a private key specified in @pkey
+    * @rsa pointer to openssl_rsa struct
+    * @env pointer to environment struct
+    * @pkey private key for decryption
+    * @in input data
+    * @out output data
+    * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+    **/
+	int AXIS2_CALL
+	openssl_rsa_prv_encrypt(
+		const axis2_env_t *env,
+		const openssl_pkey_t *pkey,
+		const axis2_char_t *padding,
+		oxs_buffer_t *in,
+		oxs_buffer_t *out);
       
-      /**
-        * Verifies data using a public key specified in @pkey
-        * @rsa pointer to openssl_rsa struct
-        * @env pointer to environment struct
-        * @pkey public key for encryption
-        * @in input data
-        * @out output data
-        * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
-        **/
-        int (AXIS2_CALL*
-        pub_decrypt)(
-            openssl_rsa_t *rsa,
-            const axis2_env_t *env,
-            const openssl_pkey_t *pkey,
-            const axis2_char_t *padding,
-            oxs_buffer_t *in,
-            oxs_buffer_t *out );
-    };
-
-    struct openssl_rsa
-    {
-        /** operations of openssl_rsa */
-        openssl_rsa_ops_t *ops;
-    };
-
-    /*Create function*/
-    AXIS2_EXTERN openssl_rsa_t *AXIS2_CALL
-    openssl_rsa_create(const axis2_env_t *env);
-
-/**********************Macros******************************************/
-#define OPENSSL_RSA_FREE(rsa, env) \
-        ((rsa)->ops->free(rsa, env) )
-
-#define OPENSSL_RSA_PRV_DECRYPT(rsa, env, pkey, padding, in, out) \
-        ((rsa)->ops->prv_decrypt(rsa, env, pkey, padding, in, out) )
-
-#define OPENSSL_RSA_PUB_ENCRYPT(rsa, env, pkey, padding, in, out) \
-        ((rsa)->ops->pub_encrypt(rsa, env, pkey, padding, in, out) )
-
-#define OPENSSL_RSA_PRV_ENCRYPT(rsa, env, pkey, padding, in, out) \
-        ((rsa)->ops->prv_encrypt(rsa, env, pkey, padding, in, out) )
-
-#define OPENSSL_RSA_PUB_DECRYPT(rsa, env, pkey, padding, in, out) \
-        ((rsa)->ops->pub_decrypt(rsa, env, pkey, padding, in, out) )
+  /**
+    * Verifies data using a public key specified in @pkey
+    * @rsa pointer to openssl_rsa struct
+    * @env pointer to environment struct
+    * @pkey public key for encryption
+    * @in input data
+    * @out output data
+    * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+    **/
+	int AXIS2_CALL
+	openssl_rsa_pub_decrypt(
+		const axis2_env_t *env,
+		const openssl_pkey_t *pkey,
+		const axis2_char_t *padding,
+		oxs_buffer_t *in,
+		oxs_buffer_t *out);
 
 
 /** @} */

Modified: webservices/axis2/trunk/c/rampart/include/oxs_buffer.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_buffer.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_buffer.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_buffer.h Sun Mar 25 22:31:25 2007
@@ -218,44 +218,6 @@
 AXIS2_EXTERN oxs_buffer_t *AXIS2_CALL
 oxs_buffer_create(const axis2_env_t *env);
 
-/*Macros*/
-
-#define OXS_BUFFER_FREE(buffer,env)\
-    (oxs_buffer_free(buffer,env))
-
-#define OXS_BUFFER_REMOVE_HEAD(buffer,env, size)\
-    (oxs_buffer_remove_head(buffer,env, size))
-
-#define OXS_BUFFER_REMOVE_TAIL(buffer,env, size)\
-    (oxs_buffer_remove_tail(buffer,env, size))
-
-#define OXS_BUFFER_POPULATE(buffer,env, data, size)\
-    (oxs_buffer_populate(buffer,env, data, size))
-
-#define OXS_BUFFER_APPEND(buffer,env, data, size)\
-    (oxs_buffer_append(buffer,env, data, size))
-
-#define OXS_BUFFER_PREPEND(buffer,env, data, size)\
-    (oxs_buffer_prepend(buffer,env, data, size))
-
-#define OXS_BUFFER_READ_FILE(buffer,env, file_name)\
-    (oxs_buffer_read_file(buffer,env, file_name))
-
-#define OXS_BUFFER_SET_SIZE(buffer,env, size)\
-    (oxs_buffer_set_size(buffer,env, size))
-
-#define OXS_BUFFER_SET_MAX_SIZE(buffer, env, size)\
-    (oxs_buffer_set_max_size(buffer, env, size))
-
-#define OXS_BUFFER_GET_DATA(buffer,env)\
-    (oxs_buffer_get_data(buffer,env))
-
-#define OXS_BUFFER_GET_SIZE(buffer,env)\
-    (oxs_buffer_get_size(buffer,env))
-
-#define OXS_BUFFER_GET_MAX_SIZE(buffer,env)\
-    (oxs_buffer_get_max_size(buffer,env))
-
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/include/oxs_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_ctx.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_ctx.h Sun Mar 25 22:31:25 2007
@@ -365,78 +365,6 @@
     oxs_ctx_create(const axis2_env_t *env);
 
 
-/**********************Macros******************************************/
-#define OXS_CTX_FREE(ctx, env) \
-        (oxs_ctx_free(ctx, env) )
-    
-#define OXS_CTX_GET_MODE(ctx, env) \
-        (oxs_ctx_get_mode(ctx, env) )
-    
-#define OXS_CTX_GET_OPERATION(ctx, env) \
-        (oxs_ctx_get_operation(ctx, env) )
-    
-#define OXS_CTX_GET_KEY(ctx, env) \
-        (oxs_ctx_get_key(ctx, env) )
-    
-#define OXS_CTX_GET_ID(ctx, env) \
-        (oxs_ctx_get_id(ctx, env) )
-    
-#define OXS_CTX_GET_TYPE(ctx, env) \
-        (oxs_ctx_get_type(ctx, env) )
-    
-#define OXS_CTX_GET_MIME_TYPE(ctx, env) \
-        (oxs_ctx_get_mime_type(ctx, env) )
-    
-#define OXS_CTX_GET_ENCODING(ctx, env) \
-        (oxs_ctx_get_encoding(ctx, env) )
-    
-#define OXS_CTX_GET_RECIPIENT(ctx, env) \
-        (oxs_ctx_get_recipient(ctx, env) )
-    
-#define OXS_CTX_GET_CARRIED_KEY_NAME(ctx, env) \
-        (oxs_ctx_get_carried_key_name(ctx, env) )
-    
-#define OXS_CTX_GET_ENC_MTD_ALGORITHM(ctx, env) \
-        (oxs_ctx_get_enc_mtd_algorithm(ctx, env) )
-    
-#define OXS_CTX_GET_INPUT_DATA(ctx, env) \
-        (oxs_ctx_get_input_data(ctx, env) )
-    
-#define OXS_CTX_SET_MODE(ctx, env, mode) \
-        (oxs_ctx_set_mode(ctx, env, mode) )
-    
-#define OXS_CTX_SET_OPERATION(ctx, env, operation) \
-        (oxs_ctx_set_operation(ctx, env, operation) )
-    
-#define OXS_CTX_SET_KEY(ctx, env, key) \
-        (oxs_ctx_set_key(ctx, env, key) )
-    
-#define OXS_CTX_SET_ID(ctx, env, id) \
-        (oxs_ctx_set_id(ctx, env, id) )
-    
-#define OXS_CTX_SET_TYPE(ctx, env, type) \
-        (oxs_ctx_set_type(ctx, env, type) )
-    
-#define OXS_CTX_SET_MIME_TYPE(ctx, env, mime_type) \
-        (oxs_ctx_set_mime_type(ctx, env, mime_type) )
-    
-#define OXS_CTX_SET_ENCODING(ctx, env, encoding) \
-        (oxs_ctx_set_encoding(ctx, env, encoding) )
-    
-#define OXS_CTX_SET_RECIPIENT(ctx, env, recipient) \
-        ((oxs_ctx_set_recipient(ctx, env, recipient) )
-    
-#define OXS_CTX_SET_CARRIED_KEY_NAME(ctx, env, key_name) \
-        (oxs_ctx_set_carried_key_name(ctx, env, key_name) )
-    
-#define OXS_CTX_SET_ENC_MTD_ALGORITHM(ctx, env, enc_mtd_algorithm) \
-        (oxs_ctx_set_enc_mtd_algorithm(ctx, env, enc_mtd_algorithm) )
-    
-#define OXS_CTX_SET_INPUT_DATA(ctx, env, input_data) \
-        (oxs_ctx_set_input_data(ctx, env, input_data) )
-    
-
-
 /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/axis2/trunk/c/rampart/include/oxs_key.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_key.h?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_key.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_key.h Sun Mar 25 22:31:25 2007
@@ -177,40 +177,7 @@
 AXIS2_EXTERN oxs_key_t *AXIS2_CALL
 oxs_key_create(const axis2_env_t *env);
 
-/*Macros*/
 
-
-#define OXS_KEY_GET_DATA(key,env)\
-    (oxs_key_get_data(key, env))
-
-#define OXS_KEY_GET_NAME(key,env)\
-	(oxs_key_get_name(key, env))
-
-#define OXS_KEY_GET_SIZE(key,env)\
-	(oxs_key_get_size(key, env))
-
-#define OXS_KEY_GET_USAGE(key,env)\
-	(oxs_key_get_usage(key, env))
-
-#define OXS_KEY_SET_NAME(key,env, name)\
-    (oxs_key_set_name(key, env, name))
-
-#define OXS_KEY_SET_USAGE(key,env, usage)\
-    (oxs_key_set_usage(key, env, usage))
-
-#define OXS_KEY_FREE(key,env)\
-    (oxs_key_free(key, env))
-
-#define OXS_KEY_POPULATE(key,env, data, name, size, usage)\
-    (oxs_key_populate(key, env, data, name, size, usage))
-
-#define OXS_KEY_READ_FROM_FILE(key,env, file_name)\
-    (oxs_key_read_from_file(key, env, file_name))
-
-#define OXS_KEY_FOR_ALGO(key,env, key_algo)\
-    (oxs_key_for_algo(key, env, key_algo))
-
-/** @} */
 #ifdef __cplusplus
 }
 #endif

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c Sun Mar 25 22:31:25 2007
@@ -255,7 +255,7 @@
 
     if (asym_ctx->private_key)
     {
-        /*OPENSSL_PKEY_FREE(asym_ctx->private_key, env);*/
+        /*openssl_pkey_free(asym_ctx->private_key, env);*/
         asym_ctx->private_key = NULL;
     }
     asym_ctx->private_key = private_key;

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c Sun Mar 25 22:31:25 2007
@@ -26,9 +26,9 @@
     oxs_buffer_t *out_buf = NULL;
     int  ret, length;
 
-    length =  axis2_base64_decode_len((char*)(OXS_BUFFER_GET_DATA(coded_buf, env)));
-    plain_str = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)(OXS_BUFFER_GET_DATA(coded_buf, env))));
-    ret =  axis2_base64_decode(plain_str, (char*)(OXS_BUFFER_GET_DATA(coded_buf, env)));
+    length =  axis2_base64_decode_len((char*)(oxs_buffer_get_data(coded_buf, env)));
+    plain_str = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)(oxs_buffer_get_data(coded_buf, env))));
+    ret =  axis2_base64_decode(plain_str, (char*)(oxs_buffer_get_data(coded_buf, env)));
     if (ret < 0) return NULL;
     out_buf = oxs_string_to_buffer(env, plain_str);
     return out_buf;

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c Sun Mar 25 22:31:25 2007
@@ -32,7 +32,7 @@
     axis2_status_t ret = AXIS2_SUCCESS;
 
     cprop = openssl_cipher_property_create(env);
-    ret = OPENSSL_CIPHER_PROPERTY_SET_URL(cprop, env , url);
+    ret = openssl_cipher_property_set_url(cprop, env , url);
 
     cipher_name = oxs_get_cipher_name_for_url(env, url);
     if((!cipher_name) || (0 == axis2_strcmp(cipher_name, ""))){
@@ -40,7 +40,7 @@
                         OXS_ERROR_INVALID_DATA, "Cannot populate cipher property");
         return NULL;
     }
-    ret = OPENSSL_CIPHER_PROPERTY_SET_NAME(cprop, env , cipher_name);
+    ret = openssl_cipher_property_set_name(cprop, env , cipher_name);
 
     ret = openssl_populate_cipher_property(env, cprop);
     if (ret == AXIS2_FAILURE)

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c Sun Mar 25 22:31:25 2007
@@ -45,7 +45,7 @@
     axis2_status_t ret = AXIS2_FAILURE;
     
     /*Get cipher property*/
-    cprop =  oxs_get_cipher_property_for_url(env, OXS_CTX_GET_ENC_MTD_ALGORITHM(enc_ctx, env));
+    cprop =  oxs_get_cipher_property_for_url(env, oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env));
     if(!cprop){
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
                 "Cipher property is NULL");
@@ -54,8 +54,8 @@
     /*Get the IV*/
     iv = axis2_strndup((axis2_char_t*)oxs_iv_generate_for_algo(
                 env,
-                OXS_CTX_GET_ENC_MTD_ALGORITHM(enc_ctx, env)),
-            OPENSSL_CIPHER_PROPERTY_GET_IV_SIZE(cprop, env),
+                oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env)),
+            openssl_cipher_property_get_iv_size(cprop, env),
             env);
 
     /*Create the openssl context*/
@@ -68,13 +68,13 @@
     }
 
     /*Set IV*/
-    ret = OPENSSL_CIPHER_CTX_SET_IV(oc_ctx, env, iv);
+    ret = openssl_cipher_ctx_set_iv(oc_ctx, env, iv);
 
     /*Set key*/
-    ret = OPENSSL_CIPHER_CTX_SET_KEY(oc_ctx, env, OXS_CTX_GET_KEY(enc_ctx, env));
+    ret = openssl_cipher_ctx_set_key(oc_ctx, env, oxs_ctx_get_key(enc_ctx, env));
 
     /*Set the cipher*/
-    cipher_name = (axis2_char_t*)OPENSSL_CIPHER_PROPERTY_GET_NAME(cprop, env);
+    cipher_name = (axis2_char_t*)openssl_cipher_property_get_name(cprop, env);
     if (!cipher_name)
     {
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
@@ -82,7 +82,7 @@
 
         return AXIS2_FAILURE;
     }
-    ret = OPENSSL_CIPHER_CTX_SET_CIPHER(oc_ctx,
+    ret = openssl_cipher_ctx_set_cipher(oc_ctx,
             env,
             (EVP_CIPHER*)openssl_get_evp_cipher_by_name(
                 env, (axis2_char_t*)cipher_name)
@@ -90,7 +90,7 @@
     
     /*Now everything is ready for the en/decryption*/ 
     /*ENCRYPTION*/
-    if (OXS_CTX_GET_OPERATION(enc_ctx, env) == OXS_CTX_OPERATION_ENCRYPT)
+    if (oxs_ctx_get_operation(enc_ctx, env) == OXS_CTX_OPERATION_ENCRYPT)
     {
         axis2_char_t *encoded_str = NULL;
         int enclen = -1;
@@ -109,7 +109,7 @@
 
         encodedlen = axis2_base64_encode_len(enclen);
         encoded_str = AXIS2_MALLOC(env->allocator, encodedlen);
-        ret = axis2_base64_encode_binary(encoded_str, OXS_BUFFER_GET_DATA(output, env), enclen);
+        ret = axis2_base64_encode_binary(encoded_str, oxs_buffer_get_data(output, env), enclen);
         if (ret < 0)
         {
             oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
@@ -118,16 +118,16 @@
         }
 
         /*Attach the result to the result buf*/
-        ret = OXS_BUFFER_POPULATE(result, env, (unsigned char*)axis2_strdup(encoded_str, env), encodedlen);
+        ret = oxs_buffer_populate(result, env, (unsigned char*)axis2_strdup(encoded_str, env), encodedlen);
         
         /*Free*/
-        OXS_BUFFER_FREE(output, env);
+        oxs_buffer_free(output, env);
         output = NULL;
         AXIS2_FREE(env->allocator, encoded_str);
         encoded_str = NULL;
 
     /*DECRYPTION*/
-    }else if(OXS_CTX_GET_OPERATION(enc_ctx, env) == OXS_CTX_OPERATION_DECRYPT){
+    }else if(oxs_ctx_get_operation(enc_ctx, env) == OXS_CTX_OPERATION_DECRYPT){
         unsigned char *decoded_data = NULL;/*Can be binary*/
         int decoded_len = -1;
         int enclen = -1;
@@ -136,8 +136,8 @@
         decoded_buf = oxs_buffer_create(env);
 
         /*First we need to base64 decode*/
-        decoded_data = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)OXS_BUFFER_GET_DATA(input, env)));
-        decoded_len = axis2_base64_decode_binary(decoded_data, (char*)OXS_BUFFER_GET_DATA(input, env) );
+        decoded_data = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)oxs_buffer_get_data(input, env)));
+        decoded_len = axis2_base64_decode_binary(decoded_data, (char*)oxs_buffer_get_data(input, env) );
         if (decoded_len < 0)
         {
             oxs_error(env, ERROR_LOCATION, OXS_ERROR_DECRYPT_FAILED,
@@ -145,7 +145,7 @@
             return AXIS2_FAILURE;
         }
         /*Populate decoded (input to the crypto function) buffer*/
-        ret = OXS_BUFFER_POPULATE(decoded_buf, env, decoded_data, decoded_len);
+        ret = oxs_buffer_populate(decoded_buf, env, decoded_data, decoded_len);
         /*Then we decrypt*/
         enclen = openssl_bc_crypt(env, oc_ctx, decoded_buf, result, OPENSSL_DECRYPT);
        
@@ -155,21 +155,21 @@
             return AXIS2_FAILURE;
         }
         /*Free*/
-        OXS_BUFFER_FREE(decoded_buf, env);
+        oxs_buffer_free(decoded_buf, env);
         decoded_buf = NULL;
         AXIS2_FREE(env->allocator, decoded_data);
         decoded_data = NULL;
 
     }else{
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
-                "Invalid operation type %d", OXS_CTX_GET_OPERATION(enc_ctx, env));
+                "Invalid operation type %d", oxs_ctx_get_operation(enc_ctx, env));
         return AXIS2_FAILURE;
     }
  
     /*Free*/
     AXIS2_FREE(env->allocator, iv);
     iv = NULL;
-    OPENSSL_CIPHER_CTX_FREE(oc_ctx, env);
+    openssl_cipher_ctx_free(oc_ctx, env);
     oc_ctx = NULL;
     return AXIS2_SUCCESS;
 }
@@ -182,7 +182,6 @@
     oxs_buffer_t *result)
 {
     openssl_pkey_t *pkey = NULL;
-    openssl_rsa_t *rsa = NULL;
     oxs_asym_ctx_operation_t operation = -1;
     axis2_status_t status = AXIS2_FAILURE;
     axis2_char_t *password = NULL;
@@ -211,7 +210,6 @@
         
     /*Check for the operation and call appropriate method*/
     operation = oxs_asym_ctx_get_operation(ctx, env);
-    rsa = openssl_rsa_create(env);
     if(   OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT == operation ){
         axis2_char_t *encoded_str = NULL;
         oxs_x509_cert_t *x509_cert = NULL;
@@ -226,14 +224,14 @@
 
         /*Encrypt using the public key. Then base64 encode and populate the buffer */
         out_buf = oxs_buffer_create(env);
-        enclen = OPENSSL_RSA_PUB_ENCRYPT(rsa, env, pkey, padding, input, out_buf);
+        enclen = openssl_rsa_pub_encrypt(env, pkey, padding, input, out_buf);
         encodedlen = axis2_base64_encode_len(enclen);
         encoded_str = AXIS2_MALLOC(env->allocator, encodedlen);
-        ret = axis2_base64_encode(encoded_str, (const char *)OXS_BUFFER_GET_DATA(out_buf, env), enclen); 
-        status = OXS_BUFFER_POPULATE(result, env, (unsigned char*)axis2_strdup(encoded_str, env), encodedlen);
+        ret = axis2_base64_encode(encoded_str, (const char *)oxs_buffer_get_data(out_buf, env), enclen); 
+        status = oxs_buffer_populate(result, env, (unsigned char*)axis2_strdup(encoded_str, env), encodedlen);
         
         /*Free*/
-        OXS_BUFFER_FREE(out_buf, env);
+        oxs_buffer_free(out_buf, env);
         out_buf = NULL;
         AXIS2_FREE(env->allocator, encoded_str);
         encoded_str = NULL;
@@ -247,16 +245,16 @@
         /*Operation id PRV DECRYPT; Get the private key from the context*/
         pkey = oxs_asym_ctx_get_private_key(ctx, env);
         /*Base64 decode first. Then do the decryption and populate the buffer*/
-        decoded_encrypted_str = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)OXS_BUFFER_GET_DATA(input, env)));
-        ret = axis2_base64_decode((char*)decoded_encrypted_str, (char*)OXS_BUFFER_GET_DATA(input, env));
+        decoded_encrypted_str = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)oxs_buffer_get_data(input, env)));
+        ret = axis2_base64_decode((char*)decoded_encrypted_str, (char*)oxs_buffer_get_data(input, env));
         dec_enc_buf = oxs_buffer_create(env);
-        OXS_BUFFER_POPULATE(dec_enc_buf, env, decoded_encrypted_str, ret);
-        declen = OPENSSL_RSA_PRV_DECRYPT(rsa, env, pkey, padding,  dec_enc_buf, result);
+        oxs_buffer_populate(dec_enc_buf, env, decoded_encrypted_str, ret);
+        declen = openssl_rsa_prv_decrypt(env, pkey, padding,  dec_enc_buf, result);
    
         /*Free*/
         AXIS2_FREE(env->allocator, decoded_encrypted_str);
         decoded_encrypted_str = NULL;
-        OXS_BUFFER_FREE(dec_enc_buf, env);
+        oxs_buffer_free(dec_enc_buf, env);
         dec_enc_buf = NULL;
 
     }else{
@@ -264,9 +262,6 @@
     }
 
     /*TODO Set certificate information taken from the PEM file */
-    /*Free*/
-    OPENSSL_RSA_FREE(rsa, env);
-    rsa = NULL;
     
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c Sun Mar 25 22:31:25 2007
@@ -38,7 +38,7 @@
                 "openssl_get_cipher_property failed");
         return NULL;
     }
-    size = OPENSSL_CIPHER_PROPERTY_GET_IV_SIZE(cprop, env);
+    size = openssl_cipher_property_get_iv_size(cprop, env);
 
     /*Here we have predefined IVs in the openssl_constants.
       Get the correct one using the size*/

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c Sun Mar 25 22:31:25 2007
@@ -40,7 +40,7 @@
 {    
     AXIS2_ENV_CHECK(env, NULL);    
 
-    return OXS_BUFFER_GET_DATA(key->buf, env);
+    return oxs_buffer_get_data(key->buf, env);
 }
 
 axis2_char_t *AXIS2_CALL
@@ -61,7 +61,7 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     
-    return OXS_BUFFER_GET_SIZE(key->buf, env);
+    return oxs_buffer_get_size(key->buf, env);
 }
 
 int AXIS2_CALL
@@ -142,7 +142,7 @@
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    OXS_BUFFER_FREE(key->buf, env);
+    oxs_buffer_free(key->buf, env);
     key->buf = NULL;
     AXIS2_FREE(env->allocator,  key->name);
     key->name = NULL;
@@ -165,10 +165,10 @@
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    ret = OXS_KEY_SET_NAME(key, env, name);
-    ret = OXS_KEY_SET_USAGE(key, env, usage);
+    ret = oxs_key_set_name(key, env, name);
+    ret = oxs_key_set_usage(key, env, usage);
 
-    ret = OXS_BUFFER_POPULATE(key->buf, env, data, size);
+    ret = oxs_buffer_populate(key->buf, env, data, size);
 
     return AXIS2_SUCCESS;
 }
@@ -183,11 +183,11 @@
     axis2_status_t status = AXIS2_FAILURE;
 
     buf = oxs_buffer_create(env);
-    status = OXS_BUFFER_READ_FILE(buf, env, file_name);
+    status = oxs_buffer_read_file(buf, env, file_name);
 
-    status = OXS_KEY_POPULATE(key, env,
-            OXS_BUFFER_GET_DATA(buf, env), file_name,
-            OXS_BUFFER_GET_SIZE(buf, env), OXS_KEY_USAGE_NONE);
+    status = oxs_key_populate(key, env,
+            oxs_buffer_get_data(buf, env), file_name,
+            oxs_buffer_get_size(buf, env), OXS_KEY_USAGE_NONE);
 
     return status;
 
@@ -213,7 +213,7 @@
         return AXIS2_FAILURE;
     }
 
-    size = OPENSSL_CIPHER_PROPERTY_GET_KEY_SIZE(cprop, env);
+    size = openssl_cipher_property_get_key_size(cprop, env);
 
     key_buf = oxs_buffer_create(env);
     /*The actual key generation happens here*/
@@ -225,12 +225,12 @@
         return AXIS2_FAILURE;
     }
 
-    temp_int = OXS_BUFFER_GET_SIZE(key_buf, env);
-    temp_str = OXS_BUFFER_GET_DATA(key_buf, env);
+    temp_int = oxs_buffer_get_size(key_buf, env);
+    temp_str = oxs_buffer_get_data(key_buf, env);
 
-    ret = OXS_KEY_POPULATE(key, env,
-            OXS_BUFFER_GET_DATA(key_buf, env), NULL,
-            OXS_BUFFER_GET_SIZE(key_buf, env), OXS_KEY_USAGE_NONE);
+    ret = oxs_key_populate(key, env,
+            oxs_buffer_get_data(key_buf, env), NULL,
+            oxs_buffer_get_size(key_buf, env), OXS_KEY_USAGE_NONE);
 
     /* Duplicate key data and free key_buf*/
     return ret;

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c Sun Mar 25 22:31:25 2007
@@ -112,14 +112,14 @@
     /*If the prvkey is available, populate the openssl_pkey*/
     if(prvkey){
         open_prvkey = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(open_prvkey, env, prvkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
+        openssl_pkey_populate(open_prvkey, env, prvkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
         oxs_asym_ctx_set_private_key(ctx, env, open_prvkey);
     }
     /*If the public key is available populate*/
     if(pubkey){
         /*This scenario is not recommonded. This will be executed iff the file is a public key file in PEM format*/
         open_pubkey = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(open_pubkey, env, pubkey, filename, OPENSSL_PKEY_TYPE_PUBLIC_KEY);
+        openssl_pkey_populate(open_pubkey, env, pubkey, filename, OPENSSL_PKEY_TYPE_PUBLIC_KEY);
         oxs_cert = oxs_x509_cert_create(env);
         oxs_x509_cert_set_public_key(oxs_cert, env, open_pubkey);
         oxs_asym_ctx_set_certificate(ctx, env, oxs_cert);
@@ -141,7 +141,7 @@
         /*Additionally we need to set the public key*/
         openssl_x509_get_pubkey(env, cert, &pubkey);
         open_pubkey = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(open_pubkey, env, pubkey, openssl_x509_get_info(env, OPENSSL_X509_INFO_FINGER,cert), OPENSSL_PKEY_TYPE_PUBLIC_KEY); 
+        openssl_pkey_populate(open_pubkey, env, pubkey, openssl_x509_get_info(env, OPENSSL_X509_INFO_FINGER,cert), OPENSSL_PKEY_TYPE_PUBLIC_KEY); 
         /*Set the public key to the x509 certificate*/
         oxs_x509_cert_set_public_key(oxs_cert, env, open_pubkey);
         /*Set the x509 certificate to the asym ctx*/
@@ -173,7 +173,7 @@
     /*Populate*/
     if(prvkey){
         open_prvkey = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(open_prvkey, env, prvkey, NULL, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
+        openssl_pkey_populate(open_prvkey, env, prvkey, NULL, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
     }else{
         return NULL;
     }
@@ -196,7 +196,7 @@
     /*Populate*/
     if(prvkey){
         open_prvkey = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(open_prvkey, env, prvkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
+        openssl_pkey_populate(open_prvkey, env, prvkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
     }else{
         return NULL;
     }
@@ -228,7 +228,7 @@
         /*Additionally we need to set the public key*/
         openssl_x509_get_pubkey(env, cert, &pubkey);
         open_pubkey = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(open_pubkey, env, pubkey, openssl_x509_get_info(env, OPENSSL_X509_INFO_FINGER,cert), OPENSSL_PKEY_TYPE_PUBLIC_KEY);
+        openssl_pkey_populate(open_pubkey, env, pubkey, openssl_x509_get_info(env, OPENSSL_X509_INFO_FINGER,cert), OPENSSL_PKEY_TYPE_PUBLIC_KEY);
         /*Set the public key to the x509 certificate*/
         oxs_x509_cert_set_public_key(oxs_cert, env, open_pubkey);
     }
@@ -282,7 +282,7 @@
     } 
     if(pkey){
         *prv_key = openssl_pkey_create(env);
-        OPENSSL_PKEY_POPULATE(*prv_key, env, pkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
+        openssl_pkey_populate(*prv_key, env, pkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
     }
     
     if(c){

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c Sun Mar 25 22:31:25 2007
@@ -26,128 +26,37 @@
 #include <openssl_util.h>
 
 
-typedef struct openssl_cipher_ctx_impl
+struct openssl_cipher_ctx_t
 {
-    openssl_cipher_ctx_t ctx;
-
     const EVP_CIPHER*   cipher;
     oxs_key_t *key;
     axis2_char_t  *iv;
     axis2_char_t  *pad;
-}
-openssl_cipher_ctx_impl_t;
-
-/** Interface to implementation conversion macro */
-#define AXIS2_INTF_TO_IMPL(openssl_cipher_ctx) ((openssl_cipher_ctx_impl_t *)openssl_cipher_ctx)
-
-/******************* function headers ******************************/
-/* private functions */
-static void
-openssl_cipher_ctx_init_ops(
-    openssl_cipher_ctx_t *ctx);
-
-/*public functions*/
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_ctx_free(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env
-                       );
-
-const EVP_CIPHER* AXIS2_CALL
-openssl_cipher_ctx_get_cipher(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env
-                             );
-
-oxs_key_t *AXIS2_CALL
-openssl_cipher_ctx_get_key(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env
-                          );
-
-axis2_char_t *AXIS2_CALL
-openssl_cipher_ctx_get_iv(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env
-                         );
-
-axis2_char_t *AXIS2_CALL
-openssl_cipher_ctx_get_pad(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env
-                          );
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_ctx_set_cipher(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env,
-        const EVP_CIPHER*
-                             );
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_ctx_set_key(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env,
-        oxs_key_t *key
-                          );
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_ctx_set_iv(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env,
-        axis2_char_t *iv
-                         );
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_ctx_set_pad(openssl_cipher_ctx_t *ctx,
-        const axis2_env_t *env,
-        axis2_char_t *pad
-                          );
-
+};
 
 
 /******************* end of function headers ******************************/
 AXIS2_EXTERN openssl_cipher_ctx_t *AXIS2_CALL
 openssl_cipher_ctx_create(const axis2_env_t *env)
 {
-    openssl_cipher_ctx_impl_t *ctx_impl = NULL;
+    openssl_cipher_ctx_t *ctx = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    ctx_impl = AXIS2_MALLOC(env->allocator, sizeof(openssl_cipher_ctx_impl_t));
-    if (!ctx_impl)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
-
-    ctx_impl->cipher  = NULL;
-    ctx_impl->key  = NULL;
-    ctx_impl->iv  = NULL;
-    ctx_impl->pad  = NULL;
-
-
-
-    ctx_impl->ctx.ops =  AXIS2_MALLOC(env->allocator, sizeof(openssl_cipher_ctx_ops_t));
-    if (!ctx_impl->ctx.ops)
+    ctx = (openssl_cipher_ctx_t *)AXIS2_MALLOC(env->allocator, sizeof(openssl_cipher_ctx_t));
+    if (!ctx)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        openssl_cipher_ctx_free(&(ctx_impl->ctx), env);
         return NULL;
     }
 
-    openssl_cipher_ctx_init_ops(&(ctx_impl->ctx));
+    ctx->cipher  = NULL;
+    ctx->key  = NULL;
+    ctx->iv  = NULL;
+    ctx->pad  = NULL;
 
-    return &(ctx_impl->ctx);
+    return ctx;
 }
 
-/* private functions */
-static void
-openssl_cipher_ctx_init_ops(
-    openssl_cipher_ctx_t *ctx)
-{
-    ctx->ops->free = openssl_cipher_ctx_free ;
-    ctx->ops->get_cipher = openssl_cipher_ctx_get_cipher ;
-    ctx->ops->get_key = openssl_cipher_ctx_get_key ;
-    ctx->ops->get_iv = openssl_cipher_ctx_get_iv ;
-    ctx->ops->get_pad = openssl_cipher_ctx_get_pad ;
-    ctx->ops->set_cipher = openssl_cipher_ctx_set_cipher ;
-    ctx->ops->set_key_value = openssl_cipher_ctx_set_key ;
-    ctx->ops->set_iv = openssl_cipher_ctx_set_iv ;
-    ctx->ops->set_pad = openssl_cipher_ctx_set_pad ;
-}
 
 /* public functions*/
 axis2_status_t AXIS2_CALL
@@ -155,25 +64,22 @@
         const axis2_env_t *env
                        )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
-
-    if (ctx_impl->iv)
+    if (ctx->iv)
     {
-        AXIS2_FREE(env->allocator, ctx_impl->iv);
-        ctx_impl->iv = NULL;
+        AXIS2_FREE(env->allocator, ctx->iv);
+        ctx->iv = NULL;
     }
 
-    if (ctx_impl->pad)
+    if (ctx->pad)
     {
-        AXIS2_FREE(env->allocator, ctx_impl->pad);
-        ctx_impl->pad = NULL;
+        AXIS2_FREE(env->allocator, ctx->pad);
+        ctx->pad = NULL;
     }
 
-    AXIS2_FREE(env->allocator,  ctx_impl);
-    ctx_impl = NULL;
+    AXIS2_FREE(env->allocator,  ctx);
+    ctx = NULL;
 
     return AXIS2_SUCCESS;
 }
@@ -182,11 +88,9 @@
 openssl_cipher_ctx_get_cipher(openssl_cipher_ctx_t *ctx,
         const axis2_env_t *env)
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
 
-    return ctx_impl->cipher ;
+    return ctx->cipher ;
 }
 
 oxs_key_t *AXIS2_CALL
@@ -194,11 +98,9 @@
         const axis2_env_t *env
                           )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
 
-    return ctx_impl->key ;
+    return ctx->key ;
 }
 
 axis2_char_t *AXIS2_CALL
@@ -206,11 +108,9 @@
         const axis2_env_t *env
                          )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
 
-    return ctx_impl->iv ;
+    return ctx->iv ;
 }
 
 axis2_char_t *AXIS2_CALL
@@ -218,11 +118,9 @@
         const axis2_env_t *env
                           )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
 
-    return ctx_impl->pad;
+    return ctx->pad;
 }
 
 axis2_status_t AXIS2_CALL
@@ -231,17 +129,14 @@
         const EVP_CIPHER *cipher
                              )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
-    /*if (ctx_impl->cipher){
-        AXIS2_FREE(env->allocator, ctx_impl->cipher);
-        ctx_impl->cipher = NULL;
+    /*if (ctx->cipher){
+        AXIS2_FREE(env->allocator, ctx->cipher);
+        ctx->cipher = NULL;
     }
     */
-    ctx_impl->cipher = cipher;
+    ctx->cipher = cipher;
 
     return AXIS2_SUCCESS;
 }
@@ -252,17 +147,15 @@
         oxs_key_t *key
                           )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, key, AXIS2_FAILURE);
 
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
-    if (ctx_impl->key)
+    if (ctx->key)
     {
-        OXS_KEY_FREE(ctx_impl->key, env);
-        ctx_impl->key = NULL;
+        oxs_key_free(ctx->key, env);
+        ctx->key = NULL;
     }
-    ctx_impl->key = key ;
+    ctx->key = key ;
 
     return AXIS2_SUCCESS;
 }
@@ -273,17 +166,15 @@
         axis2_char_t *iv
                          )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, iv, AXIS2_FAILURE);
 
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
-    if (ctx_impl->iv)
+    if (ctx->iv)
     {
-        AXIS2_FREE(env->allocator, ctx_impl->iv);
-        ctx_impl->iv = NULL;
+        AXIS2_FREE(env->allocator, ctx->iv);
+        ctx->iv = NULL;
     }
-    ctx_impl->iv = axis2_strdup(iv, env);
+    ctx->iv = axis2_strdup(iv, env);
 
     return AXIS2_SUCCESS;
 }
@@ -295,17 +186,15 @@
         axis2_char_t *pad
                           )
 {
-    openssl_cipher_ctx_impl_t * ctx_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, pad, AXIS2_FAILURE);
 
-    ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
-    if (ctx_impl->pad)
+    if (ctx->pad)
     {
-        AXIS2_FREE(env->allocator, ctx_impl->pad);
-        ctx_impl->pad = NULL;
+        AXIS2_FREE(env->allocator, ctx->pad);
+        ctx->pad = NULL;
     }
-    ctx_impl->pad = axis2_strdup(pad, env);
+    ctx->pad = axis2_strdup(pad, env);
 
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c Sun Mar 25 22:31:25 2007
@@ -24,109 +24,25 @@
 #include <openssl/rand.h>
 
 
-typedef struct openssl_cipher_property_impl
-{
-    openssl_cipher_property_t   cprop;
-
+struct openssl_cipher_property_t
+{    
     EVP_CIPHER                  *cipher;
     axis2_char_t                *name;
     axis2_char_t                *url;
     int                         key_size;
     int                         block_size;
     int                         iv_size;
-}
-openssl_cipher_property_impl_t;
-
-/** Interface to implementation conversion macro */
-#define AXIS2_INTF_TO_IMPL(openssl_cipher_property) ((openssl_cipher_property_impl_t *)openssl_cipher_property)
-
-/*private functions*/
-static void
-openssl_cipher_property_init_ops(
-    openssl_cipher_property_t *cprop);
-
-/*public functions*/
-EVP_CIPHER * AXIS2_CALL
-openssl_cipher_property_get_cipher(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env);
-
-axis2_char_t * AXIS2_CALL
-openssl_cipher_property_get_name(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env);
-
-axis2_char_t * AXIS2_CALL
-openssl_cipher_property_get_url(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env);
-
-int AXIS2_CALL
-openssl_cipher_property_get_key_size(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env);
-
-int AXIS2_CALL
-openssl_cipher_property_get_block_size(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env);
-
-int AXIS2_CALL
-openssl_cipher_property_get_iv_size(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env);
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_set_cipher(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env,
-    EVP_CIPHER *cipher);
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_set_name(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env,
-    axis2_char_t *name);
+};
 
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_set_url(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env,
-    axis2_char_t *name);
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_set_key_size(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env,
-    int   key_size);
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_set_block_size(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env,
-    int  block_size);
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_set_iv_size(
-    const openssl_cipher_property_t *cprop,
-    const axis2_env_t *env,
-    int   iv_size);
-
-axis2_status_t AXIS2_CALL
-openssl_cipher_property_free(openssl_cipher_property_t * cprop, const axis2_env_t *env);
-
-/********* end of function headers ******************/
 
 EVP_CIPHER * AXIS2_CALL
 openssl_cipher_property_get_cipher(
     const openssl_cipher_property_t *cprop,
     const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    return cprop_impl->cipher;
+    return cprop->cipher;
 }
 
 axis2_char_t * AXIS2_CALL
@@ -134,11 +50,9 @@
     const openssl_cipher_property_t *cprop,
     const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    return cprop_impl->name;
+    return cprop->name;
 }
 
 axis2_char_t * AXIS2_CALL
@@ -146,11 +60,9 @@
     const openssl_cipher_property_t *cprop,
     const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    return cprop_impl->url;
+    return cprop->url;
 }
 
 
@@ -159,11 +71,9 @@
     const openssl_cipher_property_t *cprop,
     const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    return cprop_impl->key_size;
+    return cprop->key_size;
 }
 
 int AXIS2_CALL
@@ -171,11 +81,9 @@
     const openssl_cipher_property_t *cprop,
     const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    return cprop_impl->block_size;
+    return cprop->block_size;
 }
 
 int AXIS2_CALL
@@ -183,206 +91,158 @@
     const openssl_cipher_property_t *cprop,
     const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    return cprop_impl->iv_size;
+    return cprop->iv_size;
 }
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_set_cipher(
-    const openssl_cipher_property_t *cprop,
+    openssl_cipher_property_t *cprop,
     const axis2_env_t *env,
     EVP_CIPHER *cipher)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    if (cprop_impl->cipher)
+    if (cprop->cipher)
     {
-        AXIS2_FREE(env->allocator, cprop_impl->cipher);
-        cprop_impl->cipher = NULL;
+        AXIS2_FREE(env->allocator, cprop->cipher);
+        cprop->cipher = NULL;
     }
-    cprop_impl->cipher = cipher;
+    cprop->cipher = cipher;
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_set_name(
-    const openssl_cipher_property_t *cprop,
+    openssl_cipher_property_t *cprop,
     const axis2_env_t *env,
     axis2_char_t *name)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
 
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    if (cprop_impl->name)
+    if (cprop->name)
     {
-        AXIS2_FREE(env->allocator, cprop_impl->name);
-        cprop_impl->name = NULL;
+        AXIS2_FREE(env->allocator, cprop->name);
+        cprop->name = NULL;
     }
-    cprop_impl->name = axis2_strdup(name, env);
+    cprop->name = axis2_strdup(name, env);
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_set_url(
-    const openssl_cipher_property_t *cprop,
+    openssl_cipher_property_t *cprop,
     const axis2_env_t *env,
     axis2_char_t *url)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, url, AXIS2_FAILURE);
 
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    if (cprop_impl->url)
+    if (cprop->url)
     {
-        AXIS2_FREE(env->allocator, cprop_impl->url);
-        cprop_impl->url = NULL;
+        AXIS2_FREE(env->allocator, cprop->url);
+        cprop->url = NULL;
     }
-    cprop_impl->url = axis2_strdup(url, env);
+    cprop->url = axis2_strdup(url, env);
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_set_key_size(
-    const openssl_cipher_property_t *cprop,
+    openssl_cipher_property_t *cprop,
     const axis2_env_t *env,
     int   key_size)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    cprop_impl->key_size = key_size;
+    cprop->key_size = key_size;
     return AXIS2_SUCCESS;
 }
 
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_set_block_size(
-    const openssl_cipher_property_t *cprop,
+    openssl_cipher_property_t *cprop,
     const axis2_env_t *env,
     int  block_size)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    cprop_impl->block_size = block_size;
+    cprop->block_size = block_size;
     return AXIS2_SUCCESS;
 }
 
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_set_iv_size(
-    const openssl_cipher_property_t *cprop,
+    openssl_cipher_property_t *cprop,
     const axis2_env_t *env,
     int   iv_size)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    cprop_impl->iv_size = iv_size;
+    cprop->iv_size = iv_size;
     return AXIS2_SUCCESS;
 }
 
 
 
-static void
-openssl_cipher_property_init_ops(
-    openssl_cipher_property_t *cprop)
-{
-    cprop->ops->get_cipher = openssl_cipher_property_get_cipher ;
-    cprop->ops->get_name = openssl_cipher_property_get_name;
-    cprop->ops->get_url = openssl_cipher_property_get_url;
-    cprop->ops->get_key_size = openssl_cipher_property_get_key_size;
-    cprop->ops->get_block_size = openssl_cipher_property_get_block_size;
-    cprop->ops->get_iv_size = openssl_cipher_property_get_iv_size;
-    cprop->ops->set_cipher = openssl_cipher_property_set_cipher;
-    cprop->ops->set_name = openssl_cipher_property_set_name;
-    cprop->ops->set_url = openssl_cipher_property_set_url;
-    cprop->ops->set_key_size = openssl_cipher_property_set_key_size;
-    cprop->ops->set_block_size = openssl_cipher_property_set_block_size;
-    cprop->ops->set_iv_size = openssl_cipher_property_set_iv_size;
-    cprop->ops->free = openssl_cipher_property_free;
-
-}
-
 AXIS2_EXTERN openssl_cipher_property_t *AXIS2_CALL
 openssl_cipher_property_create(const axis2_env_t *env)
 {
-
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    openssl_cipher_property_t *cprop = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    cprop_impl = AXIS2_MALLOC(env->allocator, sizeof(openssl_cipher_property_impl_t));
-    if (!cprop_impl)
+    cprop = (openssl_cipher_property_t *)AXIS2_MALLOC(env->allocator, sizeof(openssl_cipher_property_t));
+    if (!cprop)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
-    cprop_impl->cipher = NULL;
-    cprop_impl->name = NULL;
-    cprop_impl->url = NULL;
-    cprop_impl->key_size = -1;
-    cprop_impl->block_size = -1;
-    cprop_impl->iv_size = -1;
-
-    cprop_impl->cprop.ops =  AXIS2_MALLOC(env->allocator, sizeof(openssl_cipher_property_ops_t));
-    if (!cprop_impl->cprop.ops)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        openssl_cipher_property_free(&(cprop_impl->cprop), env);
-        return NULL;
-    }
-
-    openssl_cipher_property_init_ops(&(cprop_impl->cprop));
-
-    return &(cprop_impl->cprop);
+    cprop->cipher = NULL;
+    cprop->name = NULL;
+    cprop->url = NULL;
+    cprop->key_size = -1;
+    cprop->block_size = -1;
+    cprop->iv_size = -1;
 
+    return cprop;
 }
 
 
 axis2_status_t AXIS2_CALL
 openssl_cipher_property_free(openssl_cipher_property_t * cprop, const axis2_env_t *env)
 {
-    openssl_cipher_property_impl_t *cprop_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
-    if (cprop_impl->cipher)
+    if (cprop->cipher)
     {
-        AXIS2_FREE(env->allocator, cprop_impl->cipher);
-        cprop_impl->cipher = NULL;
+        AXIS2_FREE(env->allocator, cprop->cipher);
+        cprop->cipher = NULL;
     }
 
-    if (cprop_impl->name)
+    if (cprop->name)
     {
-        AXIS2_FREE(env->allocator, cprop_impl->name);
-        cprop_impl->name = NULL;
+        AXIS2_FREE(env->allocator, cprop->name);
+        cprop->name = NULL;
     }
 
-    if (cprop_impl->url)
+    if (cprop->url)
     {
-        AXIS2_FREE(env->allocator, cprop_impl->url);
-        cprop_impl->url = NULL;
+        AXIS2_FREE(env->allocator, cprop->url);
+        cprop->url = NULL;
     }
 
-    AXIS2_FREE(env->allocator,  cprop_impl);
-    cprop_impl = NULL;
+    AXIS2_FREE(env->allocator,  cprop);
+    cprop = NULL;
 
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c Sun Mar 25 22:31:25 2007
@@ -44,60 +44,60 @@
 
     /********************************Initialize*****************************************************/
 
-    iv_length = EVP_CIPHER_iv_length(OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx, env));
+    iv_length = EVP_CIPHER_iv_length(openssl_cipher_ctx_get_cipher(oc_ctx, env));
 
     /*Get the IV. If encrypt, we need to generate the IV else we need to get it from the input buffer*/
     if(encrypt){
         /*Generate IV*/
         ret = RAND_bytes(iv, iv_length);
         /*IV to the output*/
-        status = OXS_BUFFER_APPEND(output_buf, env, iv, iv_length);
+        status = oxs_buffer_append(output_buf, env, iv, iv_length);
     }else{ /*Decrypt*/
         /*If data is less than the IV its an error*/
-        if(OXS_BUFFER_GET_SIZE(input_buf, env) < iv_length){
+        if(oxs_buffer_get_size(input_buf, env) < iv_length){
             return -1;
         }
         /*Copy IV from the inbuf to our buffer*/
-        memcpy(iv, OXS_BUFFER_GET_DATA(input_buf, env), iv_length);
+        memcpy(iv, oxs_buffer_get_data(input_buf, env), iv_length);
         /*And remove from input*/
-        status = OXS_BUFFER_REMOVE_HEAD (input_buf, env, iv_length);
+        status = oxs_buffer_remove_head (input_buf, env, iv_length);
     }
     /*Get key*/
-    okey = OPENSSL_CIPHER_CTX_GET_KEY(oc_ctx, env);
-    memcpy(key,  OXS_KEY_GET_DATA(okey, env), OXS_KEY_GET_SIZE(okey, env));
+    okey = openssl_cipher_ctx_get_key(oc_ctx, env);
+    memcpy(key,  oxs_key_get_data(okey, env), oxs_key_get_size(okey, env));
 
     /*Set the IV */
-    ret = EVP_CipherInit(&ctx, (EVP_CIPHER *)OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx, env), key, iv, encrypt);
+    ret = EVP_CipherInit(&ctx, (EVP_CIPHER *)openssl_cipher_ctx_get_cipher(oc_ctx, env), key, iv, encrypt);
 #ifndef OXS_OPENSSL_096
     EVP_CIPHER_CTX_set_padding(&ctx, 0);
 #endif
 
     /*Get the block length of the cipher*/
-    block_length = EVP_CIPHER_block_size((EVP_CIPHER *)OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx, env));
+    block_length = EVP_CIPHER_block_size((EVP_CIPHER *)openssl_cipher_ctx_get_cipher(oc_ctx, env));
 
     /*********************************Update***********************************************************/
     for(;;){/*Loop untill all the data are encrypted*/
         unsigned char *out_buf = NULL;
         int  in_size =0, out_size =0, fixed=0, out_length = 0;
 
-        if (0 == OXS_BUFFER_GET_SIZE(input_buf, env)) {
+        if (0 == oxs_buffer_get_size(input_buf, env)) {
             last = 1;            
             break; /*Quit loop if NO DATA!!! */
         }
        
         /*If the amnt of data available is greater than the buffer size, we limit it to buffer size */
-        if(OXS_BUFFER_GET_SIZE(input_buf, env) > BUFSIZE){
+        if(oxs_buffer_get_size(input_buf, env) > BUFSIZE){
             in_size = BUFSIZE;
         }else{
-            in_size = OXS_BUFFER_GET_SIZE(input_buf, env);
+            in_size = oxs_buffer_get_size(input_buf, env);
         }
 
-        out_size = OXS_BUFFER_GET_SIZE(output_buf, env);
+        out_size = oxs_buffer_get_size(output_buf, env);
         
         /*Set the output buffer size*/
-        status = OXS_BUFFER_SET_MAX_SIZE(output_buf, env, out_size + in_size + block_length);
+        status = oxs_buffer_set_max_size(output_buf, env, out_size + in_size + block_length);
 
-        out_buf = OXS_BUFFER_GET_DATA(output_buf, env) + out_size;        /*position to write*/
+        out_buf = oxs_buffer_get_data(output_buf, env) + out_size;        /*position to write*/
         
 #ifndef OXS_OPENSSL_096
         /*If decrypt, we copy the final data to the out_buf of size block_length*/
@@ -112,7 +112,7 @@
         }
 #endif
         /* encrypt or decrypt */
-        ret = EVP_CipherUpdate(&ctx, out_buf, &out_length, OXS_BUFFER_GET_DATA(input_buf, env), in_size);
+        ret = EVP_CipherUpdate(&ctx, out_buf, &out_length, oxs_buffer_get_data(input_buf, env), in_size);
 
 #ifndef OXS_OPENSSL_096   
         /*If decrypt, we copy data from the out_buf to the ctx.final*/
@@ -130,12 +130,12 @@
         }
 #endif
         /* set correct output buffer size */
-        status = OXS_BUFFER_SET_SIZE(output_buf, env, out_size + out_length);    
+        status = oxs_buffer_set_size(output_buf, env, out_size + out_length);    
         if(AXIS2_FAILURE == status){
             return -1;
         }
         /* remove the processed block from input */
-        status = OXS_BUFFER_REMOVE_HEAD(input_buf, env, in_size);
+        status = oxs_buffer_remove_head(input_buf, env, in_size);
         if(AXIS2_FAILURE == status){
             return -1;
         }
@@ -150,9 +150,9 @@
         unsigned char *out_buf = NULL;
         int out_size = 0,  out_length = 0, out_length2 = 0;
         
-        out_size = OXS_BUFFER_GET_SIZE(output_buf, env);
-        status = OXS_BUFFER_SET_MAX_SIZE(output_buf,  env, out_size + 2 * block_length);
-        out_buf = OXS_BUFFER_GET_DATA(output_buf, env)  + out_size;/*position to write*/
+        out_size = oxs_buffer_get_size(output_buf, env);
+        status = oxs_buffer_set_max_size(output_buf,  env, out_size + 2 * block_length);
+        out_buf = oxs_buffer_get_data(output_buf, env)  + out_size;/*position to write*/
 #ifndef OXS_OPENSSL_096
         if(encrypt){
             int pad_length;
@@ -182,7 +182,7 @@
         }
 #endif
         /* set correct output buffer size */
-        status = OXS_BUFFER_SET_SIZE(output_buf, env, out_size + out_length + out_length2);
+        status = oxs_buffer_set_size(output_buf, env, out_size + out_length + out_length2);
         
         EVP_CIPHER_CTX_cleanup(&ctx);
         /*return the length of the outputbuf*/

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkey.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkey.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkey.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkey.c Sun Mar 25 22:31:25 2007
@@ -34,139 +34,33 @@
     int type;
 }
 */
-typedef struct openssl_pkey_impl
+struct openssl_pkey_t
 {
-    openssl_pkey_t pkey;
-
     EVP_PKEY *key;
     axis2_char_t *name;
     int type;
-}
-openssl_pkey_impl_t;
-
-/** Interface to implementation conversion macro */
-#define AXIS2_INTF_TO_IMPL(openssl_pkey) ((openssl_pkey_impl_t *)openssl_pkey)
+};
 
-/******************* function headers ******************************/
-/* private functions */
-static void
-openssl_pkey_init_ops(
-    openssl_pkey_t *pkey);
-
-/* public functions */
-EVP_PKEY *AXIS2_CALL
-openssl_pkey_get_key(
-    const openssl_pkey_t *pkey,
-    const axis2_env_t *env
-);
-axis2_char_t *AXIS2_CALL
-openssl_pkey_get_name(
-    const openssl_pkey_t *pkey,
-    const axis2_env_t *env
-);
-int AXIS2_CALL
-openssl_pkey_get_size(
-    const openssl_pkey_t *pkey,
-    const axis2_env_t *env
-);
-int AXIS2_CALL
-openssl_pkey_get_type(
-    const openssl_pkey_t *pkey,
-    const axis2_env_t *env
-);
-
-
-axis2_status_t AXIS2_CALL
-openssl_pkey_set_key(
-    openssl_pkey_t *pkey,
-    const axis2_env_t *env,
-    EVP_PKEY *key
-);
-
-axis2_status_t AXIS2_CALL
-openssl_pkey_set_name(
-    openssl_pkey_t *pkey,
-    const axis2_env_t *env,
-    axis2_char_t *name
-);
-axis2_status_t AXIS2_CALL
-openssl_pkey_set_type(
-    openssl_pkey_t *pkey,
-    const axis2_env_t *env,
-    int type
-);
-
-axis2_status_t AXIS2_CALL
-openssl_pkey_load(
-    openssl_pkey_t *pkey,
-    const axis2_env_t *env,
-    axis2_char_t *filename,
-    axis2_char_t *password
-);
-
-axis2_status_t AXIS2_CALL
-openssl_pkey_populate(
-    openssl_pkey_t *pkey,
-    const axis2_env_t *env,
-    EVP_PKEY *key,
-    axis2_char_t *name,
-    int type
-);
-
-axis2_status_t AXIS2_CALL
-openssl_pkey_free(
-    openssl_pkey_t *pkey,
-    const axis2_env_t *env
-);
-
-/********************** end of function headers **************/
 
 AXIS2_EXTERN openssl_pkey_t *AXIS2_CALL
 openssl_pkey_create(const axis2_env_t *env)
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
+    openssl_pkey_t * pkey = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    pkey_impl = AXIS2_MALLOC(env->allocator, sizeof(openssl_pkey_impl_t));
-    if (!pkey_impl)
+    pkey = (openssl_pkey_t *)AXIS2_MALLOC(env->allocator, sizeof(openssl_pkey_t));
+    if (!pkey)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
-    pkey_impl->key   = NULL;
-    pkey_impl->name = NULL ;
-    pkey_impl->type = OPENSSL_PKEY_TYPE_UNKNOWN;
-
-    pkey_impl->pkey.ops =  AXIS2_MALLOC(env->allocator, sizeof(openssl_pkey_ops_t));
-    if (!pkey_impl->pkey.ops)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        openssl_pkey_free(&(pkey_impl->pkey), env);
-        return NULL;
-    }
-
-    openssl_pkey_init_ops(&(pkey_impl->pkey));
-
-    return &(pkey_impl->pkey);
+    pkey->key   = NULL;
+    pkey->name = NULL ;
+    pkey->type = OPENSSL_PKEY_TYPE_UNKNOWN;
 
+    return pkey;
 }
 
-static void
-openssl_pkey_init_ops(
-    openssl_pkey_t *pkey)
-{
-    pkey->ops->get_key  = openssl_pkey_get_key;
-    pkey->ops->get_name = openssl_pkey_get_name;
-    pkey->ops->get_size = openssl_pkey_get_size;
-    pkey->ops->get_type = openssl_pkey_get_type;
-    pkey->ops->set_key  = openssl_pkey_set_key;
-    pkey->ops->set_name = openssl_pkey_set_name;
-    pkey->ops->set_type = openssl_pkey_set_type;
-    pkey->ops->populate = openssl_pkey_populate;
-    pkey->ops->load     = openssl_pkey_load;
-    pkey->ops->free     = openssl_pkey_free;
-
-}
 
 EVP_PKEY *AXIS2_CALL
 openssl_pkey_get_key(
@@ -174,11 +68,9 @@
     const axis2_env_t *env
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
-    return pkey_impl->key ;
+    return pkey->key ;
 }
 
 axis2_char_t *AXIS2_CALL
@@ -187,11 +79,9 @@
     const axis2_env_t *env
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, NULL);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
-    return pkey_impl->name ;
+    return pkey->name ;
 
 }
 int AXIS2_CALL
@@ -200,11 +90,9 @@
     const axis2_env_t *env
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
-    return sizeof(pkey_impl->key) ;
+    return sizeof(pkey->key) ;
 }
 int AXIS2_CALL
 openssl_pkey_get_type(
@@ -212,11 +100,9 @@
     const axis2_env_t *env
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
-    return pkey_impl->type ;
+    return pkey->type ;
 }
 
 axis2_status_t AXIS2_CALL
@@ -226,17 +112,15 @@
     EVP_PKEY *key
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
-    if (pkey_impl->key)
+    if (pkey->key)
     {
-        AXIS2_FREE(env->allocator, pkey_impl->key);
-        pkey_impl->key = NULL;
+        AXIS2_FREE(env->allocator, pkey->key);
+        pkey->key = NULL;
     }
 
-    pkey_impl->key = key;
+    pkey->key = key;
 
     return AXIS2_SUCCESS;
 }
@@ -248,17 +132,15 @@
     axis2_char_t *name
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
-    if (pkey_impl->name)
+    if (pkey->name)
     {
-        AXIS2_FREE(env->allocator, pkey_impl->name);
-        pkey_impl->name = NULL;
+        AXIS2_FREE(env->allocator, pkey->name);
+        pkey->name = NULL;
     }
 
-    pkey_impl->name = axis2_strdup(name, env);
+    pkey->name = axis2_strdup(name, env);
 
     return AXIS2_SUCCESS;
 }
@@ -270,12 +152,9 @@
     int type
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
-
-    pkey_impl->type = type;
+    pkey->type = type;
 
     return AXIS2_SUCCESS;
 
@@ -293,11 +172,9 @@
     BIO *bio;
     int type = OPENSSL_PKEY_TYPE_UNKNOWN;
     int ret ;
-    openssl_pkey_impl_t * pkey_impl = NULL;
     axis2_status_t status = AXIS2_FAILURE;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
     bio = BIO_new_file(filename, "rb");
     /*Try to read the prv key first*/
@@ -335,11 +212,9 @@
     int type
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
     axis2_status_t status = AXIS2_FAILURE;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
     status = openssl_pkey_set_key(pkey, env, key);
     status = openssl_pkey_set_name(pkey, env, name);
@@ -354,25 +229,22 @@
     const axis2_env_t *env
 )
 {
-    openssl_pkey_impl_t * pkey_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
 
-    if (pkey_impl->key)
+    if (pkey->key)
     {
-        AXIS2_FREE(env->allocator, pkey_impl->key);
-        pkey_impl->key = NULL;
+        AXIS2_FREE(env->allocator, pkey->key);
+        pkey->key = NULL;
     }
-    if (pkey_impl->name)
+    if (pkey->name)
     {
-        AXIS2_FREE(env->allocator, pkey_impl->name);
-        pkey_impl->name = NULL;
+        AXIS2_FREE(env->allocator, pkey->name);
+        pkey->name = NULL;
     }
 
-    pkey_impl = AXIS2_INTF_TO_IMPL(pkey);
-    AXIS2_FREE(env->allocator, pkey_impl);
-    pkey_impl = NULL;
+    AXIS2_FREE(env->allocator, pkey);
+    pkey = NULL;
 
     return AXIS2_SUCCESS;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org