21 #include "apr_pools.h"
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,
124 typedef struct apr_crypto_driver_t apr_crypto_driver_t;
125 typedef struct apr_crypto_t apr_crypto_t;
126 typedef struct apr_crypto_config_t apr_crypto_config_t;
127 typedef struct apr_crypto_key_t apr_crypto_key_t;
128 typedef struct apr_crypto_block_t apr_crypto_block_t;
144 const unsigned char * salt;
150 const unsigned char *secret;
151 apr_size_t secretLen;
197 APR_DECLARE(apr_status_t) apr_crypto_memzero(
void *buffer, apr_size_t size);
208 APR_DECLARE(
int) apr_crypto_equals(const
void *buf1, const
void *buf2,
230 const apr_crypto_driver_t **driver,
231 const
char *name, const
char *params, const
apu_err_t **result,
241 const apr_crypto_driver_t *driver);
251 const apr_crypto_t *f);
269 const apr_crypto_driver_t *driver, const
char *params,
282 const apr_crypto_t *f);
294 const apr_crypto_t *f);
312 APR_DECLARE(apr_status_t) apr_crypto_key(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,
349 const
int iterations, const apr_crypto_t *f, apr_pool_t *p);
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);
390 apr_size_t *outlen, const
unsigned char *in, apr_size_t inlen,
391 apr_crypto_block_t *ctx);
412 apr_size_t *outlen, apr_crypto_block_t *ctx);
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);
450 apr_size_t *outlen, const
unsigned char *in, apr_size_t inlen,
451 apr_crypto_block_t *ctx);
472 apr_size_t *outlen, apr_crypto_block_t *ctx);
497 const apr_crypto_driver_t *driver);
apr_status_t apr_crypto_make(apr_crypto_t **f, const apr_crypto_driver_t *driver, const char *params, apr_pool_t *pool)
Create a context for supporting encryption. Keys, certificates, algorithms and other parameters will ...
Definition: apr_crypto.h:111
apr_status_t apr_crypto_block_decrypt(unsigned char **out, apr_size_t *outlen, const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx)
Decrypt data provided by in, write it to out.
Definition: apr_crypto.h:130
apr_crypto_block_key_type_e
Definition: apr_crypto.h:106
Definition: apr_crypto.h:156
Definition: apr_crypto.h:161
Definition: apr_crypto.h:137
apr_status_t apr_crypto_block_decrypt_init(apr_crypto_block_t **ctx, apr_size_t *blockSize, const unsigned char *iv, const apr_crypto_key_t *key, apr_pool_t *p)
Initialise a context for decrypting arbitrary data using the given key.
apr_status_t apr_crypto_cleanup(apr_crypto_t *f)
Clean encryption / decryption context.
apr_crypto_key_type
Definition: apr_crypto.h:154
apr_status_t apr_crypto_block_decrypt_finish(unsigned char *out, apr_size_t *outlen, apr_crypto_block_t *ctx)
Decrypt final data block, write it to out.
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)
Get the driver struct for a name.
Definition: apr_crypto.h:149
apr_status_t apr_crypto_get_block_key_modes(apr_hash_t **modes, const apr_crypto_t *f)
Get a hash table of key modes, keyed by the name of the mode against a pointer to apr_crypto_block_ke...
apr_status_t apr_crypto_error(const apu_err_t **result, const apr_crypto_t *f)
Get the result of the last operation on a context. If the result is NULL, the operation was successfu...
Definition: apr_crypto.h:119
Definition: apr_crypto.h:141
Definition: apr_crypto.h:158
apr_status_t apr_crypto_passphrase(apr_crypto_key_t **key, apr_size_t *ivSize, const char *pass, apr_size_t passLen, const unsigned char *salt, apr_size_t saltLen, const apr_crypto_block_key_type_e type, const apr_crypto_block_key_mode_e mode, const int doPad, const int iterations, const apr_crypto_t *f, apr_pool_t *p)
Create a key from the given passphrase. By default, the PBKDF2 algorithm is used to generate the key ...
const char * apr_crypto_driver_name(const apr_crypto_driver_t *driver)
Return the name of the driver.
Definition: apr_crypto.h:109
Definition: apr_crypto.h:118
APR_DECLARE(apr_status_t) apr_crypto_memzero(void *buffer
Always zero out the buffer provided, without being optimized out by the compiler. ...
Definition: apr_crypto.h:110
apr_status_t apr_crypto_clear(apr_pool_t *pool, void *buffer, apr_size_t size)
Zero out the buffer provided when the pool is cleaned up.
Definition: apu_errno.h:161
apr_status_t apr_crypto_shutdown(const apr_crypto_driver_t *driver)
Shutdown the crypto library.
apr_status_t apr_crypto_block_encrypt_init(apr_crypto_block_t **ctx, const unsigned char **iv, const apr_crypto_key_t *key, apr_size_t *blockSize, apr_pool_t *p)
Initialise a context for encrypting arbitrary data using the given key.
apr_status_t apr_crypto_block_cleanup(apr_crypto_block_t *ctx)
Clean encryption / decryption context.
apr_status_t apr_crypto_block_encrypt(unsigned char **out, apr_size_t *outlen, const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx)
Encrypt data provided by in, write it to out.
apr_status_t apr_crypto_get_block_key_types(apr_hash_t **types, const apr_crypto_t *f)
Get a hash table of key types, keyed by the name of the type against a pointer to apr_crypto_block_ke...
apr_crypto_block_key_mode_e
Definition: apr_crypto.h:115
apr_status_t apr_crypto_init(apr_pool_t *pool)
Perform once-only initialisation. Call once only.
apr_status_t apr_crypto_block_encrypt_finish(unsigned char *out, apr_size_t *outlen, apr_crypto_block_t *ctx)
Encrypt final data block, write it to out.