$NetBSD: patch-bl,v 1.1.1.1 2012/03/21 20:48:53 asau Exp $ --- source/libs/comm/cl_ssl_framework.c.orig 2009-02-16 08:50:41.000000000 +0000 +++ source/libs/comm/cl_ssl_framework.c @@ -104,6 +104,9 @@ #define OPENSSL_CONST const #endif +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10000000L +typedef _STACK STACK; +#endif #define cl_com_ssl_func__SSL_CTX_set_mode(ctx,op) \ cl_com_ssl_func__SSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL) @@ -161,8 +164,8 @@ static int (*cl_com_ssl static void (*cl_com_ssl_func__SSL_set_bio) (SSL *s, BIO *rbio,BIO *wbio); static int (*cl_com_ssl_func__SSL_accept) (SSL *ssl); static void (*cl_com_ssl_func__SSL_CTX_free) (SSL_CTX *); -static SSL_CTX* (*cl_com_ssl_func__SSL_CTX_new) (SSL_METHOD *meth); -static SSL_METHOD* (*cl_com_ssl_func__SSLv23_method) (void); +static SSL_CTX* (*cl_com_ssl_func__SSL_CTX_new) (const SSL_METHOD *meth); +static const SSL_METHOD* (*cl_com_ssl_func__SSLv23_method) (void); static int (*cl_com_ssl_func__SSL_CTX_use_certificate_chain_file) (SSL_CTX *ctx, const char *file); static int (*cl_com_ssl_func__SSL_CTX_use_certificate) (SSL_CTX *ctx, X509 *cert); static int (*cl_com_ssl_func__SSL_CTX_use_PrivateKey_file) (SSL_CTX *ctx, const char *file, int type); @@ -243,9 +246,9 @@ static void (*cl_com_ssl static void (*cl_com_ssl_func__X509_STORE_CTX_set_error) (X509_STORE_CTX *ctx,int s); static void (*cl_com_ssl_func__X509_OBJECT_free_contents) (X509_OBJECT *a); static ASN1_INTEGER* (*cl_com_ssl_func__X509_get_serialNumber) (X509 *x); -static int (*cl_com_ssl_func__X509_cmp_current_time) (ASN1_TIME *s); -static int (*cl_com_ssl_func__ASN1_INTEGER_cmp) (ASN1_INTEGER *x, ASN1_INTEGER *y); -static long (*cl_com_ssl_func__ASN1_INTEGER_get) (ASN1_INTEGER *a); +static int (*cl_com_ssl_func__X509_cmp_current_time) (const ASN1_TIME *s); +static int (*cl_com_ssl_func__ASN1_INTEGER_cmp) (const ASN1_INTEGER *x, const ASN1_INTEGER *y); +static long (*cl_com_ssl_func__ASN1_INTEGER_get) (const ASN1_INTEGER *a); static int (*cl_com_ssl_func__X509_CRL_verify) (X509_CRL *a, EVP_PKEY *r); static EVP_PKEY* (*cl_com_ssl_func__X509_get_pubkey) (X509 *x); static int (*cl_com_ssl_func__X509_STORE_set_default_paths) (X509_STORE *ctx); @@ -1040,7 +1043,7 @@ static int cl_com_ssl_build_symbol_table { char* func_name = NULL; int had_errors = 0; -#if defined(FREEBSD) || defined(DARWIN) +#if defined(NETBSD) || defined(FREEBSD) || defined(DARWIN) void* cl_com_ssl_crypto_handle_saved = NULL; #endif @@ -1062,7 +1065,7 @@ static int cl_com_ssl_build_symbol_table cl_com_ssl_crypto_handle = dlopen ("libssl.dylib", RTLD_NOW | RTLD_GLOBAL ); #endif /* RTLD_NODELETE */ -#elif defined(FREEBSD) +#elif defined(NETBSD) || defined(FREEBSD) #ifdef RTLD_NODELETE cl_com_ssl_crypto_handle = dlopen ("libssl.so", RTLD_LAZY | RTLD_GLOBAL | RTLD_NODELETE); #else @@ -1091,7 +1094,7 @@ static int cl_com_ssl_build_symbol_table return CL_RETVAL_SSL_DLOPEN_SSL_LIB_FAILED; } -#if defined(FREEBSD) || defined(DARWIN) +#if defined(NETBSD) || defined(FREEBSD) || defined(DARWIN) cl_com_ssl_crypto_handle_saved = cl_com_ssl_crypto_handle; cl_com_ssl_crypto_handle = RTLD_DEFAULT; #endif @@ -1204,14 +1207,14 @@ static int cl_com_ssl_build_symbol_table } func_name = "SSL_CTX_new"; - cl_com_ssl_func__SSL_CTX_new = (SSL_CTX* (*)(SSL_METHOD *meth))dlsym(cl_com_ssl_crypto_handle, func_name); + cl_com_ssl_func__SSL_CTX_new = (SSL_CTX* (*)(const SSL_METHOD *meth))dlsym(cl_com_ssl_crypto_handle, func_name); if (cl_com_ssl_func__SSL_CTX_new == NULL) { CL_LOG_STR(CL_LOG_ERROR,"dlsym error: can't get function address:", func_name); had_errors++; } func_name = "SSLv23_method"; - cl_com_ssl_func__SSLv23_method = (SSL_METHOD* (*)(void))dlsym(cl_com_ssl_crypto_handle, func_name); + cl_com_ssl_func__SSLv23_method = (const SSL_METHOD* (*)(void))dlsym(cl_com_ssl_crypto_handle, func_name); if (cl_com_ssl_func__SSLv23_method == NULL) { CL_LOG_STR(CL_LOG_ERROR,"dlsym error: can't get function address:", func_name); had_errors++; @@ -1750,21 +1753,21 @@ static int cl_com_ssl_build_symbol_table } func_name = "X509_cmp_current_time"; - cl_com_ssl_func__X509_cmp_current_time = (int (*)(ASN1_TIME *s))dlsym(cl_com_ssl_crypto_handle, func_name); + cl_com_ssl_func__X509_cmp_current_time = (int (*)(const ASN1_TIME *s))dlsym(cl_com_ssl_crypto_handle, func_name); if (cl_com_ssl_func__X509_cmp_current_time == NULL) { CL_LOG_STR(CL_LOG_ERROR,"dlsym error: can't get function address:", func_name); had_errors++; } func_name = "ASN1_INTEGER_cmp"; - cl_com_ssl_func__ASN1_INTEGER_cmp = (int (*)(ASN1_INTEGER *x, ASN1_INTEGER *y))dlsym(cl_com_ssl_crypto_handle, func_name); + cl_com_ssl_func__ASN1_INTEGER_cmp = (int (*)(const ASN1_INTEGER *x, const ASN1_INTEGER *y))dlsym(cl_com_ssl_crypto_handle, func_name); if (cl_com_ssl_func__ASN1_INTEGER_cmp == NULL) { CL_LOG_STR(CL_LOG_ERROR,"dlsym error: can't get function address:", func_name); had_errors++; } func_name = "ASN1_INTEGER_get"; - cl_com_ssl_func__ASN1_INTEGER_get = (long (*)(ASN1_INTEGER *a))dlsym(cl_com_ssl_crypto_handle, func_name); + cl_com_ssl_func__ASN1_INTEGER_get = (long (*)(const ASN1_INTEGER *a))dlsym(cl_com_ssl_crypto_handle, func_name); if (cl_com_ssl_func__ASN1_INTEGER_get == NULL) { CL_LOG_STR(CL_LOG_ERROR,"dlsym error: can't get function address:", func_name); had_errors++; @@ -1813,7 +1816,7 @@ static int cl_com_ssl_build_symbol_table return CL_RETVAL_SSL_CANT_LOAD_ALL_FUNCTIONS; } -#if defined(FREEBSD) +#if defined(FREEBSD) || defined(NETBSD) cl_com_ssl_crypto_handle = cl_com_ssl_crypto_handle_saved; #endif @@ -1918,7 +1921,7 @@ static int cl_com_ssl_build_symbol_table cl_com_ssl_func__SSL_CTX_get_ex_data = (void* (*)(SSL_CTX *ssl,int idx))SSL_CTX_get_ex_data; cl_com_ssl_func__SSL_CTX_set_ex_data = SSL_CTX_set_ex_data; cl_com_ssl_func__sk_num = sk_num; - cl_com_ssl_func__sk_value = sk_value; + cl_com_ssl_func__sk_value = (char* (*)(const STACK *, int))sk_value; cl_com_ssl_func__X509_STORE_get_by_subject = X509_STORE_get_by_subject; cl_com_ssl_func__EVP_PKEY_free = EVP_PKEY_free; cl_com_ssl_func__X509_STORE_CTX_set_error = X509_STORE_CTX_set_error;