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 2009/12/15 01:28:46 UTC

svn commit: r890579 - 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: Tue Dec 15 00:28:46 2009
New Revision: 890579

URL: http://svn.apache.org/viewvc?rev=890579&view=rev
Log:
Refactor the apr_crypto.h interface so that the apr_crypto_t structure
remains private. Correctly reference the apr_crypto_t context as a context
and not a factory.

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=890579&r1=890578&r2=890579&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto.c (original)
+++ apr/apr/trunk/crypto/apr_crypto.c Tue Dec 15 00:28:46 2009
@@ -190,15 +190,15 @@
 }
 
 /**
- * @brief Get the result of a previous operation on this context.
- * @param pool - process pool
- * @param params - array of key parameters
- * @param factory - factory pointer will be written here
- */
-APR_DECLARE(apr_status_t) apr_crypto_error(const apr_crypto_t *f,
-        const apu_err_t **result) {
-    *result = f->result;
-    return APR_SUCCESS;
+ * @brief Get the result of the last operation on a context. If the result
+ *        is NULL, the operation was successful.
+ * @param f - context pointer
+ * @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) {
+    return driver->error(f, result);
 }
 
 /**
@@ -206,11 +206,11 @@
  * @param driver - driver to use
  * @param pool - process pool
  * @param params - array of key parameters
- * @param factory - factory pointer will be written here
+ * @param f - context pointer will be written here
  */
-APR_DECLARE(apr_status_t) apr_crypto_factory(const apr_crypto_driver_t *driver,
+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->factory(pool, params, f);
+    return driver->make(pool, params, f);
 }
 
 /**
@@ -257,7 +257,7 @@
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param driver - driver to use
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure to use.
  * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
  *           an IV will be created at random, in space allocated from the pool.
@@ -334,7 +334,7 @@
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param driver - driver to use
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure to use.
  * @param iv Optional initialisation vector.
  * @param ctx The block context returned, see note.
@@ -415,10 +415,10 @@
 }
 
 /**
- * @brief Clean encryption / decryption factory.
- * @note After cleanup, a factory is free to be reused if necessary.
+ * @brief Clean encryption / decryption context.
+ * @note After cleanup, a context is free to be reused if necessary.
  * @param driver - driver to use
- * @param f The factory to use.
+ * @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,

Modified: apr/apr/trunk/crypto/apr_crypto_nss.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_nss.c?rev=890579&r1=890578&r2=890579&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_nss.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_nss.c Tue Dec 15 00:28:46 2009
@@ -46,6 +46,13 @@
 #include <pk11pub.h>
 #endif
 
+struct apr_crypto_t {
+    apr_pool_t *pool;
+    apu_err_t *result;
+    apr_array_header_t *keys;
+    apr_crypto_config_t *config;
+};
+
 struct apr_crypto_config_t {
 };
 
@@ -57,13 +64,20 @@
 };
 
 struct apr_crypto_block_t {
-    const apr_crypto_t *factory;
+    const apr_crypto_t *f;
     apr_pool_t *pool;
     PK11Context *ctx;
     apr_crypto_key_t *key;
     int blockSize;
 };
 
+/**
+ * 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;
+}
 
 /**
  * Shutdown the crypto library and release resources.
@@ -175,10 +189,10 @@
 }
 
 /**
- * @brief Clean encryption / decryption factory.
- * @note After cleanup, a factory is free to be reused if necessary.
+ * @brief Clean encryption / decryption context.
+ * @note After cleanup, a context is free to be reused if necessary.
  * @param driver - driver to use
- * @param f The factory to use.
+ * @param f The context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
 static apr_status_t crypto_cleanup(apr_crypto_t *f)
@@ -209,13 +223,13 @@
  * @param driver - driver to use
  * @param pool - process pool
  * @param params - array of key parameters
- * @param factory - factory pointer will be written here
+ * @param context - context pointer will be written here
  * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
  * if the engine cannot be initialised.
  */
