You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2011/05/15 16:07:20 UTC

svn commit: r1103382 - in /apr/apr/trunk: crypto/apr_crypto.c crypto/apr_crypto_nss.c crypto/apr_crypto_openssl.c include/apr_crypto.h include/private/apr_crypto_internal.h test/testcrypto.c

Author: minfrin
Date: Sun May 15 14:07:20 2011
New Revision: 1103382

URL: http://svn.apache.org/viewvc?rev=1103382&view=rev
Log:
Remove the apr_crypto_t context from calls where the apr_crypto_block_t is
passed.

Modified:
    apr/apr/trunk/crypto/apr_crypto.c
    apr/apr/trunk/crypto/apr_crypto_nss.c
    apr/apr/trunk/crypto/apr_crypto_openssl.c
    apr/apr/trunk/include/apr_crypto.h
    apr/apr/trunk/include/private/apr_crypto_internal.h
    apr/apr/trunk/test/testcrypto.c

Modified: apr/apr/trunk/crypto/apr_crypto.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto.c?rev=1103382&r1=1103381&r2=1103382&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto.c (original)
+++ apr/apr/trunk/crypto/apr_crypto.c Sun May 15 14:07:20 2011
@@ -44,6 +44,18 @@ APR_TYPEDEF_STRUCT(apr_crypto_t, \
    apr_crypto_driver_t *provider; \
 )
 
