ssl_util.c revision 5d59b45268c4cd29c489e897e14b31e77f276b05
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard/* Licensed to the Apache Software Foundation (ASF) under one or more
095e49b99a1a9a4604e5750771e062c061cd12bdwrowe * contributor license agreements. See the NOTICE file distributed with
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * this work for additional information regarding copyright ownership.
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * The ASF licenses this file to You under the Apache License, Version 2.0
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * (the "License"); you may not use this file except in compliance with
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * the License. You may obtain a copy of the License at
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * Unless required by applicable law or agreed to in writing, software
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * distributed under the License is distributed on an "AS IS" BASIS,
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * See the License for the specific language governing permissions and
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * limitations under the License.
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * _ __ ___ ___ __| | ___ ___| | mod_ssl
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * | | | | | | (_) | (_| | \__ \__ \ |
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * |_| |_| |_|\___/ \__,_|___|___/___/_|
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard * Utility Functions
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard /* ``Every day of my life
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard I am forced to add another
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard name to the list of people
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard who piss me off!''
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard -- Calvin */
4e06302d1825b2a21dfe3ac998ff14e9a40927d7wrowe/* _________________________________________________________________
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard** Utility Functions
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard** _________________________________________________________________
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard if (s->port != 0)
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard id = apr_psprintf(p, "%s:%lu", host, (unsigned long)port);
4e06302d1825b2a21dfe3ac998ff14e9a40927d7wroweapr_file_t *ssl_util_ppopen(server_rec *s, apr_pool_t *p, const char *cmd,
fb929740692fe796b467212ec57aa34cebb562cfwrowe const char * const *argv)
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard if (apr_procattr_create(&procattr, p) != APR_SUCCESS)
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard if (apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_FULL_BLOCK,
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard if (apr_procattr_cmdtype_set(procattr, APR_PROGRAM) != APR_SUCCESS)
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard if (apr_proc_create(proc, cmd, argv, NULL, procattr, p) != APR_SUCCESS)
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddardvoid ssl_util_ppclose(server_rec *s, apr_pool_t *p, apr_file_t *fp)
43681d859fe7d4cd90a33d6be2232192c108de75wrowe * Run a filter program and read the first line of its stdout output
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddardchar *ssl_util_readfilter(server_rec *s, apr_pool_t *p, const char *cmd,
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard const char * const *argv)
8e117661fd51fd19d6430fca8d7ae87c67d6de20stoddard if ((fp = ssl_util_ppopen(s, p, cmd, argv)) == NULL)
43681d859fe7d4cd90a33d6be2232192c108de75wrowe /* XXX: we are reading 1 byte at a time here */
43681d859fe7d4cd90a33d6be2232192c108de75wrowe for (k = 0; apr_file_read(fp, &c, &nbytes) == APR_SUCCESS
buf[k++] = c;
return buf;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return FALSE;
return TRUE;
ssl_algo_t t;
t = SSL_ALGO_UNKNOWN;
case EVP_PKEY_RSA:
t = SSL_ALGO_RSA;
case EVP_PKEY_DSA:
t = SSL_ALGO_DSA;
#ifdef HAVE_ECC
case EVP_PKEY_EC:
t = SSL_ALGO_ECC;
char *cp;
case SSL_ALGO_RSA:
case SSL_ALGO_DSA:
#ifdef HAVE_ECC
case SSL_ALGO_ECC:
return cp;
const char *key,
long int length)
if (asn1) {
const char *key)
const char *key)
if (!asn1) {
#ifdef HAVE_ECC
return NULL;
const char *id,
int keytype)
#if APR_HAS_THREADS
static int lock_num_locks;
struct CRYPTO_dynlock_value {
const char* file;
int line;
int line)
apr_pool_t *p;
apr_pool_destroy(p);
return NULL;
return value;
#ifdef __MVS__
struct PSA {
unsigned long PSATOLD;
} *psaptr = 0;
static unsigned long ssl_util_thr_id(void)
#ifdef __MVS__
struct PSA {
unsigned long PSATOLD;
} *psaptr = 0;
return (unsigned long) apr_os_thread_current();
return APR_SUCCESS;
for (i = 0; i < lock_num_locks; i++) {
dynlockpool = p;