-static apr_status_t crypto_factory(apr_pool_t *pool,
-                                   const apr_array_header_t *params,
-                                   apr_crypto_t **factory)
+static apr_status_t crypto_make(apr_pool_t *pool,
+                                const apr_array_header_t *params,
+                                apr_crypto_t **ff)
 {
     apr_crypto_config_t *config = NULL;
     /* struct apr_crypto_param_t *ents = params ? (struct apr_crypto_param_t *)params->elts : NULL; */
@@ -226,7 +240,7 @@
     if (!f) {
         return APR_ENOMEM;
     }
-    *factory = f;
+    *ff = f;
     f->pool = pool;
     config = f->config = apr_pcalloc(pool, sizeof(apr_crypto_config_t));
     if (!config) {
@@ -249,7 +263,7 @@
         default:
             f->result->rc = -1;
             f->result->reason = "The NSS module currently supports "
-                "no per factory initialisation parameters at this time, but "
+                "no per context initialisation parameters at this time, but "
                 "may do in future.";
             return APR_EINIT;
         }
@@ -412,7 +426,7 @@
  * @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure.
  * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
  *           an IV will be created at random, in space allocated from the pool.
@@ -442,7 +456,7 @@
     if (!block) {
         return APR_ENOMEM;
     }
-    block->factory = f;
+    block->f = f;
     block->pool = p;
 
     apr_pool_cleanup_register(p, block,
@@ -536,8 +550,8 @@
     if (s != SECSuccess) {
         PRErrorCode perr = PORT_GetError();
         if (perr) {
-            block->factory->result->rc = perr;
-            block->factory->result->msg = PR_ErrorToName(perr);
+            block->f->result->rc = perr;
+            block->f->result->msg = PR_ErrorToName(perr);
         }
         return APR_ECRYPT;
     }
@@ -579,8 +593,8 @@
     if (s != SECSuccess) {
         PRErrorCode perr = PORT_GetError();
         if (perr) {
-            block->factory->result->rc = perr;
-            block->factory->result->msg = PR_ErrorToName(perr);
+            block->f->result->rc = perr;
+            block->f->result->msg = PR_ErrorToName(perr);
         }
         rv = APR_ECRYPT;
     }
@@ -595,7 +609,7 @@
  * @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure.
  * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
  *           an IV will be created at random, in space allocated from the pool.
@@ -623,7 +637,7 @@
     if (!block) {
         return APR_ENOMEM;
     }
-    block->factory = f;
+    block->f = f;
     block->pool = p;
 
     apr_pool_cleanup_register(p, block,
@@ -704,8 +718,8 @@
     if (s != SECSuccess) {
         PRErrorCode perr = PORT_GetError();
         if (perr) {
-            block->factory->result->rc = perr;
-            block->factory->result->msg = PR_ErrorToName(perr);
+            block->f->result->rc = perr;
+            block->f->result->msg = PR_ErrorToName(perr);
         }
         return APR_ECRYPT;
     }
@@ -747,8 +761,8 @@
     if (s != SECSuccess) {
         PRErrorCode perr = PORT_GetError();
         if (perr) {
-            block->factory->result->rc = perr;
-            block->factory->result->msg = PR_ErrorToName(perr);
+            block->f->result->rc = perr;
+            block->f->result->msg = PR_ErrorToName(perr);
         }
         rv = APR_ECRYPT;
     }
@@ -764,7 +778,8 @@
 APU_MODULE_DECLARE_DATA const apr_crypto_driver_t apr_crypto_nss_driver = {
     "nss",
     crypto_init,
-    crypto_factory,
+    crypto_error,
+    crypto_make,
     crypto_passphrase,
     crypto_block_encrypt_init,
     crypto_block_encrypt,

Modified: apr/apr/trunk/crypto/apr_crypto_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_openssl.c?rev=890579&r1=890578&r2=890579&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_openssl.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_openssl.c Tue Dec 15 00:28:46 2009
@@ -36,6 +36,13 @@
 
 #define LOG_PREFIX "apr_crypto_openssl: "
 
+struct apr_crypto_t {
+    apr_pool_t *pool;
+    apu_err_t *result;
+    apr_array_header_t *keys;
+    apr_crypto_config_t *config;
+};
+
 struct apr_crypto_config_t {
     ENGINE *engine;
 };
@@ -49,7 +56,7 @@
 };
 
 struct apr_crypto_block_t {
-    const apr_crypto_t *factory;
+    const apr_crypto_t *f;
     apr_pool_t *pool;
     EVP_CIPHER_CTX cipherCtx;
     int initialised;
@@ -59,6 +66,14 @@
 };
 
 /**
+ * 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;
+}
+
+/**
  * Shutdown the crypto library and release resources.
  */
 static apr_status_t crypto_shutdown(apr_pool_t *pool) {
@@ -115,10 +130,10 @@
 }
 
 /**
- * @brief Clean encryption / decryption factory.
- * @note After cleanup, a factory is free to be reused if necessary.
+ * @brief Clean encryption / decryption context.
+ * @note After cleanup, a context is free to be reused if necessary.
  * @param driver - driver to use
- * @param f The factory to use.
+ * @param f The context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
 static apr_status_t crypto_cleanup(apr_crypto_t *f) {
@@ -145,12 +160,12 @@
  * @param driver - driver to use
  * @param pool - process pool
  * @param params - array of key parameters
- * @param factory - factory pointer will be written here
+ * @param context - context pointer will be written here
  * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
  * if the engine cannot be initialised.
  */
-static apr_status_t crypto_factory(apr_pool_t *pool,
-        const apr_array_header_t *params, apr_crypto_t **factory) {
+static apr_status_t crypto_make(apr_pool_t *pool,
+        const apr_array_header_t *params, apr_crypto_t **ff) {
     apr_crypto_config_t *config = NULL;
     struct apr_crypto_param_t *ents =
             params ? (struct apr_crypto_param_t *) params->elts : NULL;
@@ -159,7 +174,7 @@
     if (!f) {
         return APR_ENOMEM;
     }
-    *factory = f;
+    *ff = f;
     f->pool = pool;
     config = f->config = apr_pcalloc(pool, sizeof(apr_crypto_config_t));
     if (!config) {
@@ -318,7 +333,7 @@
  * @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param type 3DES_192, AES_128, AES_192, AES_256.
  * @param mode Electronic Code Book / Cipher Block Chaining.
  * @param key The key
@@ -344,7 +359,7 @@
     if (!block) {
         return APR_ENOMEM;
     }
-    block->factory = f;
+    block->f = f;
     block->pool = p;
 
     apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
@@ -487,7 +502,7 @@
  * @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure.
  * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
  *           an IV will be created at random, in space allocated from the pool.
@@ -510,7 +525,7 @@
     if (!block) {
         return APR_ENOMEM;
     }
-    block->factory = f;
+    block->f = f;
     block->pool = p;
 
     apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
@@ -640,7 +655,7 @@
  * OpenSSL module.
  */
 APU_MODULE_DECLARE_DATA const apr_crypto_driver_t apr_crypto_openssl_driver = {
-        "openssl", crypto_init, crypto_factory, crypto_passphrase,
+        "openssl", crypto_init, crypto_error, crypto_make, crypto_passphrase,
         crypto_block_encrypt_init, crypto_block_encrypt,
         crypto_block_encrypt_finish, crypto_block_decrypt_init,
         crypto_block_decrypt, crypto_block_decrypt_finish,

Modified: apr/apr/trunk/include/apr_crypto.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_crypto.h?rev=890579&r1=890578&r2=890579&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_crypto.h (original)
+++ apr/apr/trunk/include/apr_crypto.h Tue Dec 15 00:28:46 2009
@@ -175,21 +175,12 @@
 
 /* These are opaque structs.  Instantiation is up to each backend */
 typedef struct apr_crypto_driver_t apr_crypto_driver_t;
+typedef struct apr_crypto_t apr_crypto_t;
 typedef struct apr_crypto_config_t apr_crypto_config_t;
 typedef struct apr_crypto_key_t apr_crypto_key_t;
 typedef struct apr_crypto_block_t apr_crypto_block_t;
 
 /**
- * Public factory API, common to all backends.
- */
-typedef struct apr_crypto_t {
-    apr_pool_t *pool;
-    apu_err_t *result;
-    apr_array_header_t *keys;
-    apr_crypto_config_t *config;
-} apr_crypto_t;
-
-/**
  * @brief Perform once-only initialisation. Call once only.
  *
  * @param pool - pool to register any shutdown cleanups, etc
@@ -222,15 +213,14 @@
 APR_DECLARE(const char *) apr_crypto_driver_name(const apr_crypto_driver_t *driver);
 
 /**
- * @brief Get the result of the last operation on a factory. If the result
+ * @brief Get the result of the last operation on a context. If the result
  *        is NULL, the operation was successful.
- * @param driver - driver to use
- * @param factory - factory pointer will be written here
+ * @param f - context pointer
  * @param result - the result structure
  * @return APR_SUCCESS for success
  */
-APR_DECLARE(apr_status_t) apr_crypto_error(const apr_crypto_t *f,
-        const apu_err_t **result);
+APR_DECLARE(apr_status_t) apr_crypto_error(const apr_crypto_driver_t *driver,
+        const apr_crypto_t *f, const apu_err_t **result);
 
 /**
  * @brief Create a context for supporting encryption. Keys, certificates,
@@ -240,11 +230,11 @@
  * @param driver - driver to use
  * @param pool - process pool
  * @param params - array of key parameters
- * @param factory - factory pointer will be written here
+ * @param f - context pointer will be written here
  * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
  * if the engine cannot be initialised.
  */
-APR_DECLARE(apr_status_t) apr_crypto_factory(const apr_crypto_driver_t *driver,
+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);
 
 /**
@@ -288,7 +278,7 @@
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param driver - driver to use
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure to use.
  * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
  *           an IV will be created at random, in space allocated from the pool.
@@ -359,7 +349,7 @@
  *       *ctx is not NULL, *ctx must point at a previously created structure.
  * @param driver - driver to use
  * @param p The pool to use.
- * @param f The block factory to use.
+ * @param f The block context to use.
  * @param key The key structure to use.
  * @param iv Optional initialisation vector.
  * @param ctx The block context returned, see note.
@@ -432,10 +422,10 @@
         const apr_crypto_driver_t *driver, apr_crypto_block_t *ctx);
 
 /**
- * @brief Clean encryption / decryption factory.
- * @note After cleanup, a factory is free to be reused if necessary.
+ * @brief Clean encryption / decryption context.
+ * @note After cleanup, a context is free to be reused if necessary.
  * @param driver - driver to use
- * @param f The factory to use.
+ * @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,

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=890579&r1=890578&r2=890579&view=diff
==============================================================================
--- apr/apr/trunk/include/private/apr_crypto_internal.h (original)
+++ apr/apr/trunk/include/private/apr_crypto_internal.h Tue Dec 15 00:28:46 2009
@@ -41,6 +41,14 @@
     apr_status_t (*init)(apr_pool_t *pool, const apr_array_header_t *params, int *rc);
 
     /**
+     * @brief: fetch the most recent error from this driver.
+     * @param f - context pointer
+     * @param result - the result structure
+     * @return APR_SUCCESS for success.
+     */
+    apr_status_t (*error)(const apr_crypto_t *f, const apu_err_t **result);
+
+    /**
      * @brief Create a context for supporting encryption. Keys, certificates,
      *        algorithms and other parameters will be set per context. More than
      *        one context can be created at one time. A cleanup will be automatically
@@ -52,7 +60,7 @@
      * @return APR_ENOENGINE when the engine specified does not exist. APR_EINITENGINE
      * if the engine cannot be initialised.
      */
-    apr_status_t (*factory)(apr_pool_t *pool, const apr_array_header_t *params,
+    apr_status_t (*make)(apr_pool_t *pool, const apr_array_header_t *params,
             apr_crypto_t **f);
 
     /**
@@ -94,7 +102,7 @@
      * @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
      *       *ctx is not NULL, *ctx must point at a previously created structure.
      * @param p The pool to use.
-     * @param f The block factory to use.
+     * @param f The block context to use.
      * @param key The key structure.
      * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
      *           an IV will be created at random, in space allocated from the pool.
@@ -159,7 +167,7 @@
      * @note If *ctx is NULL, a apr_crypto_block_t will be created from a pool. If
      *       *ctx is not NULL, *ctx must point at a previously created structure.
      * @param p The pool to use.
-     * @param f The block factory to use.
+     * @param f The block context to use.
      * @param key The key structure.
      * @param iv Optional initialisation vector. If the buffer pointed to is NULL,
      *           an IV will be created at random, in space allocated from the pool.
@@ -226,17 +234,17 @@
     apr_status_t (*block_cleanup)(apr_crypto_block_t *ctx);
 
     /**
-     * @brief Clean encryption / decryption factory.
-     * @note After cleanup, a factory is free to be reused if necessary.
+     * @brief Clean encryption / decryption context.
+     * @note After cleanup, a context is free to be reused if necessary.
      * @param driver - driver to use
-     * @param f The factory to use.
+     * @param f The context to use.
      * @return Returns APR_ENOTIMPL if not supported.
      */
     apr_status_t (*cleanup)(apr_crypto_t *f);
 
     /**
-     * @brief Clean encryption / decryption factory.
-     * @note After cleanup, a factory is free to be reused if necessary.
+     * @brief Clean encryption / decryption context.
+     * @note After cleanup, a context is free to be reused if necessary.
      * @param pool The pool to use.
      * @return Returns APR_ENOTIMPL if not supported.
      */

Modified: apr/apr/trunk/test/testcrypto.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testcrypto.c?rev=890579&r1=890578&r2=890579&view=diff
==============================================================================
--- apr/apr/trunk/test/testcrypto.c (original)
+++ apr/apr/trunk/test/testcrypto.c Tue Dec 15 00:28:46 2009
@@ -79,7 +79,7 @@
 
 }
 
-static apr_crypto_t *factory(abts_case *tc, apr_pool_t *pool,
+static apr_crypto_t *make(abts_case *tc, apr_pool_t *pool,
         const apr_crypto_driver_t *driver) {
 
     apr_crypto_t *f = NULL;
@@ -88,9 +88,9 @@
         return NULL;
     }
 
-    /* get the factory */
-    apr_crypto_factory(driver, pool, NULL, &f);
-    ABTS_ASSERT(tc, "apr_crypto_factory returned NULL", f != NULL);
+    /* get the context */
+    apr_crypto_make(driver, pool, NULL, &f);
+    ABTS_ASSERT(tc, "apr_crypto_make returned NULL", f != NULL);
 
     return f;
 
@@ -102,6 +102,7 @@
         int doPad, const char *description) {
 
     apr_crypto_key_t *key = NULL;
+    const apu_err_t *result = NULL;
     const char *pass = "secret";
     const char *salt = "salt";
     apr_status_t rv;
@@ -115,14 +116,19 @@
             (unsigned char *) salt, strlen(salt), type, mode, doPad, 4096,
             &key, NULL);
     if (APR_ENOCIPHER == rv) {
-        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), f->result->rc, f->result->reason ? f->result->reason : "", f->result->msg ? f->result->msg : ""));
+        apr_crypto_error(driver, 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,
+                result->reason ? result->reason : "", result->msg ? result->msg : ""));
         return NULL;
     } else {
         if (APR_SUCCESS != rv) {
+            apr_crypto_error(driver, f, &result);
             fprintf(stderr, "passphrase: %s %s native error %d: %s (%s)\n",
-                    description, apr_crypto_driver_name(driver), f->result->rc,
-                    f->result->reason ? f->result->reason : "",
-                    f->result->msg ? f->result->msg : "");
+                    description, apr_crypto_driver_name(driver), result->rc,
+                    result->reason ? result->reason : "",
+                    result->msg ? result->msg : "");
         }
         ABTS_ASSERT(tc, "apr_crypto_passphrase returned APR_ENOKEY", rv != APR_ENOKEY);
         ABTS_ASSERT(tc, "apr_crypto_passphrase returned APR_EPADDING", rv != APR_EPADDING);
@@ -145,6 +151,7 @@
         apr_size_t *blockSize, const char *description) {
 
     apr_crypto_block_t *block = NULL;
+    const apu_err_t *result = NULL;
     apr_size_t len = 0;
     apr_status_t rv;
 
@@ -159,10 +166,11 @@
         ABTS_NOT_IMPL(tc, "apr_crypto_block_encrypt_init returned APR_ENOTIMPL");
     } else {
         if (APR_SUCCESS != rv) {
+            apr_crypto_error(driver, f, &result);
             fprintf(stderr, "encrypt_init: %s %s native error %d: %s (%s)\n",
-                    description, apr_crypto_driver_name(driver), f->result->rc,
-                    f->result->reason ? f->result->reason : "",
-                    f->result->msg ? f->result->msg : "");
+                    description, apr_crypto_driver_name(driver), result->rc,
+                    result->reason ? result->reason : "",
+                    result->msg ? result->msg : "");
         }
         ABTS_ASSERT(tc, "apr_crypto_block_encrypt_init returned APR_ENOKEY", rv != APR_ENOKEY);
         ABTS_ASSERT(tc, "apr_crypto_block_encrypt_init returned APR_ENOIV", rv != APR_ENOIV);
@@ -179,10 +187,11 @@
     rv = apr_crypto_block_encrypt(driver, block, cipherText,
             cipherTextLen, in, inlen);
     if (APR_SUCCESS != rv) {
+        apr_crypto_error(driver, f, &result);
         fprintf(stderr, "encrypt: %s %s native error %d: %s (%s)\n",
-                description, apr_crypto_driver_name(driver), f->result->rc,
-                f->result->reason ? f->result->reason : "",
-                f->result->msg ? f->result->msg : "");
+                description, apr_crypto_driver_name(driver), result->rc,
+                result->reason ? result->reason : "",
+                result->msg ? result->msg : "");
     }
     ABTS_ASSERT(tc, "apr_crypto_block_encrypt returned APR_ECRYPT", rv != APR_ECRYPT);
     ABTS_ASSERT(tc, "failed to apr_crypto_block_encrypt", rv == APR_SUCCESS);
@@ -195,10 +204,11 @@
     rv = apr_crypto_block_encrypt_finish(driver, block, *cipherText
             + *cipherTextLen, &len);
     if (APR_SUCCESS != rv) {
+        apr_crypto_error(driver, f, &result);
         fprintf(stderr, "encrypt_finish: %s %s native error %d: %s (%s)\n",
-                description, apr_crypto_driver_name(driver), f->result->rc,
-                f->result->reason ? f->result->reason : "",
-                f->result->msg ? f->result->msg : "");
+                description, apr_crypto_driver_name(driver), result->rc,
+                result->reason ? result->reason : "",
+                result->msg ? result->msg : "");
     }
     ABTS_ASSERT(tc, "apr_crypto_block_encrypt_finish returned APR_ECRYPT", rv != APR_ECRYPT);
     ABTS_ASSERT(tc, "apr_crypto_block_encrypt_finish returned APR_EPADDING", rv != APR_EPADDING);
