os/ossrv/ssl/libcrypto/src/crypto/dsa/dsa_depr.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/dsa/dsa_depr.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,106 @@
     1.4 +/* crypto/dsa/dsa_depr.c */
     1.5 +/* ====================================================================
     1.6 + * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + *
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer. 
    1.14 + *
    1.15 + * 2. Redistributions in binary form must reproduce the above copyright
    1.16 + *    notice, this list of conditions and the following disclaimer in
    1.17 + *    the documentation and/or other materials provided with the
    1.18 + *    distribution.
    1.19 + *
    1.20 + * 3. All advertising materials mentioning features or use of this
    1.21 + *    software must display the following acknowledgment:
    1.22 + *    "This product includes software developed by the OpenSSL Project
    1.23 + *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
    1.24 + *
    1.25 + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
    1.26 + *    endorse or promote products derived from this software without
    1.27 + *    prior written permission. For written permission, please contact
    1.28 + *    openssl-core@openssl.org.
    1.29 + *
    1.30 + * 5. Products derived from this software may not be called "OpenSSL"
    1.31 + *    nor may "OpenSSL" appear in their names without prior written
    1.32 + *    permission of the OpenSSL Project.
    1.33 + *
    1.34 + * 6. Redistributions of any form whatsoever must retain the following
    1.35 + *    acknowledgment:
    1.36 + *    "This product includes software developed by the OpenSSL Project
    1.37 + *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
    1.38 + *
    1.39 + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
    1.40 + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.41 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    1.42 + * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
    1.43 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.44 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    1.45 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    1.46 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.47 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    1.48 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.49 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    1.50 + * OF THE POSSIBILITY OF SUCH DAMAGE.
    1.51 + * ====================================================================
    1.52 + *
    1.53 + * This product includes cryptographic software written by Eric Young
    1.54 + * (eay@cryptsoft.com).  This product includes software written by Tim
    1.55 + * Hudson (tjh@cryptsoft.com).
    1.56 + *
    1.57 + */
    1.58 +
    1.59 +/* This file contains deprecated function(s) that are now wrappers to the new
    1.60 + * version(s). */
    1.61 +
    1.62 +#undef GENUINE_DSA
    1.63 +
    1.64 +#ifdef GENUINE_DSA
    1.65 +/* Parameter generation follows the original release of FIPS PUB 186,
    1.66 + * Appendix 2.2 (i.e. use SHA as defined in FIPS PUB 180) */
    1.67 +#define HASH    EVP_sha()
    1.68 +#else
    1.69 +/* Parameter generation follows the updated Appendix 2.2 for FIPS PUB 186,
    1.70 + * also Appendix 2.2 of FIPS PUB 186-1 (i.e. use SHA as defined in
    1.71 + * FIPS PUB 180-1) */
    1.72 +#define HASH    EVP_sha1()
    1.73 +#endif 
    1.74 +
    1.75 +static void *dummy=&dummy;
    1.76 +
    1.77 +#ifndef OPENSSL_NO_SHA
    1.78 +
    1.79 +#include <stdio.h>
    1.80 +#include <time.h>
    1.81 +#include "cryptlib.h"
    1.82 +#include <openssl/evp.h>
    1.83 +#include <openssl/bn.h>
    1.84 +#include <openssl/dsa.h>
    1.85 +#include <openssl/rand.h>
    1.86 +#include <openssl/sha.h>
    1.87 +
    1.88 +#ifndef OPENSSL_NO_DEPRECATED
    1.89 +EXPORT_C DSA *DSA_generate_parameters(int bits,
    1.90 +		unsigned char *seed_in, int seed_len,
    1.91 +		int *counter_ret, unsigned long *h_ret,
    1.92 +		void (*callback)(int, int, void *),
    1.93 +		void *cb_arg)
    1.94 +	{
    1.95 +	BN_GENCB cb;
    1.96 +	DSA *ret;
    1.97 +
    1.98 +	if ((ret=DSA_new()) == NULL) return NULL;
    1.99 +
   1.100 +	BN_GENCB_set_old(&cb, callback, cb_arg);
   1.101 +
   1.102 +	if(DSA_generate_parameters_ex(ret, bits, seed_in, seed_len,
   1.103 +				counter_ret, h_ret, &cb))
   1.104 +		return ret;
   1.105 +	DSA_free(ret);
   1.106 +	return NULL;
   1.107 +	}
   1.108 +#endif
   1.109 +#endif