Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_crypto_internal.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APR_CRYPTO_INTERNAL_H
18 #define APR_CRYPTO_INTERNAL_H
19 
20 #include <stdarg.h>
21 
22 #include "apr_crypto.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #if APU_HAVE_CRYPTO
29 
33 typedef struct cprng_stream_ctx_t cprng_stream_ctx_t;
34 
38 #define CPRNG_KEY_SIZE 32
39 
40 struct apr_crypto_driver_t {
41 
43  const char *name;
44 
52  apr_status_t (*init)(apr_pool_t *pool, const char *params,
53  const apu_err_t **result);
54 
68  const char *params, apr_pool_t *pool);
69 
78  apr_status_t (*get_block_key_digests)(apr_hash_t **types,
79  const apr_crypto_t *f);
80 
89  apr_status_t (*get_block_key_types)(apr_hash_t **types,
90  const apr_crypto_t *f);
91 
100  apr_status_t (*get_block_key_modes)(apr_hash_t **modes,
101  const apr_crypto_t *f);
102 
131  apr_status_t (*passphrase)(apr_crypto_key_t **key, apr_size_t *ivSize,
132  const char *pass, apr_size_t passLen, const unsigned char * salt,
133  apr_size_t saltLen, const apr_crypto_block_key_type_e type,
134  const apr_crypto_block_key_mode_e mode, const int doPad,
135  const int iterations, const apr_crypto_t *f, apr_pool_t *p);
136 
153  apr_status_t (*block_encrypt_init)(apr_crypto_block_t **ctx,
154  const unsigned char **iv, const apr_crypto_key_t *key,
155  apr_size_t *blockSize, apr_pool_t *p);
156 
175  apr_status_t (*block_encrypt)(unsigned char **out, apr_size_t *outlen,
176  const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx);
177 
196  apr_status_t (*block_encrypt_finish)(unsigned char *out,
197  apr_size_t *outlen, apr_crypto_block_t *ctx);
198 
214  apr_status_t (*block_decrypt_init)(apr_crypto_block_t **ctx,
215  apr_size_t *blockSize, const unsigned char *iv,
216  const apr_crypto_key_t *key, apr_pool_t *p);
217 
236  apr_status_t (*block_decrypt)(unsigned char **out, apr_size_t *outlen,
237  const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx);
238 
257  apr_status_t (*block_decrypt_finish)(unsigned char *out,
258  apr_size_t *outlen, apr_crypto_block_t *ctx);
259 
274  apr_status_t (*digest_init)(apr_crypto_digest_t **d,
276 
286  apr_status_t (*digest_update)(apr_crypto_digest_t *digest,
287  const unsigned char *in, apr_size_t inlen);
288 
300  apr_status_t (*digest_final)(apr_crypto_digest_t *digest);
301 
314  apr_status_t (*digest)(const apr_crypto_key_t *key,
315  apr_crypto_digest_rec_t *rec, const unsigned char *in,
316  apr_size_t inlen, apr_pool_t *p);
317 
324  apr_status_t (*block_cleanup)(apr_crypto_block_t *ctx);
325 
332  apr_status_t (*digest_cleanup)(apr_crypto_digest_t *ctx);
333 
340  apr_status_t (*cleanup)(apr_crypto_t *f);
341 
348 
355  apr_status_t (*error)(const apu_err_t **result, const apr_crypto_t *f);
356 
373  apr_status_t (*key)(apr_crypto_key_t **key, const apr_crypto_key_rec_t *rec,
374  const apr_crypto_t *f, apr_pool_t *p);
375 
383  apr_status_t (*cprng_stream_ctx_make)(cprng_stream_ctx_t **pctx, apr_crypto_t *f,
385 
390  void (*cprng_stream_ctx_free)(cprng_stream_ctx_t *ctx);
391 
400  apr_status_t (*cprng_stream_ctx_bytes)(cprng_stream_ctx_t **pctx, unsigned char *key,
401  unsigned char *to, apr_size_t n, const unsigned char *z);
402 
403 };
404 
405 #endif
406 
407 #ifdef __cplusplus
408 }
409 #endif
410 
411 #endif
apr_crypto_cipher_e
Definition: apr_crypto.h:164
size_t apr_size_t
Definition: apr.h:393
Definition: apr_crypto.h:442
struct apr_crypto_key_t apr_crypto_key_t
Definition: apr_crypto.h:197
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:555
struct apr_crypto_t apr_crypto_t
Definition: apr_crypto.h:183
struct apr_crypto_digest_t apr_crypto_digest_t
Definition: apr_crypto.h:213
apr_crypto_block_key_mode_e
Definition: apr_crypto.h:127
Definition: apr_crypto.h:497
APR-UTIL Crypto library.
struct apr_crypto_driver_t apr_crypto_driver_t
Definition: apr_crypto.h:176
#define shutdown
Definition: apr_arch_os2calls.h:55
apr_crypto_block_key_type_e
Definition: apr_crypto.h:115
struct apr_crypto_block_t apr_crypto_block_t
Definition: apr_crypto.h:206
struct apr_hash_t apr_hash_t
Definition: apr_hash.h:52
apr_pool_t * p
const char const dav_options_provider * provider
Definition: mod_dav.h:2704
const char * name
Definition: mod_dav.h:805
Definition: apu_errno.h:169
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
typedef void(APR_THREAD_FUNC *PFN_HSE_IO_COMPLETION)(EXTENSION_CONTROL_BLOCK *ecb
int apr_status_t
Definition: apr_errno.h:44