apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1187940 - in /apr/apr-util/branches/1.5.x: 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
Date Sun, 23 Oct 2011 17:45:41 GMT
Author: minfrin
Date: Sun Oct 23 17:45:41 2011
New Revision: 1187940

URL: http://svn.apache.org/viewvc?rev=1187940&view=rev
Log:
Formatting, no functional change.

Modified:
    apr/apr-util/branches/1.5.x/crypto/apr_crypto.c
    apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c
    apr/apr-util/branches/1.5.x/crypto/apr_crypto_openssl.c
    apr/apr-util/branches/1.5.x/include/apr_crypto.h
    apr/apr-util/branches/1.5.x/include/private/apr_crypto_internal.h
    apr/apr-util/branches/1.5.x/test/testcrypto.c

Modified: apr/apr-util/branches/1.5.x/crypto/apr_crypto.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/crypto/apr_crypto.c?rev=1187940&r1=1187939&r2=1187940&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/crypto/apr_crypto.c (original)
+++ apr/apr-util/branches/1.5.x/crypto/apr_crypto.c Sun Oct 23 17:45:41 2011
@@ -45,21 +45,21 @@ struct type { \
    void *unk[]; \
 };
 
-APR_TYPEDEF_STRUCT(apr_crypto_t, \
-   apr_pool_t *pool; \
-   apr_crypto_driver_t *provider; \
+APR_TYPEDEF_STRUCT(apr_crypto_t,
+    apr_pool_t *pool;
+    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_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;
+APR_TYPEDEF_STRUCT(apr_crypto_block_t,
+    apr_pool_t *pool;
+    apr_crypto_driver_t *provider;
+    const apr_crypto_t *f;
 )
 
 #if !APU_DSO_BUILD
@@ -73,7 +73,8 @@ APR_TYPEDEF_STRUCT(apr_crypto_block_t, \
     }
 #endif
 
-static apr_status_t apr_crypto_term(void *ptr) {
+static apr_status_t apr_crypto_term(void *ptr)
+{
     /* set drivers to NULL so init can work again */
     drivers = NULL;
 
@@ -83,7 +84,8 @@ static apr_status_t apr_crypto_term(void
     return APR_SUCCESS;
 }
 
-APU_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool) {
+APU_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool)
+{
     apr_status_t ret = APR_SUCCESS;
     apr_pool_t *parent;
 
@@ -124,7 +126,8 @@ APU_DECLARE(apr_status_t) apr_crypto_ini
 
 APU_DECLARE(apr_status_t) apr_crypto_get_driver(
         const apr_crypto_driver_t **driver, const char *name,
-        const char *params, const apu_err_t **result, apr_pool_t *pool) {
+        const char *params, const apu_err_t **result, apr_pool_t *pool)
+{
 #if APU_DSO_BUILD
     char modname[32];
     char symname[34];
@@ -159,7 +162,8 @@ APU_DECLARE(apr_status_t) apr_crypto_get
     apr_snprintf(modname, sizeof(modname),
             "apr_crypto_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".dll", name);
 #else
-    apr_snprintf(modname, sizeof(modname), "apr_crypto_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".so", name);
+    apr_snprintf(modname, sizeof(modname),
+            "apr_crypto_%s-" APU_STRINGIFY(APU_MAJOR_VERSION) ".so", name);
 #endif
     apr_snprintf(symname, sizeof(symname), "apr_crypto_%s_driver", name);
     rv = apu_dso_load(&dso, &symbol, modname, symname, pool);
@@ -205,7 +209,8 @@ APU_DECLARE(apr_status_t) apr_crypto_get
  * @param driver - The driver in use.
  * @return The name of the driver.
  */
-APU_DECLARE(const char *)apr_crypto_driver_name (const apr_crypto_driver_t *driver)
+APU_DECLARE(const char *)apr_crypto_driver_name (
+        const apr_crypto_driver_t *driver)
 {
     return driver->name;
 }
@@ -218,7 +223,8 @@ APU_DECLARE(const char *)apr_crypto_driv
  * @return APR_SUCCESS for success
  */
 APU_DECLARE(apr_status_t) apr_crypto_error(const apu_err_t **result,
-        const apr_crypto_t *f) {
+        const apr_crypto_t *f)
+{
     return f->provider->error(result, f);
 }
 
@@ -237,8 +243,9 @@ APU_DECLARE(apr_status_t) apr_crypto_err
  * @remarks OpenSSL: the params can have "engine" as a key, followed by an equal
  *  sign and a value.
  */
-APU_DECLARE(apr_status_t) apr_crypto_make(apr_crypto_t **f, const apr_crypto_driver_t *driver,
-        const char *params, apr_pool_t *pool) {
+APU_DECLARE(apr_status_t) apr_crypto_make(apr_crypto_t **f,
+        const apr_crypto_driver_t *driver, const char *params, apr_pool_t *pool)
+{
     return driver->make(f, driver, params, pool);
 }
 
@@ -250,7 +257,7 @@ APU_DECLARE(apr_status_t) apr_crypto_mak
  * @param f - encryption context
  * @return APR_SUCCESS for success
  */
-APR_DECLARE(apr_status_t) apr_crypto_get_block_key_types(apr_hash_t **types,
+APU_DECLARE(apr_status_t) apr_crypto_get_block_key_types(apr_hash_t **types,
         const apr_crypto_t *f)
 {
     return f->provider->get_block_key_types(types, f);
@@ -264,7 +271,7 @@ APR_DECLARE(apr_status_t) apr_crypto_get
  * @param f - encryption context
  * @return APR_SUCCESS for success
  */
-APR_DECLARE(apr_status_t) apr_crypto_get_block_key_modes(apr_hash_t **modes,
+APU_DECLARE(apr_status_t) apr_crypto_get_block_key_modes(apr_hash_t **modes,
         const apr_crypto_t *f)
 {
     return f->provider->get_block_key_modes(modes, f);

Modified: apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c?rev=1187940&r1=1187939&r2=1187940&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c (original)
+++ apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c Sun Oct 23 17:45:41 2011
@@ -88,7 +88,9 @@ static int mode_cbc = APR_MODE_CBC;
 /**
  * Fetch the most recent error from this driver.
  */
-static apr_status_t crypto_error(const apu_err_t **result, const apr_crypto_t *f) {
+static apr_status_t crypto_error(const apu_err_t **result,
+        const apr_crypto_t *f)
+{
     *result = f->result;
     return APR_SUCCESS;
 }
@@ -131,11 +133,11 @@ static apr_status_t crypto_init(apr_pool
         const char *field;
         char *value;
     } fields[] = {
-        {"dir", NULL},
-        {"key3", NULL},
-        {"cert7", NULL},
-        {"secmod", NULL},
-        {NULL, NULL}
+        { "dir", NULL },
+        { "key3", NULL },
+        { "cert7", NULL },
+        { "secmod", NULL },
+        { NULL, NULL }
     };
     int i;
     const char *ptr;
@@ -143,7 +145,7 @@ static apr_status_t crypto_init(apr_pool
     size_t klen;
     const char *value;
     size_t vlen;
-    static const char *const delims = " \r\n\t;|,";
+    static const char * const delims = " \r\n\t;|,";
 
     /* sanity check - we can only initialise NSS once */
     if (NSS_IsInitialized()) {
@@ -157,7 +159,7 @@ static apr_status_t crypto_init(apr_pool
             ++ptr;
             continue;
         }
-        for (key = ptr-1; apr_isspace(*key); --key);
+        for (key = ptr - 1; apr_isspace(*key); --key);
         klen = 0;
         while (apr_isalpha(*key)) {
             if (key == params) {
@@ -170,24 +172,23 @@ static apr_status_t crypto_init(apr_pool
             ++klen;
         }
         ++key;
-        for (value = ptr+1; apr_isspace(*value); ++value);
+        for (value = ptr + 1; apr_isspace(*value); ++value);
         vlen = strcspn(value, delims);
-        for (i=0; fields[i].field != NULL; ++i) {
+        for (i = 0; fields[i].field != NULL; ++i) {
             if (!strncasecmp(fields[i].field, key, klen)) {
                 fields[i].value = apr_pstrndup(pool, value, vlen);
                 break;
             }
         }
-        ptr = value+vlen;
+        ptr = value + vlen;
     }
     dir = fields[0].value;
     keyPrefix = fields[1].value;
     certPrefix = fields[2].value;
     secmod = fields[3].value;
 
-    apr_pool_cleanup_register(pool, pool,
-                              crypto_shutdown_helper,
-                              apr_pool_cleanup_null);
+    apr_pool_cleanup_register(pool, pool, crypto_shutdown_helper,
+            apr_pool_cleanup_null);
 
     if (keyPrefix || certPrefix || secmod) {
         s = NSS_Initialize(dir, certPrefix, keyPrefix, secmod, flags);
@@ -271,8 +272,9 @@ static apr_status_t crypto_cleanup_helpe
  * @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_crypto_t **ff, const apr_crypto_driver_t *provider,
-        const char *params, apr_pool_t *pool)
+static apr_status_t crypto_make(apr_crypto_t **ff,
+        const apr_crypto_driver_t *provider, const char *params,
+        apr_pool_t *pool)
 {
     apr_crypto_config_t *config = NULL;
     apr_crypto_t *f;
@@ -292,8 +294,7 @@ static apr_status_t crypto_make(apr_cryp
     if (!f->result) {
         return APR_ENOMEM;
     }
-    f->keys = apr_array_make(pool,
-                             10, sizeof(apr_crypto_key_t));
+    f->keys = apr_array_make(pool, 10, sizeof(apr_crypto_key_t));
 
     f->types = apr_hash_make(pool);
     if (!f->types) {
@@ -311,9 +312,8 @@ static apr_status_t crypto_make(apr_cryp
     apr_hash_set(f->modes, "ecb", APR_HASH_KEY_STRING, &(mode_ecb));
     apr_hash_set(f->modes, "cbc", APR_HASH_KEY_STRING, &(mode_cbc));
 
-    apr_pool_cleanup_register(pool, f,
-                              crypto_cleanup_helper,
-                              apr_pool_cleanup_null);
+    apr_pool_cleanup_register(pool, f, crypto_cleanup_helper,
+            apr_pool_cleanup_null);
 
     return APR_SUCCESS;
 
@@ -402,7 +402,7 @@ static apr_status_t crypto_passphrase(ap
     /* decide on what cipher mechanism we will be using */
     switch (type) {
 
-    case (APR_KEY_3DES_192) :
+    case (APR_KEY_3DES_192):
         if (APR_MODE_CBC == mode) {
             key->cipherOid = SEC_OID_DES_EDE3_CBC;
         }
@@ -411,7 +411,7 @@ static apr_status_t crypto_passphrase(ap
             /* No OID for CKM_DES3_ECB; */
         }
         break;
-    case (APR_KEY_AES_128) :
+    case (APR_KEY_AES_128):
         if (APR_MODE_CBC == mode) {
             key->cipherOid = SEC_OID_AES_128_CBC;
         }
@@ -419,7 +419,7 @@ static apr_status_t crypto_passphrase(ap
             key->cipherOid = SEC_OID_AES_128_ECB;
         }
         break;
-    case (APR_KEY_AES_192) :
+    case (APR_KEY_AES_192):
         if (APR_MODE_CBC == mode) {
             key->cipherOid = SEC_OID_AES_192_CBC;
         }
@@ -427,7 +427,7 @@ static apr_status_t crypto_passphrase(ap
             key->cipherOid = SEC_OID_AES_192_ECB;
         }
         break;
-    case (APR_KEY_AES_256) :
+    case (APR_KEY_AES_256):
         if (APR_MODE_CBC == mode) {
             key->cipherOid = SEC_OID_AES_256_CBC;
         }
@@ -448,25 +448,28 @@ static apr_status_t crypto_passphrase(ap
     if (doPad) {
         CK_MECHANISM_TYPE paddedMech;
         paddedMech = PK11_GetPadMechanism(key->cipherMech);
-        if (CKM_INVALID_MECHANISM == paddedMech || key->cipherMech == paddedMech) {
+        if (CKM_INVALID_MECHANISM == paddedMech || key->cipherMech
+                == paddedMech) {
             return APR_EPADDING;
         }
         key->cipherMech = paddedMech;
     }
 
     /* Turn the raw passphrase and salt into SECItems */
-    passItem.data = (unsigned char*)pass;
+    passItem.data = (unsigned char*) pass;
     passItem.len = passLen;
-    saltItem.data = (unsigned char*)salt;
+    saltItem.data = (unsigned char*) salt;
     saltItem.len = saltLen;
 
     /* generate the key */
     /* pbeAlg and cipherAlg are the same. NSS decides the keylength. */
-    algid = PK11_CreatePBEV2AlgorithmID(key->cipherOid, key->cipherOid, SEC_OID_HMAC_SHA1, 0, iterations, &saltItem);
+    algid = PK11_CreatePBEV2AlgorithmID(key->cipherOid, key->cipherOid,
+            SEC_OID_HMAC_SHA1, 0, iterations, &saltItem);
     if (algid) {
         slot = PK11_GetBestSlot(key->cipherMech, wincx);
         if (slot) {
-            key->symKey = PK11_PBEKeyGen(slot, algid, &passItem, PR_FALSE, wincx);
+            key->symKey = PK11_PBEKeyGen(slot, algid, &passItem, PR_FALSE,
+                    wincx);
             PK11_FreeSlot(slot);
         }
         SECOID_DestroyAlgorithmID(algid, PR_TRUE);
@@ -525,9 +528,8 @@ static apr_status_t crypto_block_encrypt
     block->pool = p;
     block->provider = key->provider;
 
-    apr_pool_cleanup_register(p, block,
-                              crypto_block_cleanup_helper,
-                              apr_pool_cleanup_null);
+    apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
+            apr_pool_cleanup_null);
 
     if (key->ivSize) {
         if (iv == NULL) {
@@ -546,7 +548,7 @@ static apr_status_t crypto_block_encrypt
             *iv = usedIv;
         }
         else {
-             usedIv = (unsigned char *)*iv;
+            usedIv = (unsigned char *) *iv;
         }
         ivItem.data = usedIv;
         ivItem.len = key->ivSize;
@@ -556,7 +558,8 @@ static apr_status_t crypto_block_encrypt
         secParam = PK11_GenerateNewParam(key->cipherMech, key->symKey);
     }
     block->blockSize = PK11_GetBlockSize(key->cipherMech, secParam);
-    block->ctx = PK11_CreateContextBySymKey(key->cipherMech, CKA_ENCRYPT, key->symKey, secParam);
+    block->ctx = PK11_CreateContextBySymKey(key->cipherMech, CKA_ENCRYPT,
+            key->symKey, secParam);
 
     /* did an error occur? */
     perr = PORT_GetError();
@@ -567,7 +570,7 @@ static apr_status_t crypto_block_encrypt
     }
 
     if (blockSize) {
-    *blockSize = PK11_GetBlockSize(key->cipherMech, secParam);
+        *blockSize = PK11_GetBlockSize(key->cipherMech, secParam);
     }
 
     return APR_SUCCESS;
@@ -612,7 +615,8 @@ static apr_status_t crypto_block_encrypt
         *out = buffer;
     }
 
-    s = PK11_CipherOp(block->ctx, *out, &outl, inlen, (unsigned char*)in, inlen);
+    s = PK11_CipherOp(block->ctx, *out, &outl, inlen, (unsigned char*) in,
+            inlen);
     if (s != SECSuccess) {
         PRErrorCode perr = PORT_GetError();
         if (perr) {
@@ -701,16 +705,15 @@ static apr_status_t crypto_block_decrypt
     block->pool = p;
     block->provider = key->provider;
 
-    apr_pool_cleanup_register(p, block,
-                              crypto_block_cleanup_helper,
-                              apr_pool_cleanup_null);
+    apr_pool_cleanup_register(p, block, crypto_block_cleanup_helper,
+            apr_pool_cleanup_null);
 
     if (key->ivSize) {
         SECItem ivItem;
         if (iv == NULL) {
             return APR_ENOIV; /* Cannot initialise without an IV */
         }
-        ivItem.data = (unsigned char*)iv;
+        ivItem.data = (unsigned char*) iv;
         ivItem.len = key->ivSize;
         secParam = PK11_ParamFromIV(key->cipherMech, &ivItem);
     }
@@ -718,7 +721,8 @@ static apr_status_t crypto_block_decrypt
         secParam = PK11_GenerateNewParam(key->cipherMech, key->symKey);
     }
     block->blockSize = PK11_GetBlockSize(key->cipherMech, secParam);
-    block->ctx = PK11_CreateContextBySymKey(key->cipherMech, CKA_DECRYPT, key->symKey, secParam);
+    block->ctx = PK11_CreateContextBySymKey(key->cipherMech, CKA_DECRYPT,
+            key->symKey, secParam);
 
     /* did an error occur? */
     perr = PORT_GetError();
@@ -774,7 +778,8 @@ static apr_status_t crypto_block_decrypt
         *out = buffer;
     }
 
-    s = PK11_CipherOp(block->ctx, *out, &outl, inlen, (unsigned char*)in, inlen);
+    s = PK11_CipherOp(block->ctx, *out, &outl, inlen, (unsigned char*) in,
+            inlen);
     if (s != SECSuccess) {
         PRErrorCode perr = PORT_GetError();
         if (perr) {
@@ -835,22 +840,12 @@ static apr_status_t crypto_block_decrypt
  * NSS module.
  */
 APU_MODULE_DECLARE_DATA const apr_crypto_driver_t apr_crypto_nss_driver = {
-    "nss",
-    crypto_init,
-    crypto_make,
-    crypto_get_block_key_types,
-    crypto_get_block_key_modes,
-    crypto_passphrase,
-    crypto_block_encrypt_init,
-    crypto_block_encrypt,
-    crypto_block_encrypt_finish,
-    crypto_block_decrypt_init,
-    crypto_block_decrypt,
-    crypto_block_decrypt_finish,
-    crypto_block_cleanup,
-    crypto_cleanup,
-    crypto_shutdown,
-    crypto_error
+    "nss", crypto_init, crypto_make, crypto_get_block_key_types,
+    crypto_get_block_key_modes, crypto_passphrase,
+    crypto_block_encrypt_init, crypto_block_encrypt,
+    crypto_block_encrypt_finish, crypto_block_decrypt_init,
+    crypto_block_decrypt, crypto_block_decrypt_finish,
+    crypto_block_cleanup, crypto_cleanup, crypto_shutdown, crypto_error
 };
 
 #endif

Modified: apr/apr-util/branches/1.5.x/crypto/apr_crypto_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/crypto/apr_crypto_openssl.c?rev=1187940&r1=1187939&r2=1187940&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/crypto/apr_crypto_openssl.c (original)
+++ apr/apr-util/branches/1.5.x/crypto/apr_crypto_openssl.c Sun Oct 23 17:45:41 2011
@@ -82,7 +82,9 @@ static int mode_cbc = APR_MODE_CBC;
 /**
  * Fetch the most recent error from this driver.
  */
-static apr_status_t crypto_error(const apu_err_t **result, const apr_crypto_t *f) {
+static apr_status_t crypto_error(const apu_err_t **result,
+        const apr_crypto_t *f)
+{
     *result = f->result;
     return APR_SUCCESS;
 }
@@ -90,14 +92,16 @@ static apr_status_t crypto_error(const a
 /**
  * Shutdown the crypto library and release resources.
  */
-static apr_status_t crypto_shutdown(void) {
+static apr_status_t crypto_shutdown(void)
+{
     ERR_free_strings();
     EVP_cleanup();
     ENGINE_cleanup();
     return APR_SUCCESS;
 }
 
-static apr_status_t crypto_shutdown_helper(void *data) {
+static apr_status_t crypto_shutdown_helper(void *data)
+{
     apr_pool_t *pool = (apr_pool_t *) data;
     return crypto_shutdown();
 }
@@ -105,8 +109,8 @@ static apr_status_t crypto_shutdown_help
 /**
  * Initialise the crypto library and perform one time initialisation.
  */
-static apr_status_t crypto_init(apr_pool_t *pool,
-        const char *params, int *rc) {
+static apr_status_t crypto_init(apr_pool_t *pool, const char *params, int *rc)
+{
     CRYPTO_malloc_init();
     ERR_load_crypto_strings();
     /* SSL_load_error_strings(); */
@@ -126,7 +130,8 @@ static apr_status_t crypto_init(apr_pool
  * @param ctx The block context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-static apr_status_t crypto_block_cleanup(apr_crypto_block_t *ctx) {
+static apr_status_t crypto_block_cleanup(apr_crypto_block_t *ctx)
+{
 
     if (ctx->initialised) {
         EVP_CIPHER_CTX_cleanup(&ctx->cipherCtx);
@@ -137,7 +142,8 @@ static apr_status_t crypto_block_cleanup
 
 }
 
-static apr_status_t crypto_block_cleanup_helper(void *data) {
+static apr_status_t crypto_block_cleanup_helper(void *data)
+{
     apr_crypto_block_t *block = (apr_crypto_block_t *) data;
     return crypto_block_cleanup(block);
 }
@@ -148,7 +154,8 @@ static apr_status_t crypto_block_cleanup
  * @param f The context to use.
  * @return Returns APR_ENOTIMPL if not supported.
  */
-static apr_status_t crypto_cleanup(apr_crypto_t *f) {
+static apr_status_t crypto_cleanup(apr_crypto_t *f)
+{
 
     if (f->config->engine) {
         ENGINE_finish(f->config->engine);
@@ -159,7 +166,8 @@ static apr_status_t crypto_cleanup(apr_c
 
 }
 
-static apr_status_t crypto_cleanup_helper(void *data) {
+static apr_status_t crypto_cleanup_helper(void *data)
+{
     apr_crypto_t *f = (apr_crypto_t *) data;
     return crypto_cleanup(f);
 }
@@ -176,8 +184,9 @@ static apr_status_t crypto_cleanup_helpe
  * @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_crypto_t **ff, const apr_crypto_driver_t *provider,
-        const char *params, apr_pool_t *pool)
+static apr_status_t crypto_make(apr_crypto_t **ff,
+        const apr_crypto_driver_t *provider, const char *params,
+        apr_pool_t *pool)
 {
     apr_crypto_config_t *config = NULL;
     apr_crypto_t *f = apr_pcalloc(pool, sizeof(apr_crypto_t));
@@ -186,8 +195,8 @@ static apr_status_t crypto_make(apr_cryp
         const char *field;
         char *value;
     } fields[] = {
-        {"engine", NULL},
-        {NULL, NULL}
+        { "engine", NULL },
+        { NULL, NULL }
     };
     int i;
     const char *ptr;
@@ -195,7 +204,7 @@ static apr_status_t crypto_make(apr_cryp
     size_t klen;
     const char *value;
     size_t vlen;
-    static const char *const delims = " \r\n\t;|,";
+    static const char * const delims = " \r\n\t;|,";
     const char *engine;
 
     if (!f) {
@@ -245,7 +254,7 @@ static apr_status_t crypto_make(apr_cryp
             ++ptr;
             continue;
         }
-        for (key = ptr-1; apr_isspace(*key); --key);
+        for (key = ptr - 1; apr_isspace(*key); --key);
         klen = 0;
         while (apr_isalpha(*key)) {
             if (key == params) {
@@ -258,15 +267,15 @@ static apr_status_t crypto_make(apr_cryp
             ++klen;
         }
         ++key;
-        for (value = ptr+1; apr_isspace(*value); ++value);
+        for (value = ptr + 1; apr_isspace(*value); ++value);
         vlen = strcspn(value, delims);
-        for (i=0; fields[i].field != NULL; ++i) {
+        for (i = 0; fields[i].field != NULL; ++i) {
             if (!strncasecmp(fields[i].field, key, klen)) {
                 fields[i].value = apr_pstrndup(pool, value, vlen);
                 break;
             }
         }
-        ptr = value+vlen;
+        ptr = value + vlen;
     }
     engine = fields[0].value;
 
@@ -368,7 +377,8 @@ static apr_status_t crypto_passphrase(ap
         /* A 3DES key */
         if (mode == APR_MODE_CBC) {
             key->cipher = EVP_des_ede3_cbc();
-        } else {
+        }
+        else {
             key->cipher = EVP_des_ede3_ecb();
         }
         break;
@@ -377,7 +387,8 @@ static apr_status_t crypto_passphrase(ap
 
         if (mode == APR_MODE_CBC) {
             key->cipher = EVP_aes_128_cbc();
-        } else {
+        }
+        else {
             key->cipher = EVP_aes_128_ecb();
         }
         break;
@@ -386,7 +397,8 @@ static apr_status_t crypto_passphrase(ap
 
         if (mode == APR_MODE_CBC) {
             key->cipher = EVP_aes_192_cbc();
-        } else {
+        }
+        else {
             key->cipher = EVP_aes_192_ecb();
         }
         break;
@@ -395,7 +407,8 @@ static apr_status_t crypto_passphrase(ap
 
         if (mode == APR_MODE_CBC) {
             key->cipher = EVP_aes_256_cbc();
-        } else {
+        }
+        else {
             key->cipher = EVP_aes_256_ecb();
         }
         break;
@@ -493,7 +506,8 @@ static apr_status_t crypto_block_encrypt
                 return APR_ENOIV;
             }
             *iv = usedIv;
-        } else {
+        }
+        else {
             usedIv = (unsigned char *) *iv;
         }
     }
@@ -765,13 +779,13 @@ static apr_status_t crypto_block_decrypt
 /**
  * OpenSSL module.
  */
-APU_MODULE_DECLARE_DATA const apr_crypto_driver_t apr_crypto_openssl_driver =
-{ "openssl", crypto_init, crypto_make, crypto_get_block_key_types,
-        crypto_get_block_key_modes, crypto_passphrase,
-        crypto_block_encrypt_init, crypto_block_encrypt,
-        crypto_block_encrypt_finish, crypto_block_decrypt_init,
-        crypto_block_decrypt, crypto_block_decrypt_finish,
-        crypto_block_cleanup, crypto_cleanup, crypto_shutdown, crypto_error
+APU_MODULE_DECLARE_DATA const apr_crypto_driver_t apr_crypto_openssl_driver = {
+    "openssl", crypto_init, crypto_make, crypto_get_block_key_types,
+    crypto_get_block_key_modes, crypto_passphrase,
+    crypto_block_encrypt_init, crypto_block_encrypt,
+    crypto_block_encrypt_finish, crypto_block_decrypt_init,
+    crypto_block_decrypt, crypto_block_decrypt_finish,
+    crypto_block_cleanup, crypto_cleanup, crypto_shutdown, crypto_error
 };
 
 #endif

Modified: apr/apr-util/branches/1.5.x/include/apr_crypto.h
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/include/apr_crypto.h?rev=1187940&r1=1187939&r2=1187940&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/include/apr_crypto.h (original)
+++ apr/apr-util/branches/1.5.x/include/apr_crypto.h Sun Oct 23 17:45:41 2011
@@ -99,16 +99,17 @@ extern "C" {
  * aligned data, use 3DES_192/CBC, AES_256/CBC or AES_256/ECB.
  */
 
-typedef enum {
-    APR_KEY_NONE,
-    APR_KEY_3DES_192, /** 192 bit (3-Key) 3DES */
+typedef enum
+{
+    APR_KEY_NONE, APR_KEY_3DES_192, /** 192 bit (3-Key) 3DES */
     APR_KEY_AES_128, /** 128 bit AES */
     APR_KEY_AES_192, /** 192 bit AES */
     APR_KEY_AES_256
 /** 256 bit AES */
 } apr_crypto_block_key_type_e;
 
-typedef enum {
+typedef enum
+{
     APR_MODE_NONE, /** An error condition */
     APR_MODE_ECB, /** Electronic Code Book */
     APR_MODE_CBC
@@ -147,7 +148,8 @@ APU_DECLARE(apr_status_t) apr_crypto_ini
  *  be delimited by space, CR, LF, tab, semicolon, vertical bar or comma.
  * @remarks OpenSSL: currently no params are supported.
  */
-APU_DECLARE(apr_status_t) apr_crypto_get_driver(const apr_crypto_driver_t **driver,
+APU_DECLARE(apr_status_t) apr_crypto_get_driver(
+        const apr_crypto_driver_t **driver,
         const char *name, const char *params, const apu_err_t **result,
         apr_pool_t *pool);
 
@@ -157,7 +159,8 @@ APU_DECLARE(apr_status_t) apr_crypto_get
  * @param driver - The driver in use.
  * @return The name of the driver.
  */
-APU_DECLARE(const char *) apr_crypto_driver_name(const apr_crypto_driver_t *driver);
+APU_DECLARE(const char *) apr_crypto_driver_name(
+        const apr_crypto_driver_t *driver);
 
 /**
  * @brief Get the result of the last operation on a context. If the result
@@ -185,8 +188,8 @@ APU_DECLARE(apr_status_t) apr_crypto_err
  *  sign and a value.
  */
 APU_DECLARE(apr_status_t) apr_crypto_make(apr_crypto_t **f,
-        const apr_crypto_driver_t *driver,
-        const char *params, apr_pool_t *pool);
+        const apr_crypto_driver_t *driver, const char *params,
+        apr_pool_t *pool);
 
 /**
  * @brief Get a hash table of key types, keyed by the name of the type against
@@ -390,7 +393,8 @@ APU_DECLARE(apr_status_t) apr_crypto_cle
  * @param driver - driver to use
  * @return Returns APR_ENOTIMPL if not supported.
  */
-APU_DECLARE(apr_status_t) apr_crypto_shutdown(const apr_crypto_driver_t *driver);
+APU_DECLARE(apr_status_t) apr_crypto_shutdown(
+        const apr_crypto_driver_t *driver);
 
 #endif /* APU_HAVE_CRYPTO */
 

Modified: apr/apr-util/branches/1.5.x/include/private/apr_crypto_internal.h
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/include/private/apr_crypto_internal.h?rev=1187940&r1=1187939&r2=1187940&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/include/private/apr_crypto_internal.h (original)
+++ apr/apr-util/branches/1.5.x/include/private/apr_crypto_internal.h Sun Oct 23 17:45:41 2011
@@ -171,8 +171,8 @@ struct apr_crypto_driver_t {
      *         formatted.
      * @return APR_ENOTIMPL if not implemented.
      */
-    apr_status_t (*block_encrypt_finish)(unsigned char *out, apr_size_t *outlen,
-            apr_crypto_block_t *ctx);
+    apr_status_t (*block_encrypt_finish)(unsigned char *out,
+            apr_size_t *outlen, apr_crypto_block_t *ctx);
 
     /**
      * @brief Initialise a context for decrypting arbitrary data using the given key.

Modified: apr/apr-util/branches/1.5.x/test/testcrypto.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/test/testcrypto.c?rev=1187940&r1=1187939&r2=1187940&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/test/testcrypto.c (original)
+++ apr/apr-util/branches/1.5.x/test/testcrypto.c Sun Oct 23 17:45:41 2011
@@ -29,7 +29,8 @@
 #define ALIGNED_STRING "123456789012345"
 
 static const apr_crypto_driver_t *get_driver(abts_case *tc, apr_pool_t *pool,
-        const char *name, const char *params) {
+        const char *name, const char *params)
+{
 
     const apr_crypto_driver_t *driver = NULL;
     const apu_err_t *err = NULL;
@@ -58,7 +59,8 @@ static const apr_crypto_driver_t *get_dr
 }
 
 static const apr_crypto_driver_t *get_nss_driver(abts_case *tc,
-        apr_pool_t *pool) {
+        apr_pool_t *pool)
+{
 
     /* initialise NSS */
     return get_driver(tc, pool, "nss", "dir=data");
@@ -66,14 +68,16 @@ static const apr_crypto_driver_t *get_ns
 }
 
 static const apr_crypto_driver_t *get_openssl_driver(abts_case *tc,
-        apr_pool_t *pool) {
+        apr_pool_t *pool)
+{
 
     return get_driver(tc, pool, "openssl", NULL);
 
 }
 
 static apr_crypto_t *make(abts_case *tc, apr_pool_t *pool,
-        const apr_crypto_driver_t *driver) {
+        const apr_crypto_driver_t *driver)
+{
 
     apr_crypto_t *f = NULL;
 
@@ -92,7 +96,8 @@ static apr_crypto_t *make(abts_case *tc,
 static const apr_crypto_key_t *passphrase(abts_case *tc, apr_pool_t *pool,
         const apr_crypto_driver_t *driver, const apr_crypto_t *f,
         apr_crypto_block_key_type_e type, apr_crypto_block_key_mode_e mode,
-        int doPad, const char *description) {
+        int doPad, const char *description)
+{
 
     apr_crypto_key_t *key = NULL;
     const apu_err_t *result = NULL;
@@ -111,11 +116,12 @@ static const apr_crypto_key_t *passphras
     if (APR_ENOCIPHER == rv) {
         apr_crypto_error(&result, f);
         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 : ""));
+                        "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 {
+    }
+    else {
         if (APR_SUCCESS != rv) {
             apr_crypto_error(&result, f);
             fprintf(stderr, "passphrase: %s %s native error %d: %s (%s)\n",
@@ -141,7 +147,8 @@ static unsigned char *encrypt_block(abts
         const apr_crypto_key_t *key, const unsigned char *in,
         const apr_size_t inlen, unsigned char **cipherText,
         apr_size_t *cipherTextLen, const unsigned char **iv,
-        apr_size_t *blockSize, const char *description) {
+        apr_size_t *blockSize, const char *description)
+{
 
     apr_crypto_block_t *block = NULL;
     const apu_err_t *result = NULL;
@@ -156,7 +163,8 @@ static unsigned char *encrypt_block(abts
     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 {
+    }
+    else {
         if (APR_SUCCESS != rv) {
             apr_crypto_error(&result, f);
             fprintf(stderr, "encrypt_init: %s %s native error %d: %s (%s)\n",
@@ -181,8 +189,8 @@ static unsigned char *encrypt_block(abts
         apr_crypto_error(&result, f);
         fprintf(stderr, "encrypt: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
-                result->reason ? result->reason : "",
-                result->msg ? result->msg : "");
+                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);
@@ -192,13 +200,14 @@ static unsigned char *encrypt_block(abts
     }
 
     /* finalise the encryption */
-    rv = apr_crypto_block_encrypt_finish(*cipherText + *cipherTextLen, &len, 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",
                 description, apr_crypto_driver_name(driver), result->rc,
-                result->reason ? result->reason : "",
-                result->msg ? result->msg : "");
+                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);
@@ -218,7 +227,8 @@ static unsigned char *decrypt_block(abts
         const apr_crypto_key_t *key, unsigned char *cipherText,
         apr_size_t cipherTextLen, unsigned char **plainText,
         apr_size_t *plainTextLen, const unsigned char *iv,
-        apr_size_t *blockSize, const char *description) {
+        apr_size_t *blockSize, const char *description)
+{
 
     apr_crypto_block_t *block = NULL;
     const apu_err_t *result = NULL;
@@ -233,7 +243,8 @@ static unsigned char *decrypt_block(abts
     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 {
+    }
+    else {
         if (APR_SUCCESS != rv) {
             apr_crypto_error(&result, f);
             fprintf(stderr, "decrypt_init: %s %s native error %d: %s (%s)\n",
@@ -259,8 +270,8 @@ static unsigned char *decrypt_block(abts
         apr_crypto_error(&result, f);
         fprintf(stderr, "decrypt: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
-                result->reason ? result->reason : "",
-                result->msg ? result->msg : "");
+                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);
@@ -276,8 +287,8 @@ static unsigned char *decrypt_block(abts
         apr_crypto_error(&result, f);
         fprintf(stderr, "decrypt_finish: %s %s native error %d: %s (%s)\n",
                 description, apr_crypto_driver_name(driver), result->rc,
-                result->reason ? result->reason : "",
-                result->msg ? result->msg : "");
+                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);
@@ -305,7 +316,8 @@ static void crypto_block_cross(abts_case
         const apr_crypto_driver_t **drivers,
         const apr_crypto_block_key_type_e type,
         const apr_crypto_block_key_mode_e mode, int doPad,
-        const unsigned char *in, apr_size_t inlen, const char *description) {
+        const unsigned char *in, apr_size_t inlen, const char *description)
+{
     const apr_crypto_driver_t *driver1 = drivers[0];
     const apr_crypto_driver_t *driver2 = drivers[1];
     apr_crypto_t *f1 = NULL;
@@ -345,7 +357,8 @@ static void crypto_block_cross(abts_case
 /**
  * Test initialisation.
  */
-static void test_crypto_init(abts_case *tc, void *data) {
+static void test_crypto_init(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     apr_status_t rv;
 
@@ -361,7 +374,8 @@ static void test_crypto_init(abts_case *
 /**
  * Simple test of OpenSSL block crypt.
  */
-static void test_crypto_block_openssl(abts_case *tc, void *data) {
+static void test_crypto_block_openssl(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -371,22 +385,22 @@ static void test_crypto_block_openssl(ab
     apr_pool_create(&pool, NULL);
     drivers[0] = get_openssl_driver(tc, pool);
     drivers[1] = get_openssl_driver(tc, pool);
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_ECB, 0, in, inlen,
-            "KEY_3DES_192/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_256/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_256/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_192/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_192/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_128/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_128/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_ECB, 0,
+            in, inlen, "KEY_3DES_192/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_256/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_192/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_128/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_128/MODE_ECB");
     apr_pool_destroy(pool);
 
 }
@@ -394,7 +408,8 @@ static void test_crypto_block_openssl(ab
 /**
  * Simple test of NSS block crypt.
  */
-static void test_crypto_block_nss(abts_case *tc, void *data) {
+static void test_crypto_block_nss(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -404,22 +419,22 @@ static void test_crypto_block_nss(abts_c
     apr_pool_create(&pool, NULL);
     drivers[0] = get_nss_driver(tc, pool);
     drivers[1] = get_nss_driver(tc, pool);
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
     /* KEY_3DES_192 / MODE_ECB doesn't work on NSS */
     /* crypto_block_cross(tc, pool, drivers, KEY_3DES_192, MODE_ECB, 0, in, inlen, "KEY_3DES_192/MODE_ECB"); */
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_256/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_256/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_192/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_192/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_128/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_128/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_256/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_192/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_128/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_128/MODE_ECB");
     apr_pool_destroy(pool);
 
 }
@@ -427,7 +442,8 @@ static void test_crypto_block_nss(abts_c
 /**
  * Encrypt NSS, decrypt OpenSSL.
  */
-static void test_crypto_block_nss_openssl(abts_case *tc, void *data) {
+static void test_crypto_block_nss_openssl(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -438,15 +454,15 @@ static void test_crypto_block_nss_openss
     drivers[0] = get_nss_driver(tc, pool);
     drivers[1] = get_openssl_driver(tc, pool);
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
 
     /* KEY_3DES_192 / MODE_ECB doesn't work on NSS */
     /* crypto_block_cross(tc, pool, drivers, KEY_3DES_192, MODE_ECB, 0, in, inlen, "KEY_3DES_192/MODE_ECB"); */
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_256/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_256/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_256/MODE_ECB");
 
     /* all 4 of these tests fail to interoperate - a clue from the xml-security code is that
      * NSS cannot distinguish between the 128 and 192 bit versions of AES. Will need to be
@@ -465,7 +481,8 @@ static void test_crypto_block_nss_openss
 /**
  * Encrypt OpenSSL, decrypt NSS.
  */
-static void test_crypto_block_openssl_nss(abts_case *tc, void *data) {
+static void test_crypto_block_openssl_nss(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -475,16 +492,16 @@ static void test_crypto_block_openssl_ns
     apr_pool_create(&pool, NULL);
     drivers[0] = get_openssl_driver(tc, pool);
     drivers[1] = get_nss_driver(tc, pool);
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 0,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
 
     /* KEY_3DES_192 / MODE_ECB doesn't work on NSS */
     /* crypto_block_cross(tc, pool, drivers, KEY_3DES_192, MODE_ECB, 0, in, inlen, "KEY_3DES_192/MODE_ECB"); */
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in, inlen,
-            "KEY_AES_256/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in, inlen,
-            "KEY_AES_256/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 0, in,
+            inlen, "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 0, in,
+            inlen, "KEY_AES_256/MODE_ECB");
 
     /* all 4 of these tests fail to interoperate - a clue from the xml-security code is that
      * NSS cannot distinguish between the 128 and 192 bit versions of AES. Will need to be
@@ -503,7 +520,8 @@ static void test_crypto_block_openssl_ns
 /**
  * Simple test of OpenSSL block crypt.
  */
-static void test_crypto_block_openssl_pad(abts_case *tc, void *data) {
+static void test_crypto_block_openssl_pad(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -514,22 +532,22 @@ static void test_crypto_block_openssl_pa
     drivers[0] = get_openssl_driver(tc, pool);
     drivers[1] = get_openssl_driver(tc, pool);
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_ECB, 1, in, inlen,
-            "KEY_3DES_192/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_256/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 1, in, inlen,
-            "KEY_AES_256/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_192/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_ECB, 1, in, inlen,
-            "KEY_AES_192/MODE_ECB");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_128/MODE_CBC");
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_ECB, 1, in, inlen,
-            "KEY_AES_128/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_ECB, 1,
+            in, inlen, "KEY_3DES_192/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_ECB, 1, in,
+            inlen, "KEY_AES_256/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_ECB, 1, in,
+            inlen, "KEY_AES_192/MODE_ECB");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_128/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_ECB, 1, in,
+            inlen, "KEY_AES_128/MODE_ECB");
 
     apr_pool_destroy(pool);
 
@@ -538,9 +556,11 @@ static void test_crypto_block_openssl_pa
 /**
  * Simple test of NSS block crypt.
  */
-static void test_crypto_block_nss_pad(abts_case *tc, void *data) {
+static void test_crypto_block_nss_pad(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
-    const apr_crypto_driver_t *drivers[] = { NULL, NULL };
+    const apr_crypto_driver_t *drivers[] =
+    { NULL, NULL };
 
     const unsigned char *in = (const unsigned char *) TEST_STRING;
     apr_size_t inlen = sizeof(TEST_STRING);
@@ -549,25 +569,25 @@ static void test_crypto_block_nss_pad(ab
     drivers[0] = get_nss_driver(tc, pool);
     drivers[1] = get_nss_driver(tc, pool);
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
     /* KEY_3DES_192 / MODE_ECB doesn't work on NSS */
     /* crypto_block_cross(tc, pool, drivers, KEY_3DES_192, MODE_ECB, 1, in, inlen, "KEY_3DES_192/MODE_ECB"); */
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_256/MODE_CBC");
 
     /* KEY_AES_256 / MODE_ECB doesn't support padding on NSS */
     /*crypto_block_cross(tc, pool, drivers, KEY_AES_256, MODE_ECB, 1, in, inlen, "KEY_AES_256/MODE_ECB");*/
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_192, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_192/MODE_CBC");
 
     /* KEY_AES_256 / MODE_ECB doesn't support padding on NSS */
     /*crypto_block_cross(tc, pool, drivers, KEY_AES_192, MODE_ECB, 1, in, inlen, "KEY_AES_192/MODE_ECB");*/
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_128/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_128, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_128/MODE_CBC");
 
     /* KEY_AES_256 / MODE_ECB doesn't support padding on NSS */
     /*crypto_block_cross(tc, pool, drivers, KEY_AES_128, MODE_ECB, 1, in, inlen, "KEY_AES_128/MODE_ECB");*/
@@ -579,7 +599,8 @@ static void test_crypto_block_nss_pad(ab
 /**
  * Encrypt NSS, decrypt OpenSSL.
  */
-static void test_crypto_block_nss_openssl_pad(abts_case *tc, void *data) {
+static void test_crypto_block_nss_openssl_pad(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -590,14 +611,14 @@ static void test_crypto_block_nss_openss
     drivers[0] = get_nss_driver(tc, pool);
     drivers[1] = get_openssl_driver(tc, pool);
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
 
     /* KEY_3DES_192 / MODE_ECB doesn't work on NSS */
     /* crypto_block_cross(tc, pool, drivers, KEY_3DES_192, MODE_ECB, 1, in, inlen, "KEY_3DES_192/MODE_ECB"); */
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_256/MODE_CBC");
 
     /* KEY_AES_256 / MODE_ECB doesn't support padding on NSS */
     /*crypto_block_cross(tc, pool, drivers, KEY_AES_256, MODE_ECB, 1, in, inlen, "KEY_AES_256/MODE_ECB");*/
@@ -619,7 +640,8 @@ static void test_crypto_block_nss_openss
 /**
  * Encrypt OpenSSL, decrypt NSS.
  */
-static void test_crypto_block_openssl_nss_pad(abts_case *tc, void *data) {
+static void test_crypto_block_openssl_nss_pad(abts_case *tc, void *data)
+{
     apr_pool_t *pool = NULL;
     const apr_crypto_driver_t *drivers[] = { NULL, NULL };
 
@@ -629,14 +651,14 @@ static void test_crypto_block_openssl_ns
     apr_pool_create(&pool, NULL);
     drivers[0] = get_openssl_driver(tc, pool);
     drivers[1] = get_nss_driver(tc, pool);
-    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1, in, inlen,
-            "KEY_3DES_192/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_3DES_192, APR_MODE_CBC, 1,
+            in, inlen, "KEY_3DES_192/MODE_CBC");
 
     /* KEY_3DES_192 / MODE_ECB doesn't work on NSS */
     /* crypto_block_cross(tc, pool, drivers, KEY_3DES_192, MODE_ECB, 1, in, inlen, "KEY_3DES_192/MODE_ECB"); */
 
-    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in, inlen,
-            "KEY_AES_256/MODE_CBC");
+    crypto_block_cross(tc, pool, drivers, APR_KEY_AES_256, APR_MODE_CBC, 1, in,
+            inlen, "KEY_AES_256/MODE_CBC");
 
     /* KEY_AES_256 / MODE_ECB doesn't support padding on NSS */
     /*crypto_block_cross(tc, pool, drivers, KEY_AES_256, MODE_ECB, 1, in, inlen, "KEY_AES_256/MODE_ECB");*/
@@ -807,7 +829,8 @@ static void test_crypto_get_block_key_mo
 
 }
 
-abts_suite *testcrypto(abts_suite *suite) {
+abts_suite *testcrypto(abts_suite *suite)
+{
     suite = ADD_SUITE(suite);
 
     /* test simple init and shutdown */



Mime
View raw message