From ec90f1a1d6a4dc7af1fbe166fbb2bd69fb0ca53b Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Sat, 10 Jun 2000 16:53:53 +0000 Subject: [PATCH] revived openssl sha1 code to get the project to compile again. it is needed by openssl/dsa_gen.c, as that file is currently written. this might not be what is ultimately desired, but was the quickest way to have a working system again. --- lib/dns/Makefile.in | 1 + lib/dns/sec/openssl/Makefile.in | 12 ++--- lib/dns/sec/openssl/sha1_one.c | 79 +++++++++++++++++++++++++++++++++ lib/dns/sec/openssl/sha1dgst.c | 76 +++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+), 5 deletions(-) create mode 100644 lib/dns/sec/openssl/sha1_one.c create mode 100644 lib/dns/sec/openssl/sha1dgst.c diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index 9595d9c3e8..05660376af 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -65,6 +65,7 @@ OPENSSLOBJS = sec/openssl/bn_add.@O@ sec/openssl/bn_asm.@O@ \ sec/openssl/err.@O@ sec/openssl/ex_data.@O@ \ sec/openssl/lhash.@O@ sec/openssl/mem_dbg.@O@ \ sec/openssl/mem.@O@ sec/openssl/rand_lib.@O@ \ + sec/openssl/sha1_one.@O@ sec/openssl/sha1dgst.@O@ \ sec/openssl/stack.@O@ sec/openssl/th-lock.@O@ DNSSAFEOBJS = sec/dnssafe/ahchdig.@O@ sec/dnssafe/ahchencr.@O@ \ diff --git a/lib/dns/sec/openssl/Makefile.in b/lib/dns/sec/openssl/Makefile.in index 73e03ffd76..7f454010a1 100644 --- a/lib/dns/sec/openssl/Makefile.in +++ b/lib/dns/sec/openssl/Makefile.in @@ -34,17 +34,19 @@ OBJS = bn_add.@O@ bn_asm.@O@ bn_ctx.@O@ bn_div.@O@ \ dh_lib.@O@ dsa_asn1.@O@ dsa_err.@O@ dsa_gen.@O@ \ dsa_key.@O@ dsa_lib.@O@ dsa_ossl.@O@ dsa_sign.@O@ \ dsa_vrf.@O@ err.@O@ ex_data.@O@ lhash.@O@ \ - mem.@O@ mem_dbg.@O@ rand_lib.@O@ stack.@O@ th-lock.@O@ + mem.@O@ mem_dbg.@O@ rand_lib.@O@ sha1_one.@O@ sha1dgst.@O@ \ + stack.@O@ th-lock.@O@ SRCS = bn_add.c bn_asm.c bn_ctx.c bn_div.c \ bn_err.c bn_exp.c bn_exp2.c bn_gcd.c \ bn_lib.c bn_mont.c bn_mul.c \ bn_prime.c bn_print.c bn_rand.c bn_recp.c \ bn_shift.c bn_sqr.c bn_word.c buffer.c \ - cryptlib.c dh_err.c dh_gen.c dh_key.c dh_lib.c \ - dsa_asn1.c dsa_err.c dsa_gen.c \ - dsa_key.c dsa_lib.c dsa_ossl.c dsa_sign.c dsa_vrf.c \ - err.c ex_data.c lhash.c mem.c mem_dbg.c rand_lib.c \ + cryptlib.c dh_err.c dh_gen.c dh_key.c \ + dh_lib.c dsa_asn1.c dsa_err.c dsa_gen.c \ + dsa_key.c dsa_lib.c dsa_ossl.c dsa_sign.c \ + dsa_vrf.c err.c ex_data.c lhash.c \ + mem.c mem_dbg.c rand_lib.c sha1_one.c sha1dgst.c \ stack.c th-lock.c SUBDIRS = include diff --git a/lib/dns/sec/openssl/sha1_one.c b/lib/dns/sec/openssl/sha1_one.c new file mode 100644 index 0000000000..63de73c8ee --- /dev/null +++ b/lib/dns/sec/openssl/sha1_one.c @@ -0,0 +1,79 @@ +/* crypto/sha/sha1_one.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "../rename.h" + +#include +#include +#include + +#ifndef NO_SHA1 +unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md) + { + SHA_CTX c; + static unsigned char m[SHA_DIGEST_LENGTH]; + + if (md == NULL) md=m; + SHA1_Init(&c); + SHA1_Update(&c,d,n); + SHA1_Final(md,&c); + memset(&c,0,sizeof(c)); + return(md); + } +#endif diff --git a/lib/dns/sec/openssl/sha1dgst.c b/lib/dns/sec/openssl/sha1dgst.c new file mode 100644 index 0000000000..c35159b473 --- /dev/null +++ b/lib/dns/sec/openssl/sha1dgst.c @@ -0,0 +1,76 @@ +/* crypto/sha/sha1dgst.c */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * 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 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 acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS 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 AUTHOR OR 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. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#if !defined(NO_SHA1) && !defined(NO_SHA) + +#undef SHA_0 +#define SHA_1 + +#include +#include "../rename.h" + +#include + +const char *SHA1_version="SHA1" OPENSSL_VERSION_PTEXT; + +/* The implementation is in ../md32_common.h */ + +#include "sha_locl.h" + +#endif +