You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by ka...@apache.org on 2007/10/29 13:11:03 UTC
svn commit: r589593 - in /webservices/rampart/trunk/c: include/oxs_key.h
src/omxmlsec/derivation.c src/omxmlsec/key.c
Author: kaushalye
Date: Mon Oct 29 05:11:02 2007
New Revision: 589593
URL: http://svn.apache.org/viewvc?rev=589593&view=rev
Log:
for easy derivation processing
Modified:
webservices/rampart/trunk/c/include/oxs_key.h
webservices/rampart/trunk/c/src/omxmlsec/derivation.c
webservices/rampart/trunk/c/src/omxmlsec/key.c
Modified: webservices/rampart/trunk/c/include/oxs_key.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_key.h?rev=589593&r1=589592&r2=589593&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_key.h (original)
+++ webservices/rampart/trunk/c/include/oxs_key.h Mon Oct 29 05:11:02 2007
@@ -115,18 +115,25 @@
const oxs_key_t *key,
const axutil_env_t *env);
+ /**
+ * Gets the offset of the key.
+ * @param key oxs_key ptr to key
+ * @param env pointer to environment struct
+ * @return offset of the key
+ */
AXIS2_EXTERN int AXIS2_CALL
oxs_key_get_offset(
const oxs_key_t *key,
const axutil_env_t *env);
+
/**
- * Gets the offset of the key.
+ * Gets the length of the key.
* @param key oxs_key ptr to key
* @param env pointer to environment struct
- * @return offset of the key
+ * @return length of the key
*/
AXIS2_EXTERN int AXIS2_CALL
- oxs_key_get_offset(
+ oxs_key_get_length(
const oxs_key_t *key,
const axutil_env_t *env);
@@ -174,6 +181,12 @@
oxs_key_t *key,
const axutil_env_t *env,
int offset);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ oxs_key_set_length(
+ oxs_key_t *key,
+ const axutil_env_t *env,
+ int length);
/**
* Free function for key.
* @param key oxs_key ptr to key
Modified: webservices/rampart/trunk/c/src/omxmlsec/derivation.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/derivation.c?rev=589593&r1=589592&r2=589593&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/derivation.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/derivation.c Mon Oct 29 05:11:02 2007
@@ -135,8 +135,8 @@
axis2_status_t status = AXIS2_FAILURE;
/*TODO check for derivation algorithm*/
- status = openssl_p_sha1(env, secret, label, seed, OPENSSL_DEFAULT_KEY_LEN_FOR_PSHA1,
- OPENSSL_DEFAULT_KEY_OFFSET_FOR_PSHA1, derived_key);
+ status = openssl_p_sha1(env, secret, label, seed, oxs_key_get_length(derived_key, env),
+ oxs_key_get_offset(derived_key, env), derived_key);
return status;
}
Modified: webservices/rampart/trunk/c/src/omxmlsec/key.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/key.c?rev=589593&r1=589592&r2=589593&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/key.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/key.c Mon Oct 29 05:11:02 2007
@@ -33,6 +33,8 @@
axis2_char_t *nonce; /*Specially added for WS-Secure Conversation*/
axis2_char_t *label; /*Specially added for WS-Secure Conversation*/
int offset; /*Specially added for WS-Secure Conversation*/
+ int length; /*Specially added for WS-Secure Conversation. used to pass the derived key length for processing.*/
+ /*size is used when building and length is used when processing*/
};
/******************** end of function headers *****************/
@@ -115,6 +117,16 @@
return key->offset;
}
+AXIS2_EXTERN int AXIS2_CALL
+oxs_key_get_length(
+ const oxs_key_t *key,
+ const axutil_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return key->length;
+}
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
oxs_key_set_name(
@@ -198,6 +210,18 @@
return AXIS2_SUCCESS;
}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_set_length(
+ oxs_key_t *key,
+ const axutil_env_t *env,
+ int length)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ key->length = length;
+ return AXIS2_SUCCESS;
+}
+
AXIS2_EXTERN oxs_key_t *AXIS2_CALL
oxs_key_dup(oxs_key_t *key,
const axutil_env_t *env)
@@ -245,6 +269,7 @@
key->label = NULL;
key->usage = -1;
key->offset = 0;
+ key->length = 0;
/*additionally we need to create a buffer to keep data*/
key->buf = oxs_buffer_create(env);
@@ -265,6 +290,8 @@
key->name = NULL;
AXIS2_FREE(env->allocator, key->nonce);
key->nonce = NULL;
+ AXIS2_FREE(env->allocator, key->label);
+ key->label = NULL;
AXIS2_FREE(env->allocator, key);
key = NULL;