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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _MOD_CRYPTO_H_
18 #define _MOD_CRYPTO_H_
20 /* Create a set of CRYPTO_DECLARE(type), CRYPTO_DECLARE_NONSTD(type) and
21 * CRYPTO_DECLARE_DATA with appropriate export and import tags for the platform
24 #define CRYPTO_DECLARE(type) type
25 #define CRYPTO_DECLARE_NONSTD(type) type
26 #define CRYPTO_DECLARE_DATA
27 #elif defined(CRYPTO_DECLARE_STATIC)
28 #define CRYPTO_DECLARE(type) type __stdcall
29 #define CRYPTO_DECLARE_NONSTD(type) type
30 #define CRYPTO_DECLARE_DATA
31 #elif defined(CRYPTO_DECLARE_EXPORT)
32 #define CRYPTO_DECLARE(type) __declspec(dllexport) type __stdcall
33 #define CRYPTO_DECLARE_NONSTD(type) __declspec(dllexport) type
34 #define CRYPTO_DECLARE_DATA __declspec(dllexport)
36 #define CRYPTO_DECLARE(type) __declspec(dllimport) type __stdcall
37 #define CRYPTO_DECLARE_NONSTD(type) __declspec(dllimport) type
38 #define CRYPTO_DECLARE_DATA __declspec(dllimport)
43 * @brief Crypto Module for Apache
45 * @defgroup MOD_CRYPTO mod_crypto
46 * @ingroup APACHE_MODS
51 #include "apr_hooks.h"
52 #include "apr_optional.h"
53 #include "apr_tables.h"
55 #include "apr_pools.h"
57 #include "apr_crypto.h"
60 #include "http_config.h"
61 #include "ap_config.h"
64 * Hook to provide a key.
66 * @param r The request
67 * @param cipher The cipher to use with this key
68 * @param rec Pointer to the key record from which to derive the key
70 APR_DECLARE_EXTERNAL_HOOK(ap, CRYPTO, apr_status_t, crypto_key,
72 apr_crypto_block_key_type_t * cipher,
73 apr_crypto_block_key_mode_t * mode, int pad,
74 const apr_crypto_key_rec_t ** rec));
77 * Hook to provide an initialization vector (IV).
79 * @param r The request
80 * @param size The block size of the expected IV.
81 * @param iv A pointer to where the iv will be returned
83 APR_DECLARE_EXTERNAL_HOOK(ap, CRYPTO, apr_status_t, crypto_iv,
85 apr_crypto_block_key_type_t * cipher,
86 const unsigned char **iv));
89 * The name of the module.
91 extern module AP_MODULE_DECLARE_DATA crypto_module;