Hi,

I am sure I am doing something wrong, but when using a dummy crypto
device to recreate a customer issue I am getting a similar issue in
httpd-trunk but I am nearly sure someone would have complained here if
that would be the case.

Comments

Jean-Frederic

The stack:
+++
(gdb) bt
#0  0x00007fac11198a98 in raise () from /lib64/libc.so.6
#1  0x00007fac1119a69a in abort () from /lib64/libc.so.6
#2  0x00007fac01f27e33 in dummy_init (e=<optimized out>) at e_dummy.c:146
#3  0x00007fac05a69509 in test_rc4_init_key () from /lib64/libcrypto.so.10
#4  0x00007fac05b3374c in ?? () from /lib64/libcrypto.so.10
#5  0x00007fac00000001 in ?? ()
#6  0x0000000000e37138 in ?? ()
#7  0x0000000000e62348 in ?? ()
#8  0x00007fac11d9d68a in apr_pool_cleanup_register (p=0x7fac05a6a122
<dynamic_ctrl+210>, data=0xfe4678, plain_cleanup_fn=0x1,
child_cleanup_fn=0x7fac05dab5c0)
    at memory/unix/apr_pools.c:2218
#9  0x0000000000f094c0 in ?? ()
#10 0x00007fac0625bf60 in ?? () from /home/jfclere/APACHE/modules/mod_ssl.so
#11 0x0000000000e60938 in ?? ()
#12 0x0000000000e62348 in ?? ()
#13 0x00007fac05a6ac58 in BUF_memdup () from /lib64/libcrypto.so.10
#14 0x00007fac06039af2 in ssl_init_Engine (s=0xe60938,
s@entry=0x7fffb9ad2e90, p=p@entry=0xe37138) at ssl_engine_init.c:386
#15 0x00007fac0603bdaf in ssl_init_Module (p=0xe37138, plog=<optimized
out>, ptemp=0xf09780, base_server=0x7fffb9ad2e90) at ssl_engine_init.c:242
#16 0x0000000000455153 in ap_run_post_config
(pconf=pconf@entry=0xe37138, plog=0xea0778, ptemp=0xe62348, s=0xe60938)
at config.c:103
#17 0x000000000042c575 in main (argc=3, argv=0x7fffb9ad3158) at main.c:788
+++
/* crypto/engine/e_chil.c -*- mode: C; c-file-style: "eay" -*- */
/* Written by Richard Levitte (rich...@levitte.org), Geoff Thorpe
 * (ge...@geoffthorpe.net) and Dr Stephen N Henson (st...@openssl.org)
 * for the OpenSSL project 2000.
 */
/* ====================================================================
 * Copyright (c) 1999-2001 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licens...@openssl.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (e...@cryptsoft.com).  This product includes software written by Tim
 * Hudson (t...@cryptsoft.com).
 *
 */

#include <stdio.h>
#include <string.h>
#include <openssl/crypto.h>
#include <openssl/pem.h>
#include <openssl/dso.h>
#include <openssl/engine.h>
#include <openssl/ui.h>
#include <openssl/rand.h>
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
#include <openssl/bn.h>

static int dummy_init(ENGINE *e);
static int dummy_finish(ENGINE *e);

static RSA_METHOD dummy_rsa;
static DH_METHOD dummy_dh;

/* Constants used when creating the ENGINE */
static const char *engine_dummy_id = "dummy";
static const char *engine_dummy_name = "Dummy hardware engine support";

/* Now, to our own code */

/* This internal function is used by ENGINE_dummy() and possibly by the
 * "dynamic" ENGINE support too */
static int bind_helper(ENGINE *e)
{
    const DH_METHOD *dh;
    const RSA_METHOD *rsa;

    rsa = RSA_get_default_method();
    memcpy(&dummy_rsa, rsa, sizeof dummy_rsa);
    dummy_rsa.name = "Dummy engine RSA method";
    
    dh = DH_OpenSSL();
    memcpy(&dummy_dh, dh, sizeof dummy_dh);
    dummy_dh.name = "Dummy engine DH method";
    
    if (!ENGINE_set_id(e, engine_dummy_id) ||
        !ENGINE_set_name(e, engine_dummy_name) ||
        !ENGINE_set_DH(e, &dummy_dh) ||
        !ENGINE_set_RSA(e, &dummy_rsa) ||
        !ENGINE_set_init_function(e, dummy_init) ||
        !ENGINE_set_finish_function(e, dummy_finish)) {
        return 0;
    }

    return 1;
}

#ifdef OPENSSL_NO_DYNAMIC_ENGINE
static ENGINE *engine_dummy(void)
	{
	ENGINE *ret = ENGINE_new();
	if(!ret)
		return NULL;
	if(!bind_helper(ret))
		{
		ENGINE_free(ret);
		return NULL;
		}
	return ret;
	}

void ENGINE_load_dummy(void)
	{
	/* Copied from eng_[openssl|dyn].c */
	ENGINE *toadd = engine_dummy();
	if(!toadd) return;
	ENGINE_add(toadd);
	ENGINE_free(toadd);
	ERR_clear_error();
	}
#endif

static int dummy_refcount;

/* (de)initialisation functions. */
static int dummy_init(ENGINE *e)
{
    if (dummy_refcount++ != 0) {
        abort();
    }
    fprintf(stderr, "dummy_init: Refcount now %d\n", dummy_refcount);
    return 1;
}

static int dummy_finish(ENGINE *e)
{
    dummy_refcount--;
    fprintf(stderr, "dummy_finish: Refcount now %d\n", dummy_refcount);
    return 1;
}

/* This stuff is needed if this ENGINE is being compiled into a self-contained
 * shared-library. */	   
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
static int bind_fn(ENGINE *e, const char *id)
{
    if(id && (strcmp(id, engine_dummy_id) != 0))
        return 0;
    if(!bind_helper(e))
        return 0;
    return 1;
}       
IMPLEMENT_DYNAMIC_CHECK_FN()
IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
#endif /* OPENSSL_NO_DYNAMIC_ENGINE */

Reply via email to