@@ -221,6 +231,7 @@
         apr_size_t *blockSize, const char *description) {
 
     apr_crypto_block_t *block = NULL;
+    const apu_err_t *result = NULL;
     apr_size_t len = 0;
     apr_status_t rv;
 
@@ -235,10 +246,11 @@
         ABTS_NOT_IMPL(tc, "apr_crypto_block_decrypt_init returned APR_ENOTIMPL");
     } else {
         if (APR_SUCCESS != rv) {
+            apr_crypto_error(driver, f, &result);
             fprintf(stderr, "decrypt_init: %s %s native error %d: %s (%s)\n",
-                    description, apr_crypto_driver_name(driver), f->result->rc,
-                    f->result->reason ? f->result->reason : "",
-                    f->result->msg ? f->result->msg : "");
+                    description, apr_crypto_driver_name(driver), result->rc,
+                    result->reason ? result->reason : "",
+                    result->msg ? result->msg : "");
         }
         ABTS_ASSERT(tc, "apr_crypto_block_decrypt_init returned APR_ENOKEY", rv != APR_ENOKEY);
         ABTS_ASSERT(tc, "apr_crypto_block_decrypt_init returned APR_ENOIV", rv != APR_ENOIV);
@@ -255,10 +267,11 @@
     rv = apr_crypto_block_decrypt(driver, block, plainText, plainTextLen,
             cipherText, cipherTextLen);
     if (APR_SUCCESS != rv) {
+        apr_crypto_error(driver, f, &result);
         fprintf(stderr, "decrypt: %s %s native error %d: %s (%s)\n",
-                description, apr_crypto_driver_name(driver), f->result->rc,
-                f->result->reason ? f->result->reason : "",
-                f->result->msg ? f->result->msg : "");
+                description, apr_crypto_driver_name(driver), result->rc,
+                result->reason ? result->reason : "",
+                result->msg ? result->msg : "");
     }
     ABTS_ASSERT(tc, "apr_crypto_block_decrypt returned APR_ECRYPT", rv != APR_ECRYPT);
     ABTS_ASSERT(tc, "failed to apr_crypto_block_decrypt", rv == APR_SUCCESS);