+APR_TYPEDEF_STRUCT(apr_crypto_key_t, \
+   apr_pool_t *pool; \
+   apr_crypto_driver_t *provider; \
+   const apr_crypto_t *f;
+)
+
+APR_TYPEDEF_STRUCT(apr_crypto_block_t, \
+   apr_pool_t *pool; \
+   apr_crypto_driver_t *provider; \
+   const apr_crypto_t *f;
+)
+
 #if !APR_HAVE_MODULAR_DSO
 #define DRIVER_LOAD(name,driver,pool,params) \
     {   \
@@ -272,7 +284,6 @@ APR_DECLARE(apr_status_t) apr_crypto_pas
  *           used.
  * @param key The key structure to use.
  * @param blockSize The block size of the cipher.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -280,10 +291,9 @@ APR_DECLARE(apr_status_t) apr_crypto_pas
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(
         apr_crypto_block_t **ctx, const unsigned char **iv,
-        const apr_crypto_key_t *key, apr_size_t *blockSize,
-        const apr_crypto_t *f, apr_pool_t *p)
+        const apr_crypto_key_t *key, apr_size_t *blockSize, apr_pool_t *p)
 {
-    return f->provider->block_encrypt_init(ctx, iv, key, blockSize, f, p);
+    return key->provider->block_encrypt_init(ctx, iv, key, blockSize, p);
 }
 
 /**
@@ -300,16 +310,15 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param outlen Length of the output will be written here.
  * @param in Address of the buffer to read.
  * @param inlen Length of the buffer to read.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
  *         not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt(unsigned char **out,
         apr_size_t *outlen, const unsigned char *in, apr_size_t inlen,
-        const apr_crypto_t *f, apr_crypto_block_t *ctx)
+        apr_crypto_block_t *ctx)
 {
-    return f->provider->block_encrypt(out, outlen, in, inlen, ctx);
+    return ctx->provider->block_encrypt(out, outlen, in, inlen, ctx);
 }
 
 /**
@@ -324,7 +333,6 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  *            buffer must already exist, and is usually the same
  *            buffer used by apr_evp_crypt(). See note.
  * @param outlen Length of the output will be written here.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred.
  * @return APR_EPADDING if padding was enabled and the block was incorrectly
@@ -332,9 +340,9 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(unsigned char *out,
-        apr_size_t *outlen, const apr_crypto_t *f, apr_crypto_block_t *ctx)
+        apr_size_t *outlen, apr_crypto_block_t *ctx)
 {
-    return f->provider->block_encrypt_finish(out, outlen, ctx);
+    return ctx->provider->block_encrypt_finish(out, outlen, ctx);
 }
 
 /**
@@ -345,7 +353,6 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param blockSize The block size of the cipher.
  * @param iv Optional initialisation vector.
  * @param key The key structure to use.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -353,10 +360,9 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(
         apr_crypto_block_t **ctx, apr_size_t *blockSize,
-        const unsigned char *iv, const apr_crypto_key_t *key,
-        const apr_crypto_t *f, apr_pool_t *p)
+        const unsigned char *iv, const apr_crypto_key_t *key, apr_pool_t *p)
 {
-    return f->provider->block_decrypt_init(ctx, blockSize, iv, key, f, p);
+    return key->provider->block_decrypt_init(ctx, blockSize, iv, key, p);
 }
 
 /**
@@ -373,16 +379,15 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param outlen Length of the output will be written here.
  * @param in Address of the buffer to read.
  * @param inlen Length of the buffer to read.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
  *         not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt(unsigned char **out,
         apr_size_t *outlen, const unsigned char *in, apr_size_t inlen,
-        const apr_crypto_t *f, apr_crypto_block_t *ctx)
+        apr_crypto_block_t *ctx)
 {
-    return f->provider->block_decrypt(out, outlen, in, inlen, ctx);
+    return ctx->provider->block_decrypt(out, outlen, in, inlen, ctx);
 }
 
 /**
@@ -397,7 +402,6 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  *            buffer must already exist, and is usually the same
  *            buffer used by apr_evp_crypt(). See note.
  * @param outlen Length of the output will be written here.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred.
  * @return APR_EPADDING if padding was enabled and the block was incorrectly
@@ -405,21 +409,20 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_finish(unsigned char *out,
-        apr_size_t *outlen, const apr_crypto_t *f, apr_crypto_block_t *ctx)
+        apr_size_t *outlen, apr_crypto_block_t *ctx)
 {
-    return f->provider->block_decrypt_finish(out, outlen, ctx);
+    return ctx->provider->block_decrypt_finish(out, outlen, ctx);
 }
 
 /**
  * @brief Clean encryption / decryption context.
  * @note After cleanup, a context is free to be reused if necessary.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_cleanup(
-        const apr_crypto_t *f, apr_crypto_block_t *ctx) {
-    return f->provider->block_cleanup(ctx);
+APR_DECLARE(apr_status_t) apr_crypto_block_cleanup(apr_crypto_block_t *ctx)
+{
+    return ctx->provider->block_cleanup(ctx);
 }
 
 /**
@@ -428,7 +431,8 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param f The context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-APR_DECLARE(apr_status_t) apr_crypto_cleanup(apr_crypto_t *f) {
+APR_DECLARE(apr_status_t) apr_crypto_cleanup(apr_crypto_t *f)
+{
     return f->provider->cleanup(f);
 }
 

Modified: apr/apr/trunk/crypto/apr_crypto_nss.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_nss.c?rev=1103382&r1=1103381&r2=1103382&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_nss.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_nss.c Sun May 15 14:07:20 2011
@@ -57,6 +57,9 @@ struct apr_crypto_config_t {
 };
 
 struct apr_crypto_key_t {
+    apr_pool_t *pool;
+    const apr_crypto_driver_t *provider;
+    const apr_crypto_t *f;
     CK_MECHANISM_TYPE cipherMech;
     SECOidTag cipherOid;
     PK11SymKey *symKey;
@@ -64,8 +67,9 @@ struct apr_crypto_key_t {
 };
 
 struct apr_crypto_block_t {
-    const apr_crypto_t *f;
     apr_pool_t *pool;
+    const apr_crypto_driver_t *provider;
+    const apr_crypto_t *f;
     PK11Context *ctx;
     apr_crypto_key_t *key;
     int blockSize;
@@ -321,6 +325,9 @@ static apr_status_t crypto_passphrase(ap
         return APR_ENOMEM;
     }
 
+    key->f = f;
+    key->provider = f->provider;
+
     /* decide on what cipher mechanism we will be using */
     switch (type) {
 
@@ -423,7 +430,6 @@ static apr_status_t crypto_passphrase(ap
  *           used.
  * @param key The key structure.
  * @param blockSize The block size of the cipher.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -431,7 +437,7 @@ static apr_status_t crypto_passphrase(ap
  */
 static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx,
         const unsigned char **iv, const apr_crypto_key_t *key,
-        apr_size_t *blockSize, const apr_crypto_t *f, apr_pool_t *p)
+        apr_size_t *blockSize, apr_pool_t *p)
 {
     PRErrorCode perr;
     SECItem * secParam;
@@ -444,8 +450,9 @@ static apr_status_t crypto_block_encrypt
     if (!block) {
         return APR_ENOMEM;
     }
-    block->f = f;
+    block->f = key->f;
     block->pool = p;
+    block->provider = key->provider;
 
     apr_pool_cleanup_register(p, block,
                               crypto_block_cleanup_helper,
@@ -599,7 +606,6 @@ static apr_status_t crypto_block_encrypt
  *           an IV will be created at random, in space allocated from the pool.
  *           If the buffer is not NULL, the IV in the buffer will be used.
  * @param key The key structure.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -607,7 +613,7 @@ static apr_status_t crypto_block_encrypt
  */
 static apr_status_t crypto_block_decrypt_init(apr_crypto_block_t **ctx,
         apr_size_t *blockSize, const unsigned char *iv,
-        const apr_crypto_key_t *key, const apr_crypto_t *f, apr_pool_t *p)
+        const apr_crypto_key_t *key, apr_pool_t *p)
 {
     PRErrorCode perr;
     SECItem * secParam;
@@ -618,8 +624,9 @@ static apr_status_t crypto_block_decrypt
     if (!block) {
         return APR_ENOMEM;
     }
-    block->f = f;
+    block->f = key->f;
     block->pool = p;
+    block->provider = key->provider;
 
     apr_pool_cleanup_register(p, block,
                               crypto_block_cleanup_helper,

Modified: apr/apr/trunk/crypto/apr_crypto_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_openssl.c?rev=1103382&r1=1103381&r2=1103382&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_openssl.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_openssl.c Sun May 15 14:07:20 2011
@@ -48,6 +48,9 @@ struct apr_crypto_config_t {
 };
 
 struct apr_crypto_key_t {
+    apr_pool_t *pool;
+    const apr_crypto_driver_t *provider;
+    const apr_crypto_t *f;
     const EVP_CIPHER * cipher;
     unsigned char *key;
     int keyLen;
@@ -56,8 +59,9 @@ struct apr_crypto_key_t {
 };
 
 struct apr_crypto_block_t {
-    const apr_crypto_t *f;
     apr_pool_t *pool;
+    const apr_crypto_driver_t *provider;
+    const apr_crypto_t *f;
     EVP_CIPHER_CTX cipherCtx;
     int initialised;
     int ivSize;
@@ -252,6 +256,9 @@ static apr_status_t crypto_passphrase(ap
         return APR_ENOMEM;
     }
 
+    key->f = f;
+    key->provider = f->provider;
+
     /* determine the cipher to be used */
     switch (type) {
 
@@ -340,7 +347,6 @@ static apr_status_t crypto_passphrase(ap
  *           used.
  * @param key The key structure.
  * @param blockSize The block size of the cipher.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -348,10 +354,10 @@ static apr_status_t crypto_passphrase(ap
  */
 static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx,
         const unsigned char **iv, const apr_crypto_key_t *key,
-        apr_size_t *blockSize, const apr_crypto_t *f, apr_pool_t *p)
+        apr_size_t *blockSize, apr_pool_t *p)
 {
     unsigned char *usedIv;
-    apr_crypto_config_t *config = f->config;
+    apr_crypto_config_t *config = key->f->config;
     apr_crypto_block_t *block = *ctx;
     if (!block) {
         *ctx = block = apr_pcalloc(p, sizeof(apr_crypto_block_t));
@@ -359,8 +365,9 @@ static apr_status_t crypto_block_encrypt
     if (!block) {
         return APR_ENOMEM;
     }
-    block->f = f;
+    block->f = key->f;
     block->pool = p;
+    block->provider = key->provider;
 
     apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
             apr_pool_cleanup_null);
@@ -509,7 +516,6 @@ static apr_status_t crypto_block_encrypt
  *           an IV will be created at random, in space allocated from the pool.
  *           If the buffer is not NULL, the IV in the buffer will be used.
  * @param key The key structure.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -517,9 +523,9 @@ static apr_status_t crypto_block_encrypt
  */
 static apr_status_t crypto_block_decrypt_init(apr_crypto_block_t **ctx,
         apr_size_t *blockSize, const unsigned char *iv,
-        const apr_crypto_key_t *key, const apr_crypto_t *f, apr_pool_t *p)
+        const apr_crypto_key_t *key, apr_pool_t *p)
 {
-    apr_crypto_config_t *config = f->config;
+    apr_crypto_config_t *config = key->f->config;
     apr_crypto_block_t *block = *ctx;
     if (!block) {
         *ctx = block = apr_pcalloc(p, sizeof(apr_crypto_block_t));
@@ -527,8 +533,9 @@ static apr_status_t crypto_block_decrypt
     if (!block) {
         return APR_ENOMEM;
     }
-    block->f = f;
+    block->f = key->f;
     block->pool = p;
+    block->provider = key->provider;
 
     apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
             apr_pool_cleanup_null);

Modified: apr/apr/trunk/include/apr_crypto.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_crypto.h?rev=1103382&r1=1103381&r2=1103382&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_crypto.h (original)
+++ apr/apr/trunk/include/apr_crypto.h Sun May 15 14:07:20 2011
@@ -287,7 +287,6 @@ APR_DECLARE(apr_status_t) apr_crypto_pas
  *           used.
  * @param key The key structure to use.
  * @param blockSize The block size of the cipher.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -295,8 +294,7 @@ APR_DECLARE(apr_status_t) apr_crypto_pas
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(
         apr_crypto_block_t **ctx, const unsigned char **iv,
-        const apr_crypto_key_t *key, apr_size_t *blockSize,
-        const apr_crypto_t *f, apr_pool_t *p);
+        const apr_crypto_key_t *key, apr_size_t *blockSize, apr_pool_t *p);
 
 /**
  * @brief Encrypt data provided by in, write it to out.
@@ -312,14 +310,13 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param outlen Length of the output will be written here.
  * @param in Address of the buffer to read.
  * @param inlen Length of the buffer to read.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
  *         not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt(unsigned char **out,
         apr_size_t *outlen, const unsigned char *in, apr_size_t inlen,
-        const apr_crypto_t *f, apr_crypto_block_t *ctx);
+        apr_crypto_block_t *ctx);
 
 /**
  * @brief Encrypt final data block, write it to out.
@@ -333,7 +330,6 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  *            buffer must already exist, and is usually the same
  *            buffer used by apr_evp_crypt(). See note.
  * @param outlen Length of the output will be written here.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred.
  * @return APR_EPADDING if padding was enabled and the block was incorrectly
@@ -341,7 +337,7 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(unsigned char *out,
-        apr_size_t *outlen, const apr_crypto_t *f, apr_crypto_block_t *ctx);
+        apr_size_t *outlen, apr_crypto_block_t *ctx);
 
 /**
  * @brief Initialise a context for decrypting arbitrary data using the given key.
@@ -351,7 +347,6 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param blockSize The block size of the cipher.
  * @param iv Optional initialisation vector.
  * @param key The key structure to use.
- * @param f The block context to use.
  * @param p The pool to use.
  * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -359,8 +354,7 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(
         apr_crypto_block_t **ctx, apr_size_t *blockSize,
-        const unsigned char *iv, const apr_crypto_key_t *key,
-        const apr_crypto_t *f, apr_pool_t *p);
+        const unsigned char *iv, const apr_crypto_key_t *key, apr_pool_t *p);
 
 /**
  * @brief Decrypt data provided by in, write it to out.
@@ -376,14 +370,13 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @param outlen Length of the output will be written here.
  * @param in Address of the buffer to read.
  * @param inlen Length of the buffer to read.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
  *         not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt(unsigned char **out,
         apr_size_t *outlen, const unsigned char *in, apr_size_t inlen,
-        const apr_crypto_t *f, apr_crypto_block_t *ctx);
+        apr_crypto_block_t *ctx);
 
 /**
  * @brief Decrypt final data block, write it to out.
@@ -397,7 +390,6 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  *            buffer must already exist, and is usually the same
  *            buffer used by apr_evp_crypt(). See note.
  * @param outlen Length of the output will be written here.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return APR_ECRYPT if an error occurred.
  * @return APR_EPADDING if padding was enabled and the block was incorrectly
@@ -405,17 +397,15 @@ APR_DECLARE(apr_status_t) apr_crypto_blo
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_finish(unsigned char *out,
-        apr_size_t *outlen, const apr_crypto_t *f, apr_crypto_block_t *ctx);
+        apr_size_t *outlen, apr_crypto_block_t *ctx);
 
 /**
  * @brief Clean encryption / decryption context.
  * @note After cleanup, a context is free to be reused if necessary.
- * @param f The block context to use.
  * @param ctx The block context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_cleanup(
-        const apr_crypto_t *f, apr_crypto_block_t *ctx);
+APR_DECLARE(apr_status_t) apr_crypto_block_cleanup(apr_crypto_block_t *ctx);
 
 /**
  * @brief Clean encryption / decryption context.

Modified: apr/apr/trunk/include/private/apr_crypto_internal.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/private/apr_crypto_internal.h?rev=1103382&r1=1103381&r2=1103382&view=diff
==============================================================================
--- apr/apr/trunk/include/private/apr_crypto_internal.h (original)
+++ apr/apr/trunk/include/private/apr_crypto_internal.h Sun May 15 14:07:20 2011
@@ -101,7 +101,6 @@ struct apr_crypto_driver_t {
      *           used.
      * @param key The key structure.
      * @param blockSize The block size of the cipher.
-     * @param f The block context to use.
      * @param p The pool to use.
      * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
      *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -109,7 +108,7 @@ struct apr_crypto_driver_t {
      */
     apr_status_t (*block_encrypt_init)(apr_crypto_block_t **ctx,
             const unsigned char **iv, const apr_crypto_key_t *key,
-            apr_size_t *blockSize, const apr_crypto_t *f, apr_pool_t *p);
+            apr_size_t *blockSize, apr_pool_t *p);
 
     /**
      * @brief Encrypt data provided by in, write it to out.
@@ -163,7 +162,6 @@ struct apr_crypto_driver_t {
      *           an IV will be created at random, in space allocated from the pool.
      *           If the buffer is not NULL, the IV in the buffer will be used.
      * @param key The key structure.
-     * @param f The block context to use.
      * @param p The pool to use.
      * @return Returns APR_ENOIV if an initialisation vector is required but not specified.
      *         Returns APR_EINIT if the backend failed to initialise the context. Returns
@@ -171,7 +169,7 @@ struct apr_crypto_driver_t {
      */
     apr_status_t (*block_decrypt_init)(apr_crypto_block_t **ctx,
             apr_size_t *blockSize, const unsigned char *iv,
-            const apr_crypto_key_t *key, const apr_crypto_t *f, apr_pool_t *p);
+            const apr_crypto_key_t *key, apr_pool_t *p);
 
     /**
      * @brief Decrypt data provided by in, write it to out.

Modified: apr/apr/trunk/test/testcrypto.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testcrypto.c?rev=1103382&r1=1103381&r2=1103382&view=diff
==============================================================================
--- apr/apr/trunk/test/testcrypto.c (original)
+++ apr/apr/trunk/test/testcrypto.c Sun May 15 14:07:20 2011
@@ -160,7 +160,7 @@ static unsigned char *encrypt_block(abts
     }
 
     /* init the encryption */
-    rv = apr_crypto_block_encrypt_init(&block, iv, key, blockSize, f, pool);
+    rv = apr_crypto_block_encrypt_init(&block, iv, key, blockSize, pool);
     if (APR_ENOTIMPL == rv) {
         ABTS_NOT_IMPL(tc, "apr_crypto_block_encrypt_init returned APR_ENOTIMPL");
     } else {
@@ -183,8 +183,7 @@ static unsigned char *encrypt_block(abts
     }
 
     /* encrypt the block */
-    rv = apr_crypto_block_encrypt(cipherText, cipherTextLen, in, inlen, f,
-            block);
+    rv = apr_crypto_block_encrypt(cipherText, cipherTextLen, in, inlen, block);
     if (APR_SUCCESS != rv) {
         apr_crypto_error(&result, f);
         fprintf(stderr, "encrypt: %s %s native error %d: %s (%s)\n",
@@ -200,8 +199,7 @@ static unsigned char *encrypt_block(abts
     }
 
     /* finalise the encryption */
-    rv = apr_crypto_block_encrypt_finish(*cipherText + *cipherTextLen, &len, f,
-            block);
+    rv = apr_crypto_block_encrypt_finish(*cipherText + *cipherTextLen, &len, block);
     if (APR_SUCCESS != rv) {
         apr_crypto_error(&result, f);
         fprintf(stderr, "encrypt_finish: %s %s native error %d: %s (%s)\n",
@@ -213,7 +211,7 @@ static unsigned char *encrypt_block(abts
     ABTS_ASSERT(tc, "apr_crypto_block_encrypt_finish returned APR_EPADDING", rv != APR_EPADDING);
     ABTS_ASSERT(tc, "failed to apr_crypto_block_encrypt_finish", rv == APR_SUCCESS);
     *cipherTextLen += len;
-    apr_crypto_block_cleanup(f, block);
+    apr_crypto_block_cleanup(block);
     if (rv) {
         return NULL;
     }
@@ -239,7 +237,7 @@ static unsigned char *decrypt_block(abts
     }
 
     /* init the decryption */
-    rv = apr_crypto_block_decrypt_init(&block, blockSize, iv, key, f, pool);
+    rv = apr_crypto_block_decrypt_init(&block, blockSize, iv, key, pool);
     if (APR_ENOTIMPL == rv) {
         ABTS_NOT_IMPL(tc, "apr_crypto_block_decrypt_init returned APR_ENOTIMPL");
     } else {
@@ -262,8 +260,8 @@ static unsigned char *decrypt_block(abts
     }
 
     /* decrypt the block */
-    rv = apr_crypto_block_decrypt(plainText, plainTextLen,
-            cipherText, cipherTextLen, f, block);
+    rv = apr_crypto_block_decrypt(plainText, plainTextLen, cipherText,
+            cipherTextLen, block);
     if (APR_SUCCESS != rv) {
         apr_crypto_error(&result, f);
         fprintf(stderr, "decrypt: %s %s native error %d: %s (%s)\n",
@@ -279,7 +277,7 @@ static unsigned char *decrypt_block(abts
     }
 
     /* finalise the decryption */
-    rv = apr_crypto_block_decrypt_finish(*plainText + *plainTextLen, &len, f,
+    rv = apr_crypto_block_decrypt_finish(*plainText + *plainTextLen, &len,
             block);
     if (APR_SUCCESS != rv) {
         apr_crypto_error(&result, f);
@@ -296,7 +294,7 @@ static unsigned char *decrypt_block(abts
     }
 
     *plainTextLen += len;
-    apr_crypto_block_cleanup(f, block);
+    apr_crypto_block_cleanup(block);
 
     return *plainText;