/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* _ _
* _ __ ___ ___ __| | ___ ___| | mod_ssl
* | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL
* | | | | | | (_) | (_| | \__ \__ \ |
* |_| |_| |_|\___/ \__,_|___|___/___/_|
* |_____|
* Utility Functions
*/
/* ``Every day of my life
I am forced to add another
name to the list of people
who piss me off!''
-- Calvin */
#include "ssl_private.h"
#include "ap_mpm.h"
#include "apr_thread_mutex.h"
/* _________________________________________________________________
**
** Utility Functions
** _________________________________________________________________
*/
{
char *id;
char *host;
host = s->server_hostname;
if (s->port != 0)
else {
sc = mySrvConfig(s);
else
}
return id;
}
const char * const *argv)
{
return NULL;
return NULL;
return NULL;
return NULL;
return NULL;
}
{
return;
}
/*
* Run a filter program and read the first line of its stdout output
*/
const char * const *argv)
{
char c;
int k;
return NULL;
/* XXX: we are reading 1 byte at a time here */
if (c == '\n' || c == '\r')
break;
buf[k++] = c;
}
ssl_util_ppclose(s, p, fp);
return buf;
}
{
return FALSE;
APR_FINFO_TYPE|APR_FINFO_SIZE, p) != 0)
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return TRUE;
}
/*
* certain key data needs to survive restarts,
* which are stored in the user data table of s->process->pool.
* rather than apr_palloc and these wrappers to help make sure
* we do not leak the malloc-ed data.
*/
const char *key,
long int length)
{
/*
* if a value for this key already exists,
* reuse as much of the already malloc-ed data
* as possible.
*/
if (asn1) {
}
}
else {
}
}
}
const char *key)
{
}
const char *key)
{
if (!asn1) {
return;
}
}
}
#if APR_HAS_THREADS
/*
* To ensure thread-safetyness in OpenSSL - work in progress
*/
static int lock_num_locks;
{
if (type < lock_num_locks) {
if (mode & CRYPTO_LOCK) {
}
else {
}
}
}
/* Dynamic lock structure */
struct CRYPTO_dynlock_value {
const char* file;
int line;
};
/* Global reference to the pool passed into ssl_util_thread_setup() */
/*
* Dynamic lock creation callback
*/
int line)
{
apr_pool_t *p;
/*
* We need a pool to allocate our mutex. Since we can't clear
* allocated memory from a pool, create a subpool that we can blow
* away in the destruction callback.
*/
apr_pool_create(&p, dynlockpool);
"Creating dynamic lock");
/* Keep our own copy of the place from which we were created,
using our own pool. */
p);
if (rv != APR_SUCCESS) {
"Failed to create thread mutex for dynamic lock");
apr_pool_destroy(p);
return NULL;
}
return value;
}
/*
* Dynamic locking and unlocking function
*/
{
if (mode & CRYPTO_LOCK) {
}
else {
}
}
/*
* Dynamic lock destruction callback
*/
{
if (rv != APR_SUCCESS) {
}
/* Trust that whomever owned the CRYPTO_dynlock_value we were
* passed has no future use for it...
*/
apr_pool_destroy(l->pool);
}
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
{
/* OpenSSL needs this to return an unsigned long. On OS/390, the pthread
* id is a structure twice that big. Use the TCB pointer instead as a
* unique unsigned long.
*/
#ifdef __MVS__
struct PSA {
unsigned long PSATOLD;
} *psaptr = 0;
#else
#endif
}
#else
static unsigned long ssl_util_thr_id(void)
{
/* OpenSSL needs this to return an unsigned long. On OS/390, the pthread
* id is a structure twice that big. Use the TCB pointer instead as a
* unique unsigned long.
*/
#ifdef __MVS__
struct PSA {
unsigned long PSATOLD;
} *psaptr = 0;
#else
return (unsigned long) apr_os_thread_current();
#endif
}
#endif
{
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#else
#endif
dynlockpool = NULL;
/* Let the registered mutex cleanups do their own thing
*/
return APR_SUCCESS;
}
{
int i;
for (i = 0; i < lock_num_locks; i++) {
}
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#else
#endif
/* Set up dynamic locking scaffolding for OpenSSL to use at its
* convenience.
*/
dynlockpool = p;
}
#endif