os/ossrv/ssl/libcrypto/src/crypto/engine/tb_store.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ssl/libcrypto/src/crypto/engine/tb_store.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,134 @@
     1.4 +/* ====================================================================
     1.5 + * Copyright (c) 2003 The OpenSSL Project.  All rights reserved.
     1.6 + *
     1.7 + * Redistribution and use in source and binary forms, with or without
     1.8 + * modification, are permitted provided that the following conditions
     1.9 + * are met:
    1.10 + *
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer. 
    1.13 + *
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in
    1.16 + *    the documentation and/or other materials provided with the
    1.17 + *    distribution.
    1.18 + *
    1.19 + * 3. All advertising materials mentioning features or use of this
    1.20 + *    software must display the following acknowledgment:
    1.21 + *    "This product includes software developed by the OpenSSL Project
    1.22 + *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
    1.23 + *
    1.24 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
    1.25 + *    endorse or promote products derived from this software without
    1.26 + *    prior written permission. For written permission, please contact
    1.27 + *    licensing@OpenSSL.org.
    1.28 + *
    1.29 + * 5. Products derived from this software may not be called "OpenSSL"
    1.30 + *    nor may "OpenSSL" appear in their names without prior written
    1.31 + *    permission of the OpenSSL Project.
    1.32 + *
    1.33 + * 6. Redistributions of any form whatsoever must retain the following
    1.34 + *    acknowledgment:
    1.35 + *    "This product includes software developed by the OpenSSL Project
    1.36 + *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
    1.37 + *
    1.38 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
    1.39 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.40 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.41 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
    1.42 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.43 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    1.44 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    1.45 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.46 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    1.47 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.48 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    1.49 + * OF THE POSSIBILITY OF SUCH DAMAGE.
    1.50 + * ====================================================================
    1.51 + *
    1.52 + * This product includes cryptographic software written by Eric Young
    1.53 + * (eay@cryptsoft.com).  This product includes software written by Tim
    1.54 + * Hudson (tjh@cryptsoft.com).
    1.55 + *
    1.56 + */
    1.57 + /*
    1.58 + © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
    1.59 + */
    1.60 +
    1.61 +#include "eng_int.h"
    1.62 +#if (defined(SYMBIAN) && (defined(__WINSCW__) || defined(__WINS__)))
    1.63 +#include "libcrypto_wsd_macros.h"
    1.64 +#include "libcrypto_wsd.h"
    1.65 +#endif
    1.66 +/* If this symbol is defined then ENGINE_get_default_STORE(), the function that is
    1.67 + * used by STORE to hook in implementation code and cache defaults (etc), will
    1.68 + * display brief debugging summaries to stderr with the 'nid'. */
    1.69 +/* #define ENGINE_STORE_DEBUG */
    1.70 +#ifndef EMULATOR
    1.71 +static ENGINE_TABLE *store_table = NULL;
    1.72 +#else
    1.73 +GET_STATIC_VAR_FROM_TLS(store_table,tb_store,ENGINE_TABLE *)
    1.74 +#define store_table (*GET_WSD_VAR_NAME(store_table,tb_store, s)())
    1.75 +#endif
    1.76 +
    1.77 +static const int dummy_nid = 1;
    1.78 +
    1.79 +EXPORT_C void ENGINE_unregister_STORE(ENGINE *e)
    1.80 +	{
    1.81 +	engine_table_unregister(&store_table, e);
    1.82 +	}
    1.83 +
    1.84 +static void engine_unregister_all_STORE(void)
    1.85 +	{
    1.86 +	engine_table_cleanup(&store_table);
    1.87 +	}
    1.88 +
    1.89 +EXPORT_C int ENGINE_register_STORE(ENGINE *e)
    1.90 +	{
    1.91 +	if(e->store_meth)
    1.92 +		return engine_table_register(&store_table,
    1.93 +				engine_unregister_all_STORE, e, &dummy_nid, 1, 0);
    1.94 +	return 1;
    1.95 +	}
    1.96 +
    1.97 +EXPORT_C void ENGINE_register_all_STORE()
    1.98 +	{
    1.99 +	ENGINE *e;
   1.100 +
   1.101 +	for(e=ENGINE_get_first() ; e ; e=ENGINE_get_next(e))
   1.102 +		ENGINE_register_STORE(e);
   1.103 +	}
   1.104 +
   1.105 +/* The following two functions are removed because they're useless. */
   1.106 +#if 0
   1.107 +int ENGINE_set_default_STORE(ENGINE *e)
   1.108 +	{
   1.109 +	if(e->store_meth)
   1.110 +		return engine_table_register(&store_table,
   1.111 +				engine_unregister_all_STORE, e, &dummy_nid, 1, 1);
   1.112 +	return 1;
   1.113 +	}
   1.114 +#endif
   1.115 +
   1.116 +#if 0
   1.117 +/* Exposed API function to get a functional reference from the implementation
   1.118 + * table (ie. try to get a functional reference from the tabled structural
   1.119 + * references). */
   1.120 +ENGINE *ENGINE_get_default_STORE(void)
   1.121 +	{
   1.122 +	return engine_table_select(&store_table, dummy_nid);
   1.123 +	}
   1.124 +#endif
   1.125 +
   1.126 +/* Obtains an STORE implementation from an ENGINE functional reference */
   1.127 +EXPORT_C const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e)
   1.128 +	{
   1.129 +	return e->store_meth;
   1.130 +	}
   1.131 +
   1.132 +/* Sets an STORE implementation in an ENGINE structure */
   1.133 +EXPORT_C int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth)
   1.134 +	{
   1.135 +	e->store_meth = store_meth;
   1.136 +	return 1;
   1.137 +	}