apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r899910 - in /apr/apr/trunk: crypto/apr_crypto.c crypto/apr_crypto_nss.c crypto/apr_crypto_openssl.c include/apr_crypto.h include/apr_general.h include/private/apr_crypto_internal.h test/testcrypto.c
Date Sat, 16 Jan 2010 09:10:05 GMT
Author: minfrin
Date: Sat Jan 16 09:10:05 2010
New Revision: 899910

URL: http://svn.apache.org/viewvc?rev=899910&view=rev
Log:
Add the APR_TYPEDEF_STRUCT macro to provide an implementation of
complete types where only an incomplete type is available. Remove
the driver parameter from the apr_crypto API, the driver is now
wrapped inside the apr_crypto_t.

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/apr_general.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=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto.c (original)
+++ apr/apr/trunk/crypto/apr_crypto.c Sat Jan 16 09:10:05 2010
@@ -39,6 +39,11 @@
 
 #define CLEANUP_CAST (apr_status_t (*)(void*))
 
+APR_TYPEDEF_STRUCT(apr_crypto_t, \
+   apr_pool_t *pool; \
+   apr_crypto_driver_t *provider; \
+)
+
 #if !APR_HAVE_MODULAR_DSO
 #define DRIVER_LOAD(name,driver,pool,params) \
     {   \
@@ -195,9 +200,9 @@
  * @param result - the result structure
  * @return APR_SUCCESS for success
  */
-APR_DECLARE(apr_status_t) apr_crypto_error(const apr_crypto_driver_t *driver,
+APR_DECLARE(apr_status_t) apr_crypto_error(
         const apr_crypto_t *f, const apu_err_t **result) {
-    return driver->error(f, result);
+    return f->provider->error(f, result);
 }
 
 /**
@@ -209,7 +214,7 @@
  */
 APR_DECLARE(apr_status_t) apr_crypto_make(const apr_crypto_driver_t *driver,
         apr_pool_t *pool, const apr_array_header_t *params, apr_crypto_t **f) {
-    return driver->make(pool, params, f);
+    return driver->make(pool, driver, params, f);
 }
 
 /**
@@ -240,13 +245,12 @@
  *         not known. APR_EPADDING if padding was requested but is not supported.
  *         APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_passphrase(const apr_crypto_driver_t *driver,
-        apr_pool_t *p, const apr_crypto_t *f, const char *pass,
-        apr_size_t passLen, const unsigned char * salt, apr_size_t saltLen,
-        const apr_crypto_block_key_type_e type,
+APR_DECLARE(apr_status_t) apr_crypto_passphrase(apr_pool_t *p, const apr_crypto_t *f,
+        const char *pass, apr_size_t passLen, const unsigned char * salt,
+        apr_size_t saltLen, const apr_crypto_block_key_type_e type,
         const apr_crypto_block_key_mode_e mode, const int doPad,
         const int iterations, apr_crypto_key_t **key, apr_size_t *ivSize) {
-    return driver->passphrase(p, f, pass, passLen, salt, saltLen, type, mode,
+    return f->provider->passphrase(p, f, pass, passLen, salt, saltLen, type, mode,
             doPad, iterations, key, ivSize);
 }
 
@@ -268,12 +272,11 @@
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
  *         APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(
-        const apr_crypto_driver_t *driver, apr_pool_t *p,
+APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(apr_pool_t *p,
         const apr_crypto_t *f, const apr_crypto_key_t *key,
         const unsigned char **iv, apr_crypto_block_t **ctx,
         apr_size_t *blockSize) {
-    return driver->block_encrypt_init(p, f, key, iv, ctx, blockSize);
+    return f->provider->block_encrypt_init(p, f, key, iv, ctx, blockSize);
 }
 
 /**
@@ -296,10 +299,10 @@
  *         not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
+        const apr_crypto_t *f, apr_crypto_block_t *ctx,
         unsigned char **out, apr_size_t *outlen, const unsigned char *in,
         apr_size_t inlen) {
-    return driver->block_encrypt(ctx, out, outlen, in, inlen);
+    return f->provider->block_encrypt(ctx, out, outlen, in, inlen);
 }
 
 /**
@@ -322,9 +325,9 @@
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
+        const apr_crypto_t *f, apr_crypto_block_t *ctx,
         unsigned char *out, apr_size_t *outlen) {
-    return driver->block_encrypt_finish(ctx, out, outlen);
+    return f->provider->block_encrypt_finish(ctx, out, outlen);
 }
 
 /**
@@ -342,12 +345,11 @@
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
  *         APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(
-        const apr_crypto_driver_t *driver, apr_pool_t *p,
+APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(apr_pool_t *p,
         const apr_crypto_t *f, const apr_crypto_key_t *key,
         const unsigned char *iv, apr_crypto_block_t **ctx,
         apr_size_t *blockSize) {
-    return driver->block_decrypt_init(p, f, key, iv, ctx, blockSize);
+    return f->provider->block_decrypt_init(p, f, key, iv, ctx, blockSize);
 }
 
 /**
@@ -370,10 +372,10 @@
  *         not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
+        const apr_crypto_t *f, apr_crypto_block_t *ctx,
         unsigned char **out, apr_size_t *outlen, const unsigned char *in,
         apr_size_t inlen) {
-    return driver->block_decrypt(ctx, out, outlen, in, inlen);
+    return f->provider->block_decrypt(ctx, out, outlen, in, inlen);
 }
 
 /**
@@ -396,9 +398,9 @@
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_finish(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
+        const apr_crypto_t *f, apr_crypto_block_t *ctx,
         unsigned char *out, apr_size_t *outlen) {
-    return driver->block_decrypt_finish(ctx, out, outlen);
+    return f->provider->block_decrypt_finish(ctx, out, outlen);
 }
 
 /**
@@ -409,8 +411,8 @@
  * @return Returns APR_ENOTIMPL if not supported.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_cleanup(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx) {
-    return driver->block_cleanup(ctx);
+        const apr_crypto_t *f, apr_crypto_block_t *ctx) {
+    return f->provider->block_cleanup(ctx);
 }
 
 /**
@@ -420,9 +422,8 @@
  * @param f The context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-APR_DECLARE(apr_status_t) apr_crypto_cleanup(const apr_crypto_driver_t *driver,
-        apr_crypto_t *f) {
-    return driver->cleanup(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=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_nss.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_nss.c Sat Jan 16 09:10:05 2010
@@ -47,6 +47,7 @@
 
 struct apr_crypto_t {
     apr_pool_t *pool;
+    const apr_crypto_driver_t *provider;
     apu_err_t *result;
     apr_array_header_t *keys;
     apr_crypto_config_t *config;
@@ -74,8 +75,8 @@
  * Fetch the most recent error from this driver.
  */
 static apr_status_t crypto_error(const apr_crypto_t *f, const apu_err_t **result) {
-	*result = f->result;
-	return APR_SUCCESS;
+    *result = f->result;
+    return APR_SUCCESS;
 }
 
 /**
@@ -226,7 +227,7 @@
  * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
  * if the engine cannot be initialised.
  */
-static apr_status_t crypto_make(apr_pool_t *pool,
+static apr_status_t crypto_make(apr_pool_t *pool, const apr_crypto_driver_t *provider,
                                 const apr_array_header_t *params,
                                 apr_crypto_t **ff)
 {
@@ -241,6 +242,7 @@
     }
     *ff = f;
     f->pool = pool;
+    f->provider = provider;
     config = f->config = apr_pcalloc(pool, sizeof(apr_crypto_config_t));
     if (!config) {
         return APR_ENOMEM;

Modified: apr/apr/trunk/crypto/apr_crypto_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_openssl.c?rev=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_openssl.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_openssl.c Sat Jan 16 09:10:05 2010
@@ -37,6 +37,7 @@
 
 struct apr_crypto_t {
     apr_pool_t *pool;
+    const apr_crypto_driver_t *provider;
     apu_err_t *result;
     apr_array_header_t *keys;
     apr_crypto_config_t *config;
@@ -68,8 +69,8 @@
  * Fetch the most recent error from this driver.
  */
 static apr_status_t crypto_error(const apr_crypto_t *f, const apu_err_t **result) {
-	*result = f->result;
-	return APR_SUCCESS;
+    *result = f->result;
+    return APR_SUCCESS;
 }
 
 /**
@@ -163,7 +164,7 @@
  * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
  * if the engine cannot be initialised.
  */
-static apr_status_t crypto_make(apr_pool_t *pool,
+static apr_status_t crypto_make(apr_pool_t *pool, const apr_crypto_driver_t *provider,
         const apr_array_header_t *params, apr_crypto_t **ff) {
     apr_crypto_config_t *config = NULL;
     struct apr_crypto_param_t *ents =
@@ -175,6 +176,7 @@
     }
     *ff = f;
     f->pool = pool;
+    f->provider = provider;
     config = f->config = apr_pcalloc(pool, sizeof(apr_crypto_config_t));
     if (!config) {
         return APR_ENOMEM;

Modified: apr/apr/trunk/include/apr_crypto.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_crypto.h?rev=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_crypto.h (original)
+++ apr/apr/trunk/include/apr_crypto.h Sat Jan 16 09:10:05 2010
@@ -20,6 +20,7 @@
 #include "apu.h"
 #include "apr_pools.h"
 #include "apr_tables.h"
+#include "apr_dso.h"
 #include "apu_errno.h"
 
 #ifdef __cplusplus
@@ -219,8 +220,8 @@
  * @param result - the result structure
  * @return APR_SUCCESS for success
  */
-APR_DECLARE(apr_status_t) apr_crypto_error(const apr_crypto_driver_t *driver,
-        const apr_crypto_t *f, const apu_err_t **result);
+APR_DECLARE(apr_status_t) apr_crypto_error(const apr_crypto_t *f,
+        const apu_err_t **result);
 
 /**
  * @brief Create a context for supporting encryption. Keys, certificates,
@@ -265,10 +266,9 @@
  *         not known. APR_EPADDING if padding was requested but is not supported.
  *         APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_passphrase(const apr_crypto_driver_t *driver,
-        apr_pool_t *p, const apr_crypto_t *f, const char *pass,
-        apr_size_t passLen, const unsigned char * salt, apr_size_t saltLen,
-        const apr_crypto_block_key_type_e type,
+APR_DECLARE(apr_status_t) apr_crypto_passphrase(apr_pool_t *p, const apr_crypto_t *f,
+        const char *pass, apr_size_t passLen, const unsigned char * salt,
+        apr_size_t saltLen, const apr_crypto_block_key_type_e type,
         const apr_crypto_block_key_mode_e mode, const int doPad,
         const int iterations, apr_crypto_key_t **key, apr_size_t *ivSize);
 
@@ -290,8 +290,7 @@
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
  *         APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(
-        const apr_crypto_driver_t *driver, apr_pool_t *p,
+APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(apr_pool_t *p,
         const apr_crypto_t *f, const apr_crypto_key_t *key,
         const unsigned char **iv, apr_crypto_block_t **ctx,
         apr_size_t *blockSize);
@@ -315,10 +314,9 @@
  * @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
  *         not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_encrypt(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
-        unsigned char **out, apr_size_t *outlen, const unsigned char *in,
-        apr_size_t inlen);
+APR_DECLARE(apr_status_t) apr_crypto_block_encrypt(const apr_crypto_t *f,
+        apr_crypto_block_t *ctx, unsigned char **out, apr_size_t *outlen,
+        const unsigned char *in, apr_size_t inlen);
 
 /**
  * @brief Encrypt final data block, write it to out.
@@ -339,9 +337,8 @@
  *         formatted.
  * @return APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
-        unsigned char *out, apr_size_t *outlen);
+APR_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(const apr_crypto_t *f,
+        apr_crypto_block_t *ctx, unsigned char *out, apr_size_t *outlen);
 
 /**
  * @brief Initialise a context for decrypting arbitrary data using the given key.
@@ -358,8 +355,7 @@
  *         Returns APR_EINIT if the backend failed to initialise the context. Returns
  *         APR_ENOTIMPL if not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(
-        const apr_crypto_driver_t *driver, apr_pool_t *p,
+APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(apr_pool_t *p,
         const apr_crypto_t *f, const apr_crypto_key_t *key,
         const unsigned char *iv, apr_crypto_block_t **ctx,
         apr_size_t *blockSize);
@@ -383,10 +379,9 @@
  * @return APR_ECRYPT if an error occurred. Returns APR_ENOTIMPL if
  *         not implemented.
  */
-APR_DECLARE(apr_status_t) apr_crypto_block_decrypt(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
-        unsigned char **out, apr_size_t *outlen, const unsigned char *in,
-        apr_size_t inlen);
+APR_DECLARE(apr_status_t) apr_crypto_block_decrypt(const apr_crypto_t *f,
+        apr_crypto_block_t *ctx, unsigned char **out, apr_size_t *outlen,
+        const unsigned char *in, apr_size_t inlen);
 
 /**
  * @brief Decrypt final data block, write it to out.
@@ -408,7 +403,7 @@
  * @return APR_ENOTIMPL if not implemented.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_decrypt_finish(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx,
+        const apr_crypto_t *f, apr_crypto_block_t *ctx,
         unsigned char *out, apr_size_t *outlen);
 
 /**
@@ -419,7 +414,7 @@
  * @return Returns APR_ENOTIMPL if not supported.
  */
 APR_DECLARE(apr_status_t) apr_crypto_block_cleanup(
-        const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx);
+        const apr_crypto_t *f, apr_crypto_block_t *ctx);
 
 /**
  * @brief Clean encryption / decryption context.
@@ -428,8 +423,7 @@
  * @param f The context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-APR_DECLARE(apr_status_t) apr_crypto_cleanup(const apr_crypto_driver_t *driver,
-        apr_crypto_t *f);
+APR_DECLARE(apr_status_t) apr_crypto_cleanup(apr_crypto_t *f);
 
 /**
  * @brief Shutdown the crypto library.

Modified: apr/apr/trunk/include/apr_general.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_general.h?rev=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_general.h (original)
+++ apr/apr/trunk/include/apr_general.h Sat Jan 16 09:10:05 2010
@@ -160,6 +160,16 @@
 void *memchr(const void *s, int c, size_t n);
 #endif
 
+/**
+ * Macro to provide a way to turn an incomplete type into a complete
+ * type containing common pointers for a provider.
+ */
+#define APR_TYPEDEF_STRUCT(type, incompletion) \
+struct type { \
+   incompletion \
+   void *unk[]; \
+};
+
 /** @} */
 
 /**

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=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/include/private/apr_crypto_internal.h (original)
+++ apr/apr/trunk/include/private/apr_crypto_internal.h Sat Jan 16 09:10:05 2010
@@ -60,8 +60,8 @@
      * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
      * if the engine cannot be initialised.
      */
-    apr_status_t (*make)(apr_pool_t *pool, const apr_array_header_t *params,
-            apr_crypto_t **f);
+    apr_status_t (*make)(apr_pool_t *pool, const apr_crypto_driver_t *provider,
+            const apr_array_header_t *params, apr_crypto_t **f);
 
     /**
      * @brief Create a key from the given passphrase. By default, the PBKDF2

Modified: apr/apr/trunk/test/testcrypto.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testcrypto.c?rev=899910&r1=899909&r2=899910&view=diff
==============================================================================
--- apr/apr/trunk/test/testcrypto.c (original)
+++ apr/apr/trunk/test/testcrypto.c Sat Jan 16 09:10:05 2010
@@ -107,16 +107,16 @@
     const char *salt = "salt";
     apr_status_t rv;
 
-    if (!driver || !f) {
+    if (!f) {
         return NULL;
     }
 
     /* init the passphrase */
-    rv = apr_crypto_passphrase(driver, pool, f, pass, strlen(pass),
+    rv = apr_crypto_passphrase(pool, f, pass, strlen(pass),
             (unsigned char *) salt, strlen(salt), type, mode, doPad, 4096,
             &key, NULL);
     if (APR_ENOCIPHER == rv) {
-        apr_crypto_error(driver, f, &result);
+        apr_crypto_error(f, &result);
         ABTS_NOT_IMPL(tc, apr_psprintf(pool,
                 "skipped: %s %s passphrase return APR_ENOCIPHER: error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
@@ -124,7 +124,7 @@
         return NULL;
     } else {
         if (APR_SUCCESS != rv) {
-            apr_crypto_error(driver, f, &result);
+            apr_crypto_error(f, &result);
             fprintf(stderr, "passphrase: %s %s native error %d: %s (%s)\n",
                     description, apr_crypto_driver_name(driver), result->rc,
                     result->reason ? result->reason : "",
@@ -160,13 +160,13 @@
     }
 
     /* init the encryption */
-    rv = apr_crypto_block_encrypt_init(driver, pool, f, key, iv, &block,
+    rv = apr_crypto_block_encrypt_init(pool, f, key, iv, &block,
             blockSize);
     if (APR_ENOTIMPL == rv) {
         ABTS_NOT_IMPL(tc, "apr_crypto_block_encrypt_init returned APR_ENOTIMPL");
     } else {
         if (APR_SUCCESS != rv) {
-            apr_crypto_error(driver, f, &result);
+            apr_crypto_error(f, &result);
             fprintf(stderr, "encrypt_init: %s %s native error %d: %s (%s)\n",
                     description, apr_crypto_driver_name(driver), result->rc,
                     result->reason ? result->reason : "",
@@ -184,10 +184,10 @@
     }
 
     /* encrypt the block */
-    rv = apr_crypto_block_encrypt(driver, block, cipherText,
+    rv = apr_crypto_block_encrypt(f, block, cipherText,
             cipherTextLen, in, inlen);
     if (APR_SUCCESS != rv) {
-        apr_crypto_error(driver, f, &result);
+        apr_crypto_error(f, &result);
         fprintf(stderr, "encrypt: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
                 result->reason ? result->reason : "",
@@ -201,10 +201,10 @@
     }
 
     /* finalise the encryption */
-    rv = apr_crypto_block_encrypt_finish(driver, block, *cipherText
+    rv = apr_crypto_block_encrypt_finish(f, block, *cipherText
             + *cipherTextLen, &len);
     if (APR_SUCCESS != rv) {
-        apr_crypto_error(driver, f, &result);
+        apr_crypto_error(f, &result);
         fprintf(stderr, "encrypt_finish: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
                 result->reason ? result->reason : "",
@@ -214,7 +214,7 @@
     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(driver, block);
+    apr_crypto_block_cleanup(f, block);
     if (rv) {
         return NULL;
     }
@@ -240,13 +240,13 @@
     }
 
     /* init the decryption */
-    rv = apr_crypto_block_decrypt_init(driver, pool, f, key, iv, &block,
+    rv = apr_crypto_block_decrypt_init(pool, f, key, iv, &block,
             blockSize);
     if (APR_ENOTIMPL == rv) {
         ABTS_NOT_IMPL(tc, "apr_crypto_block_decrypt_init returned APR_ENOTIMPL");
     } else {
         if (APR_SUCCESS != rv) {
-            apr_crypto_error(driver, f, &result);
+            apr_crypto_error(f, &result);
             fprintf(stderr, "decrypt_init: %s %s native error %d: %s (%s)\n",
                     description, apr_crypto_driver_name(driver), result->rc,
                     result->reason ? result->reason : "",
@@ -264,10 +264,10 @@
     }
 
     /* decrypt the block */
-    rv = apr_crypto_block_decrypt(driver, block, plainText, plainTextLen,
+    rv = apr_crypto_block_decrypt(f, block, plainText, plainTextLen,
             cipherText, cipherTextLen);
     if (APR_SUCCESS != rv) {
-        apr_crypto_error(driver, f, &result);
+        apr_crypto_error(f, &result);
         fprintf(stderr, "decrypt: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
                 result->reason ? result->reason : "",
@@ -281,10 +281,10 @@
     }
 
     /* finalise the decryption */
-    rv = apr_crypto_block_decrypt_finish(driver, block, *plainText
+    rv = apr_crypto_block_decrypt_finish(f, block, *plainText
             + *plainTextLen, &len);
     if (APR_SUCCESS != rv) {
-        apr_crypto_error(driver, f, &result);
+        apr_crypto_error(f, &result);
         fprintf(stderr, "decrypt_finish: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
                 result->reason ? result->reason : "",
@@ -298,7 +298,7 @@
     }
 
     *plainTextLen += len;
-    apr_crypto_block_cleanup(driver, block);
+    apr_crypto_block_cleanup(f, block);
 
     return *plainText;
 



Mime
View raw message