22#include "apr_tables.h"
42#ifndef APU_CRYPTO_RECOMMENDED_DRIVER
43#if APU_HAVE_COMMONCRYPTO
44#define APU_CRYPTO_RECOMMENDED_DRIVER "commoncrypto"
47#define APU_CRYPTO_RECOMMENDED_DRIVER "openssl"
50#define APU_CRYPTO_RECOMMENDED_DRIVER "nss"
53#define APU_CRYPTO_RECOMMENDED_DRIVER "mscng"
56#define APU_CRYPTO_RECOMMENDED_DRIVER "mscapi"
108 APR_KEY_NONE, APR_KEY_3DES_192,
113} apr_crypto_block_key_type_e;
121} apr_crypto_block_key_mode_e;
124typedef struct apr_crypto_driver_t apr_crypto_driver_t;
125typedef struct apr_crypto_t apr_crypto_t;
126typedef struct apr_crypto_config_t apr_crypto_config_t;
127typedef struct apr_crypto_key_t apr_crypto_key_t;
128typedef struct apr_crypto_block_t apr_crypto_block_t;
130typedef struct apr_crypto_block_key_type_t {
131 apr_crypto_block_key_type_e type;
135} apr_crypto_block_key_type_t;
137typedef struct apr_crypto_block_key_mode_t {
138 apr_crypto_block_key_mode_e mode;
139} apr_crypto_block_key_mode_t;
141typedef struct apr_crypto_passphrase_t {
144 const unsigned char * salt;
147} apr_crypto_passphrase_t;
149typedef struct apr_crypto_secret_t {
150 const unsigned char *secret;
151 apr_size_t secretLen;
152} apr_crypto_secret_t;
156 APR_CRYPTO_KTYPE_PASSPHRASE = 1,
158 APR_CRYPTO_KTYPE_SECRET = 2,
159} apr_crypto_key_type;
161typedef struct apr_crypto_key_rec_t {
162 apr_crypto_key_type ktype;
163 apr_crypto_block_key_type_e type;
164 apr_crypto_block_key_mode_e mode;
167 apr_crypto_passphrase_t passphrase;
168 apr_crypto_secret_t secret;
170} apr_crypto_key_rec_t;
178APU_DECLARE(apr_status_t) apr_crypto_init(apr_pool_t *pool);
187APU_DECLARE(apr_status_t) apr_crypto_clear(apr_pool_t *pool,
void *buffer,
197APU_DECLARE(apr_status_t) apr_crypto_memzero(
void *buffer, apr_size_t size);
208APU_DECLARE(
int) apr_crypto_equals(
const void *buf1,
const void *buf2,
229APU_DECLARE(apr_status_t) apr_crypto_get_driver(
230 const apr_crypto_driver_t **driver,
231 const char *name,
const char *params,
const apu_err_t **result,
240APU_DECLARE(
const char *) apr_crypto_driver_name(
241 const apr_crypto_driver_t *driver);
250APU_DECLARE(apr_status_t) apr_crypto_error(
const apu_err_t **result,
251 const apr_crypto_t *f);
268APU_DECLARE(apr_status_t) apr_crypto_make(apr_crypto_t **f,
269 const apr_crypto_driver_t *driver,
const char *params,
281APU_DECLARE(apr_status_t) apr_crypto_get_block_key_types(apr_hash_t **types,
282 const apr_crypto_t *f);
293APU_DECLARE(apr_status_t) apr_crypto_get_block_key_modes(apr_hash_t **modes,
294 const apr_crypto_t *f);
312APU_DECLARE(apr_status_t) apr_crypto_key(apr_crypto_key_t **key,
313 const apr_crypto_key_rec_t *rec,
const apr_crypto_t *f, apr_pool_t *p);
344APU_DECLARE(apr_status_t) apr_crypto_passphrase(apr_crypto_key_t **key,
345 apr_size_t *ivSize,
const char *pass, apr_size_t passLen,
346 const unsigned char * salt, apr_size_t saltLen,
347 const apr_crypto_block_key_type_e type,
348 const apr_crypto_block_key_mode_e mode,
const int doPad,
349 const int iterations,
const apr_crypto_t *f, apr_pool_t *p);
367APU_DECLARE(apr_status_t) apr_crypto_block_encrypt_init(
368 apr_crypto_block_t **ctx,
const unsigned char **iv,
369 const apr_crypto_key_t *key, apr_size_t *blockSize, apr_pool_t *p);
389APU_DECLARE(apr_status_t) apr_crypto_block_encrypt(
unsigned char **out,
390 apr_size_t *outlen,
const unsigned char *in, apr_size_t inlen,
391 apr_crypto_block_t *ctx);
411APU_DECLARE(apr_status_t) apr_crypto_block_encrypt_finish(
unsigned char *out,
412 apr_size_t *outlen, apr_crypto_block_t *ctx);
427APU_DECLARE(apr_status_t) apr_crypto_block_decrypt_init(
428 apr_crypto_block_t **ctx, apr_size_t *blockSize,
429 const unsigned char *iv,
const apr_crypto_key_t *key, apr_pool_t *p);
449APU_DECLARE(apr_status_t) apr_crypto_block_decrypt(
unsigned char **out,
450 apr_size_t *outlen,
const unsigned char *in, apr_size_t inlen,
451 apr_crypto_block_t *ctx);
471APU_DECLARE(apr_status_t) apr_crypto_block_decrypt_finish(
unsigned char *out,
472 apr_size_t *outlen, apr_crypto_block_t *ctx);
480APU_DECLARE(apr_status_t) apr_crypto_block_cleanup(apr_crypto_block_t *ctx);
488APU_DECLARE(apr_status_t) apr_crypto_cleanup(apr_crypto_t *f);
496APU_DECLARE(apr_status_t) apr_crypto_shutdown(
497 const apr_crypto_driver_t *driver);
Definition: apu_errno.h:161