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.
20 _ __ ___ ___ __| | ___ ___| | mod_ssl
21 | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL
22 | | | | | | (_) | (_| | \__ \__ \ |
23 |_| |_| |_|\___/ \__,_|___|___/___/_|
26 * @file ssl_util_ssl.h
27 * @brief Additional Utility Functions for OpenSSL
29 * @defgroup MOD_SSL_UTIL Utilities
34 #ifndef __SSL_UTIL_SSL_H__
35 #define __SSL_UTIL_SSL_H__
38 * SSL library version number
41 #define MODSSL_LIBRARY_VERSION OPENSSL_VERSION_NUMBER
42 #define MODSSL_LIBRARY_NAME "OpenSSL"
43 #define MODSSL_LIBRARY_TEXT OPENSSL_VERSION_TEXT
44 #if MODSSL_USE_OPENSSL_PRE_1_1_API
45 #define MODSSL_LIBRARY_DYNTEXT SSLeay_version(SSLEAY_VERSION)
47 #define MODSSL_LIBRARY_DYNTEXT OpenSSL_version(OPENSSL_VERSION)
51 * Maximum length of a DER encoded session.
52 * FIXME: There is no define in OpenSSL, but OpenSSL uses 1024*10,
53 * so this value should be ok. Although we have no warm feeling.
55 #define MODSSL_SESSION_MAX_DER 1024*10
57 /** max length for modssl_SSL_SESSION_id2sz */
58 #define MODSSL_SESSION_ID_STRING_LEN \
59 ((SSL_MAX_SSL_SESSION_ID_LENGTH + 1) * 2)
62 * Additional Functions
64 void modssl_init_app_data2_idx(void);
65 void *modssl_get_app_data2(SSL *);
66 void modssl_set_app_data2(SSL *, void *);
67 EVP_PKEY *modssl_read_privatekey(const char *, EVP_PKEY **, pem_password_cb *, void *);
68 EVP_PKEY *modssl_read_encrypted_pkey(const char *, EVP_PKEY **, const char *, apr_size_t);
69 int modssl_smart_shutdown(SSL *ssl);
70 BOOL modssl_X509_getBC(X509 *, int *, int *);
71 char *modssl_X509_NAME_ENTRY_to_string(apr_pool_t *p, X509_NAME_ENTRY *xsne,
73 char *modssl_X509_NAME_to_string(apr_pool_t *, X509_NAME *, int);
74 BOOL modssl_X509_getSAN(apr_pool_t *, X509 *, int, const char *, int, apr_array_header_t **);
75 BOOL modssl_X509_match_name(apr_pool_t *, X509 *, const char *, BOOL, server_rec *);
76 char *modssl_SSL_SESSION_id2sz(IDCONST unsigned char *, int, char *, int);
78 #endif /* __SSL_UTIL_SSL_H__ */