Apache Portable Runtime Utility Library
|
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, int *rc); 00043 00056 apr_status_t (*make)(apr_crypto_t **f, const apr_crypto_driver_t *provider, 00057 const char *params, apr_pool_t *pool); 00058 00067 apr_status_t (*get_block_key_types)(apr_hash_t **types, 00068 const apr_crypto_t *f); 00069 00078 apr_status_t (*get_block_key_modes)(apr_hash_t **modes, 00079 const apr_crypto_t *f); 00080 00109 apr_status_t (*passphrase)(apr_crypto_key_t **key, apr_size_t *ivSize, 00110 const char *pass, apr_size_t passLen, const unsigned char * salt, 00111 apr_size_t saltLen, const apr_crypto_block_key_type_e type, 00112 const apr_crypto_block_key_mode_e mode, const int doPad, 00113 const int iterations, const apr_crypto_t *f, apr_pool_t *p); 00114 00131 apr_status_t (*block_encrypt_init)(apr_crypto_block_t **ctx, 00132 const unsigned char **iv, const apr_crypto_key_t *key, 00133 apr_size_t *blockSize, apr_pool_t *p); 00134 00153 apr_status_t (*block_encrypt)(unsigned char **out, apr_size_t *outlen, 00154 const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx); 00155 00174 apr_status_t (*block_encrypt_finish)(unsigned char *out, 00175 apr_size_t *outlen, apr_crypto_block_t *ctx); 00176 00192 apr_status_t (*block_decrypt_init)(apr_crypto_block_t **ctx, 00193 apr_size_t *blockSize, const unsigned char *iv, 00194 const apr_crypto_key_t *key, apr_pool_t *p); 00195 00214 apr_status_t (*block_decrypt)(unsigned char **out, apr_size_t *outlen, 00215 const unsigned char *in, apr_size_t inlen, apr_crypto_block_t *ctx); 00216 00235 apr_status_t (*block_decrypt_finish)(unsigned char *out, 00236 apr_size_t *outlen, apr_crypto_block_t *ctx); 00237 00244 apr_status_t (*block_cleanup)(apr_crypto_block_t *ctx); 00245 00252 apr_status_t (*cleanup)(apr_crypto_t *f); 00253 00259 apr_status_t (*shutdown)(void); 00260 00267 apr_status_t (*error)(const apu_err_t **result, const apr_crypto_t *f); 00268 00269 }; 00270 00271 #endif 00272 00273 #ifdef __cplusplus 00274 } 00275 #endif 00276 00277 #endif