@@ -271,10 +284,11 @@
     rv = apr_crypto_block_decrypt_finish(driver, block, *plainText
             + *plainTextLen, &len);
     if (APR_SUCCESS != rv) {
+        apr_crypto_error(driver, f, &result);
         fprintf(stderr, "decrypt_finish: %s %s native error %d: %s (%s)\n",
-                description, apr_crypto_driver_name(driver), f->result->rc,
-                f->result->reason ? f->result->reason : "",
-                f->result->msg ? f->result->msg : "");
+                description, apr_crypto_driver_name(driver), result->rc,
+                result->reason ? result->reason : "",
+                result->msg ? result->msg : "");
     }
     ABTS_ASSERT(tc, "apr_crypto_block_decrypt_finish returned APR_ECRYPT", rv != APR_ECRYPT);
     ABTS_ASSERT(tc, "apr_crypto_block_decrypt_finish returned APR_EPADDING", rv != APR_EPADDING);
@@ -317,8 +331,8 @@
     const unsigned char *iv = NULL;
     apr_size_t blockSize = 0;
 
-    f1 = factory(tc, pool, driver1);
-    f2 = factory(tc, pool, driver2);
+    f1 = make(tc, pool, driver1);
+    f2 = make(tc, pool, driver2);
     key1 = passphrase(tc, pool, driver1, f1, type, mode, doPad, description);
     key2 = passphrase(tc, pool, driver2, f2, type, mode, doPad, description);