Apache Portable Runtime Utility Library

include/private/apr_crypto_internal.h

00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_CRYPTO_INTERNAL_H
00018 #define APR_CRYPTO_INTERNAL_H
00019 
00020 #include <stdarg.h>
00021 
00022 #include "apr_crypto.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 #if APU_HAVE_CRYPTO
00029 
00030 struct apr_crypto_driver_t {
00031 
00033     const char *name;
00034 
00042     apr_status_t (*init)(apr_pool_t *pool, const char *params,
00043             const apu_err_t **result);
00044 
00057     apr_status_t (*make)(apr_crypto_t **f, const apr_crypto_driver_t *provider,
00058             const char *params, apr_pool_t *pool);
00059 
00068     apr_status_t (*get_block_key_types)(apr_hash_t **types,
00069             const apr_crypto_t *f);
00070 
00079     apr_status_t (*get_block_key_modes)(apr_hash_t **modes,
00080             const apr_crypto_t *f);
00081 
00110     apr_status_t (*passphrase)(apr_crypto_key_t **key, apr_size_t *ivSize,
00111             const char *pass, apr_size_t passLen, const unsigned char * salt,
00112             apr_size_t saltLen, const apr_crypto_block_key_type_e type,
00113             const apr_crypto_block_key_mode_e mode, const int doPad,
00114             const int iterations, const apr_crypto_t *f, apr_pool_t *p);
00115 
00132     apr_status_t (*block_encrypt_init)(apr_crypto_block_t **ctx,
00133             const unsigned char **iv, const apr_crypto_key_t *key,
00134             apr_size_t *blockSize, apr_pool_t *p);
00135 
00154     apr_status_t (*block_encrypt)(unsigned char **out, apr_size_t *outlen,
00155             const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx);
00156 
00175     apr_status_t (*block_encrypt_finish)(unsigned char *out,
00176             apr_size_t *outlen, apr_crypto_block_t *ctx);
00177 
00193     apr_status_t (*block_decrypt_init)(apr_crypto_block_t **ctx,
00194             apr_size_t *blockSize, const unsigned char *iv,
00195             const apr_crypto_key_t *key, apr_pool_t *p);
00196 
00215     apr_status_t (*block_decrypt)(unsigned char **out, apr_size_t *outlen,
00216             const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx);
00217 
00236     apr_status_t (*block_decrypt_finish)(unsigned char *out,
00237             apr_size_t *outlen, apr_crypto_block_t *ctx);
00238 
00245     apr_status_t (*block_cleanup)(apr_crypto_block_t *ctx);
00246 
00253     apr_status_t (*cleanup)(apr_crypto_t *f);
00254 
00260     apr_status_t (*shutdown)(void);
00261 
00268     apr_status_t (*error)(const apu_err_t **result, const apr_crypto_t *f);
00269 
00286     apr_status_t (*key)(apr_crypto_key_t **key, const apr_crypto_key_rec_t *rec,
00287             const apr_crypto_t *f, apr_pool_t *p);
00288 
00289 };
00290 
00291 #endif
00292 
00293 #ifdef __cplusplus
00294 }
00295 #endif
00296 
00297 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines