Apache Portable Runtime Utility Library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_crypto_internal.h
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 
30 struct apr_crypto_driver_t {
31 
33  const char *name;
34 
42  apr_status_t (*init)(apr_pool_t *pool, const char *params, int *rc);
43 
56  apr_status_t (*make)(apr_crypto_t **f, const apr_crypto_driver_t *provider,
57  const char *params, apr_pool_t *pool);
58 
67  apr_status_t (*get_block_key_types)(apr_hash_t **types,
68  const apr_crypto_t *f);
69 
78  apr_status_t (*get_block_key_modes)(apr_hash_t **modes,
79  const apr_crypto_t *f);
80 
109  apr_status_t (*passphrase)(apr_crypto_key_t **key, apr_size_t *ivSize,
110  const char *pass, apr_size_t passLen, const unsigned char * salt,
111  apr_size_t saltLen, const apr_crypto_block_key_type_e type,
112  const apr_crypto_block_key_mode_e mode, const int doPad,
113  const int iterations, const apr_crypto_t *f, apr_pool_t *p);
114 
131  apr_status_t (*block_encrypt_init)(apr_crypto_block_t **ctx,
132  const unsigned char **iv, const apr_crypto_key_t *key,
133  apr_size_t *blockSize, apr_pool_t *p);
134 
153  apr_status_t (*block_encrypt)(unsigned char **out, apr_size_t *outlen,
154  const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx);
155 
174  apr_status_t (*block_encrypt_finish)(unsigned char *out,
175  apr_size_t *outlen, apr_crypto_block_t *ctx);
176 
192  apr_status_t (*block_decrypt_init)(apr_crypto_block_t **ctx,
193  apr_size_t *blockSize, const unsigned char *iv,
194  const apr_crypto_key_t *key, apr_pool_t *p);
195 
214  apr_status_t (*block_decrypt)(unsigned char **out, apr_size_t *outlen,
215  const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx);
216 
235  apr_status_t (*block_decrypt_finish)(unsigned char *out,
236  apr_size_t *outlen, apr_crypto_block_t *ctx);
237 
244  apr_status_t (*block_cleanup)(apr_crypto_block_t *ctx);
245 
252  apr_status_t (*cleanup)(apr_crypto_t *f);
253 
259  apr_status_t (*shutdown)(void);
260 
267  apr_status_t (*error)(const apu_err_t **result, const apr_crypto_t *f);
268 
269 };
270 
271 #endif
272 
273 #ifdef __cplusplus
274 }
275 #endif
276 
277 #endif
apr_crypto_block_key_type_e
Definition: apr_crypto.h:102
APR-UTIL Crypto library.
Definition: apu_errno.h:161
apr_crypto_block_key_mode_e
Definition: apr_crypto.h:111