diff options
author | minfrin <minfrin@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-23 17:05:19 +0000 |
---|---|---|
committer | minfrin <minfrin@13f79535-47bb-0310-9956-ffa450edef68> | 2011-10-23 17:05:19 +0000 |
commit | 80629afe0116eb4b4d4821a39a58682a0ef41a25 (patch) | |
tree | 4eced4cf0083833516c58c50ff233c3caf5f8e94 /crypto | |
parent | 1ab1bd14df7f81e818d9312cc7d4543d0f5e1aab (diff) | |
download | libapr-80629afe0116eb4b4d4821a39a58682a0ef41a25.tar.gz |
Formatting, no functional change.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1187932 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/apr_crypto.c | 45 | ||||
-rw-r--r-- | crypto/apr_crypto_nss.c | 113 | ||||
-rw-r--r-- | crypto/apr_crypto_openssl.c | 74 |
3 files changed, 124 insertions, 108 deletions
diff --git a/crypto/apr_crypto.c b/crypto/apr_crypto.c index 6af3bcb7e..4b28dd2e2 100644 --- a/crypto/apr_crypto.c +++ b/crypto/apr_crypto.c @@ -39,21 +39,21 @@ static apr_hash_t *drivers = NULL; #define CLEANUP_CAST (apr_status_t (*)(void*)) -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 !APR_HAVE_MODULAR_DSO @@ -67,7 +67,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; @@ -77,7 +78,8 @@ static apr_status_t apr_crypto_term(void *ptr) { return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool) { +APR_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool) +{ apr_status_t ret = APR_SUCCESS; apr_pool_t *parent; @@ -118,7 +120,8 @@ APR_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool) { APR_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 APR_HAVE_MODULAR_DSO char modname[32]; char symname[34]; @@ -153,7 +156,8 @@ APR_DECLARE(apr_status_t) apr_crypto_get_driver( apr_snprintf(modname, sizeof(modname), "apr_crypto_%s-" APR_STRINGIFY(APR_MAJOR_VERSION) ".dll", name); #else - apr_snprintf(modname, sizeof(modname), "apr_crypto_%s-" APR_STRINGIFY(APR_MAJOR_VERSION) ".so", name); + apr_snprintf(modname, sizeof(modname), + "apr_crypto_%s-" APR_STRINGIFY(APR_MAJOR_VERSION) ".so", name); #endif apr_snprintf(symname, sizeof(symname), "apr_crypto_%s_driver", name); rv = apu_dso_load(&dso, &symbol, modname, symname, pool); @@ -199,7 +203,8 @@ APR_DECLARE(apr_status_t) apr_crypto_get_driver( * @param driver - The driver in use. * @return The name of the driver. */ -APR_DECLARE(const char *)apr_crypto_driver_name (const apr_crypto_driver_t *driver) +APR_DECLARE(const char *)apr_crypto_driver_name( + const apr_crypto_driver_t *driver) { return driver->name; } @@ -212,7 +217,8 @@ APR_DECLARE(const char *)apr_crypto_driver_name (const apr_crypto_driver_t *driv * @return APR_SUCCESS for success */ APR_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); } @@ -231,8 +237,9 @@ APR_DECLARE(apr_status_t) apr_crypto_error(const apu_err_t **result, * @remarks OpenSSL: the params can have "engine" as a key, followed by an equal * sign and a value. */ -APR_DECLARE(apr_status_t) apr_crypto_make(apr_crypto_t **f, const apr_crypto_driver_t *driver, - const char *params, apr_pool_t *pool) { +APR_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); } diff --git a/crypto/apr_crypto_nss.c b/crypto/apr_crypto_nss.c index 36b18afda..00d5293af 100644 --- a/crypto/apr_crypto_nss.c +++ b/crypto/apr_crypto_nss.c @@ -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_t *pool, const char *params, int *rc) 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_t *pool, const char *params, int *rc) 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_t *pool, const char *params, int *rc) ++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_t *pool, const char *params, int *rc) ++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_helper(void *data) * @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_crypto_t **ff, const apr_crypto_driver_t *pr 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_crypto_t **ff, const apr_crypto_driver_t *pr 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; @@ -404,7 +404,7 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, /* 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; } @@ -413,7 +413,7 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, /* 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; } @@ -421,7 +421,7 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, 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; } @@ -429,7 +429,7 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, 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; } @@ -450,25 +450,28 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, 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); @@ -527,9 +530,8 @@ static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx, 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) { @@ -548,7 +550,7 @@ static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx, *iv = usedIv; } else { - usedIv = (unsigned char *)*iv; + usedIv = (unsigned char *) *iv; } ivItem.data = usedIv; ivItem.len = key->ivSize; @@ -558,7 +560,8 @@ static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx, 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(); @@ -569,7 +572,7 @@ static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx, } if (blockSize) { - *blockSize = PK11_GetBlockSize(key->cipherMech, secParam); + *blockSize = PK11_GetBlockSize(key->cipherMech, secParam); } return APR_SUCCESS; @@ -614,7 +617,8 @@ static apr_status_t crypto_block_encrypt(unsigned char **out, *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) { @@ -703,16 +707,15 @@ static apr_status_t crypto_block_decrypt_init(apr_crypto_block_t **ctx, 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); } @@ -720,7 +723,8 @@ static apr_status_t crypto_block_decrypt_init(apr_crypto_block_t **ctx, 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(); @@ -776,7 +780,8 @@ static apr_status_t crypto_block_decrypt(unsigned char **out, *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) { @@ -837,22 +842,12 @@ static apr_status_t crypto_block_decrypt_finish(unsigned char *out, * NSS module. */ APR_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 diff --git a/crypto/apr_crypto_openssl.c b/crypto/apr_crypto_openssl.c index d227284e5..631551627 100644 --- a/crypto/apr_crypto_openssl.c +++ b/crypto/apr_crypto_openssl.c @@ -83,7 +83,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; } @@ -91,22 +93,24 @@ static apr_status_t crypto_error(const apu_err_t **result, const apr_crypto_t *f /** * 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) +{ return crypto_shutdown(); } /** * 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_t *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(apr_crypto_block_t *ctx) { } -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_helper(void *data) { * @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_crypto_t *f) { } -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_helper(void *data) { * @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_crypto_t **ff, const apr_crypto_driver_t *pr 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_crypto_t **ff, const apr_crypto_driver_t *pr 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_crypto_t **ff, const apr_crypto_driver_t *pr ++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_crypto_t **ff, const apr_crypto_driver_t *pr ++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; @@ -370,7 +379,8 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, /* A 3DES key */ if (mode == APR_MODE_CBC) { key->cipher = EVP_des_ede3_cbc(); - } else { + } + else { key->cipher = EVP_des_ede3_ecb(); } break; @@ -379,7 +389,8 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, if (mode == APR_MODE_CBC) { key->cipher = EVP_aes_128_cbc(); - } else { + } + else { key->cipher = EVP_aes_128_ecb(); } break; @@ -388,7 +399,8 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, if (mode == APR_MODE_CBC) { key->cipher = EVP_aes_192_cbc(); - } else { + } + else { key->cipher = EVP_aes_192_ecb(); } break; @@ -397,7 +409,8 @@ static apr_status_t crypto_passphrase(apr_crypto_key_t **k, apr_size_t *ivSize, if (mode == APR_MODE_CBC) { key->cipher = EVP_aes_256_cbc(); - } else { + } + else { key->cipher = EVP_aes_256_ecb(); } break; @@ -495,7 +508,8 @@ static apr_status_t crypto_block_encrypt_init(apr_crypto_block_t **ctx, return APR_ENOIV; } *iv = usedIv; - } else { + } + else { usedIv = (unsigned char *) *iv; } } @@ -767,13 +781,13 @@ static apr_status_t crypto_block_decrypt_finish(unsigned char *out, /** * OpenSSL module. */ -APR_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 +APR_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 |