From abda7128d8ac980e4e30f53265b9189909b86291 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 27 Mar 2002 02:28:15 +0000 Subject: [PATCH] moving OpenSSL+sslc compat foo to ssl_toolkit_compat.h git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94199 13f79535-47bb-0310-9956-ffa450edef68 --- modules/ssl/mod_ssl.h | 54 ++--------------------------- modules/ssl/ssl_toolkit_compat.h | 58 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 52 deletions(-) create mode 100644 modules/ssl/ssl_toolkit_compat.h diff --git a/modules/ssl/mod_ssl.h b/modules/ssl/mod_ssl.h index ac05130603..4d2c20d37a 100644 --- a/modules/ssl/mod_ssl.h +++ b/modules/ssl/mod_ssl.h @@ -125,6 +125,8 @@ #include #endif +#include "ssl_toolkit_compat.h" + /* mod_ssl headers */ #include "ssl_expr.h" #include "ssl_util_ssl.h" @@ -324,60 +326,8 @@ typedef enum { #ifndef X509_V_ERR_CERT_UNTRUSTED #define X509_V_ERR_CERT_UNTRUSTED 27 - -#endif - -#ifdef OPENSSL_VERSION_NUMBER - -/* - * rsa sslc uses incomplete types for most structures - * so we macroize for OpenSSL those which cannot be dereferenced - * using the same sames as the sslc functions - */ - -#define EVP_PKEY_key_type(k) (EVP_PKEY_type(k->type)) - -#define X509_NAME_get_entries(xs) (xs->entries) -#define X509_REVOKED_get_serialNumber(xs) (xs->serialNumber) - -#define X509_get_signature_algorithm(xs) (xs->cert_info->signature->algorithm) -#define X509_get_key_algorithm(xs) (xs->cert_info->key->algor->algorithm) - -#define X509_NAME_ENTRY_get_data_ptr(xs) (xs->value->data) -#define X509_NAME_ENTRY_get_data_len(xs) (xs->value->length) - -#define SSL_CTX_get_extra_certs(ctx) (ctx->extra_certs) -#define SSL_CTX_set_extra_certs(ctx,value) {ctx->extra_certs = value;} - -#define SSL_CIPHER_get_name(s) (s->name) -#define SSL_CIPHER_get_valid(s) (s->valid) - -#define SSL_SESSION_get_session_id(s) (s->session_id) -#define SSL_SESSION_get_session_id_length(s) (s->session_id_length) - -/* - * Support for retrieving/overriding states - */ -#ifndef SSL_get_state -#define SSL_get_state(ssl) SSL_state(ssl) #endif -#define SSL_set_state(ssl,val) (ssl)->state = val - -#define MODSSL_BIO_CB_ARG_TYPE const char - -#else - -/* support some OpenSSL-izms for compat with ssl */ - -#ifndef STACK_OF -#define STACK_OF(type) STACK -#endif - -#define MODSSL_BIO_CB_ARG_TYPE char - -#endif /* OPENSSL_VERSION_NUMBER */ - #define ssl_verify_error_is_optional(errnum) \ ((errnum == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT) \ || (errnum == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) \ diff --git a/modules/ssl/ssl_toolkit_compat.h b/modules/ssl/ssl_toolkit_compat.h new file mode 100644 index 0000000000..db67a33e65 --- /dev/null +++ b/modules/ssl/ssl_toolkit_compat.h @@ -0,0 +1,58 @@ +#ifndef SSL_TOOLKIT_COMPAT_H +#define SSL_TOOLKIT_COMPAT_H + +/* + * this header file provides a compatiblity layer + * between OpenSSL and RSA sslc + */ + +#ifdef OPENSSL_VERSION_NUMBER + +/* + * rsa sslc uses incomplete types for most structures + * so we macroize for OpenSSL those which cannot be dereferenced + * using the same sames as the sslc functions + */ + +#define EVP_PKEY_key_type(k) (EVP_PKEY_type(k->type)) + +#define X509_NAME_get_entries(xs) (xs->entries) +#define X509_REVOKED_get_serialNumber(xs) (xs->serialNumber) + +#define X509_get_signature_algorithm(xs) (xs->cert_info->signature->algorithm) +#define X509_get_key_algorithm(xs) (xs->cert_info->key->algor->algorithm) + +#define X509_NAME_ENTRY_get_data_ptr(xs) (xs->value->data) +#define X509_NAME_ENTRY_get_data_len(xs) (xs->value->length) + +#define SSL_CTX_get_extra_certs(ctx) (ctx->extra_certs) +#define SSL_CTX_set_extra_certs(ctx,value) {ctx->extra_certs = value;} + +#define SSL_CIPHER_get_name(s) (s->name) +#define SSL_CIPHER_get_valid(s) (s->valid) + +#define SSL_SESSION_get_session_id(s) (s->session_id) +#define SSL_SESSION_get_session_id_length(s) (s->session_id_length) + +/* + * Support for retrieving/overriding states + */ +#ifndef SSL_get_state +#define SSL_get_state(ssl) SSL_state(ssl) +#endif + +#define SSL_set_state(ssl,val) (ssl)->state = val + +#define MODSSL_BIO_CB_ARG_TYPE const char + +#else /* RSA sslc */ + +#ifndef STACK_OF +#define STACK_OF(type) STACK +#endif + +#define MODSSL_BIO_CB_ARG_TYPE char + +#endif /* OPENSSL_VERSION_NUMBER */ + +#endif /* SSL_TOOLKIT_COMPAT_H */ -- 2.40.0