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 #define MODSSL_LIBRARY_DYNTEXT SSLeay_version(SSLEAY_VERSION)
47 * Maximum length of a DER encoded session.
48 * FIXME: There is no define in OpenSSL, but OpenSSL uses 1024*10,
49 * so this value should be ok. Although we have no warm feeling.
51 #define MODSSL_SESSION_MAX_DER 1024*10
53 /** max length for MODSSL_SESSION_id2sz */
54 #define MODSSL_SESSION_ID_STRING_LEN \
55 ((SSL_MAX_SSL_SESSION_ID_LENGTH + 1) * 2)
58 * Additional Functions
60 void modssl_init_app_data2_idx(void);
61 void *modssl_get_app_data2(SSL *);
62 void modssl_set_app_data2(SSL *, void *);
63 EVP_PKEY *SSL_read_PrivateKey(const char *, EVP_PKEY **, pem_password_cb *, void *);
64 int SSL_smart_shutdown(SSL *ssl);
65 BOOL SSL_X509_getBC(X509 *, int *, int *);
66 char *SSL_ASN1_STRING_to_utf8(apr_pool_t *, ASN1_STRING *);
67 char *SSL_X509_NAME_ENTRY_to_string(apr_pool_t *p, X509_NAME_ENTRY *xsne);
68 char *SSL_X509_NAME_to_string(apr_pool_t *, X509_NAME *, int);
69 BOOL SSL_X509_getSAN(apr_pool_t *, X509 *, int, int, apr_array_header_t **);
70 BOOL SSL_X509_getIDs(apr_pool_t *, X509 *, apr_array_header_t **);
71 BOOL SSL_X509_match_name(apr_pool_t *, X509 *, const char *, BOOL, server_rec *);
72 BOOL SSL_X509_INFO_load_file(apr_pool_t *, STACK_OF(X509_INFO) *, const char *);
73 BOOL SSL_X509_INFO_load_path(apr_pool_t *, STACK_OF(X509_INFO) *, const char *);
74 int SSL_CTX_use_certificate_chain(SSL_CTX *, char *, int, pem_password_cb *);
75 char *SSL_SESSION_id2sz(unsigned char *, int, char *, int);
77 #endif /* __SSL_UTIL_SSL_H__ */