diff options
Diffstat (limited to 'src/lib/libcrypto/lhash')
| -rw-r--r-- | src/lib/libcrypto/lhash/Makefile | 88 | ||||
| -rw-r--r-- | src/lib/libcrypto/lhash/lh_test.c | 88 | ||||
| -rw-r--r-- | src/lib/libcrypto/lhash/num.pl | 17 |
3 files changed, 193 insertions, 0 deletions
diff --git a/src/lib/libcrypto/lhash/Makefile b/src/lib/libcrypto/lhash/Makefile new file mode 100644 index 0000000000..82bddac474 --- /dev/null +++ b/src/lib/libcrypto/lhash/Makefile | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/lhash/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= lhash | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=lhash.c lh_stats.c | ||
| 21 | LIBOBJ=lhash.o lh_stats.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= lhash.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 44 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 45 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 46 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 47 | |||
| 48 | install: | ||
| 49 | @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile... | ||
| 50 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 51 | do \ | ||
| 52 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 53 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 54 | done; | ||
| 55 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 73 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 74 | |||
| 75 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 76 | |||
| 77 | lh_stats.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 78 | lh_stats.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 79 | lh_stats.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 80 | lh_stats.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 81 | lh_stats.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 82 | lh_stats.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 83 | lh_stats.o: ../../include/openssl/symhacks.h ../cryptlib.h lh_stats.c | ||
| 84 | lhash.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h | ||
| 85 | lhash.o: ../../include/openssl/e_os2.h ../../include/openssl/lhash.h | ||
| 86 | lhash.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 87 | lhash.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 88 | lhash.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h lhash.c | ||
diff --git a/src/lib/libcrypto/lhash/lh_test.c b/src/lib/libcrypto/lhash/lh_test.c new file mode 100644 index 0000000000..85700c859b --- /dev/null +++ b/src/lib/libcrypto/lhash/lh_test.c | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* crypto/lhash/lh_test.c */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include <stdio.h> | ||
| 60 | #include <stdlib.h> | ||
| 61 | #include <string.h> | ||
| 62 | #include <openssl/lhash.h> | ||
| 63 | |||
| 64 | main() | ||
| 65 | { | ||
| 66 | LHASH *conf; | ||
| 67 | char buf[256]; | ||
| 68 | int i; | ||
| 69 | |||
| 70 | conf=lh_new(lh_strhash,strcmp); | ||
| 71 | for (;;) | ||
| 72 | { | ||
| 73 | char *p; | ||
| 74 | |||
| 75 | buf[0]='\0'; | ||
| 76 | fgets(buf,256,stdin); | ||
| 77 | if (buf[0] == '\0') break; | ||
| 78 | i=strlen(buf); | ||
| 79 | p=OPENSSL_malloc(i+1); | ||
| 80 | memcpy(p,buf,i+1); | ||
| 81 | lh_insert(conf,p); | ||
| 82 | } | ||
| 83 | |||
| 84 | lh_node_stats(conf,stdout); | ||
| 85 | lh_stats(conf,stdout); | ||
| 86 | lh_node_usage_stats(conf,stdout); | ||
| 87 | exit(0); | ||
| 88 | } | ||
diff --git a/src/lib/libcrypto/lhash/num.pl b/src/lib/libcrypto/lhash/num.pl new file mode 100644 index 0000000000..30fedf9cd5 --- /dev/null +++ b/src/lib/libcrypto/lhash/num.pl | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | #node 10 -> 4 | ||
| 4 | |||
| 5 | while (<>) | ||
| 6 | { | ||
| 7 | next unless /^node/; | ||
| 8 | chop; | ||
| 9 | @a=split; | ||
| 10 | $num{$a[3]}++; | ||
| 11 | } | ||
| 12 | |||
| 13 | @a=sort {$a <=> $b } keys %num; | ||
| 14 | foreach (0 .. $a[$#a]) | ||
| 15 | { | ||
| 16 | printf "%4d:%4d\n",$_,$num{$_}; | ||
| 17 | } | ||
