summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha
diff options
context:
space:
mode:
authordjm <>2010-10-01 22:54:19 +0000
committerdjm <>2010-10-01 22:54:19 +0000
commit242690ab2a8e991b85b4735c4e0bac0ec7bd3481 (patch)
treea55c90bd6ea9329d2afb5540220340cadd107178 /src/lib/libcrypto/sha
parent5d1f64994b96668ba794f5211364ed54dd7ee08d (diff)
downloadopenbsd-242690ab2a8e991b85b4735c4e0bac0ec7bd3481.tar.gz
openbsd-242690ab2a8e991b85b4735c4e0bac0ec7bd3481.tar.bz2
openbsd-242690ab2a8e991b85b4735c4e0bac0ec7bd3481.zip
import OpenSSL-1.0.0a
Diffstat (limited to 'src/lib/libcrypto/sha')
-rw-r--r--src/lib/libcrypto/sha/Makefile75
-rw-r--r--src/lib/libcrypto/sha/sha_dgst.c6
-rw-r--r--src/lib/libcrypto/sha/shatest.c4
3 files changed, 39 insertions, 46 deletions
diff --git a/src/lib/libcrypto/sha/Makefile b/src/lib/libcrypto/sha/Makefile
index f4741b9ee6..e6eccb05f9 100644
--- a/src/lib/libcrypto/sha/Makefile
+++ b/src/lib/libcrypto/sha/Makefile
@@ -38,25 +38,16 @@ top:
38all: lib 38all: lib
39 39
40lib: $(LIBOBJ) 40lib: $(LIBOBJ)
41 $(ARX) $(LIB) $(LIBOBJ) 41 $(AR) $(LIB) $(LIBOBJ)
42 $(RANLIB) $(LIB) || echo Never mind. 42 $(RANLIB) $(LIB) || echo Never mind.
43 @touch lib 43 @touch lib
44 44
45# ELF 45sha1-586.s: asm/sha1-586.pl ../perlasm/x86asm.pl
46sx86-elf.s: asm/sha1-586.pl ../perlasm/x86asm.pl 46 $(PERL) asm/sha1-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
47 (cd asm; $(PERL) sha1-586.pl elf $(CFLAGS) $(PROCESSOR) > ../$@) 47sha256-586.s: asm/sha256-586.pl ../perlasm/x86asm.pl
48s512sse2-elf.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl 48 $(PERL) asm/sha256-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
49 (cd asm; $(PERL) sha512-sse2.pl elf $(CFLAGS) $(PROCESSOR) > ../$@) 49sha512-586.s: asm/sha512-586.pl ../perlasm/x86asm.pl
50# COFF 50 $(PERL) asm/sha512-586.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
51sx86-cof.s: asm/sha1-586.pl ../perlasm/x86asm.pl
52 (cd asm; $(PERL) sha1-586.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
53s512sse2-cof.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
54 (cd asm; $(PERL) sha512-sse2.pl coff $(CFLAGS) $(PROCESSOR) > ../$@)
55# a.out
56sx86-out.s: asm/sha1-586.pl ../perlasm/x86asm.pl
57 (cd asm; $(PERL) sha1-586.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
58s512sse2-out.s: asm/sha512-sse2.pl ../perlasm/x86asm.pl
59 (cd asm; $(PERL) sha512-sse2.pl a.out $(CFLAGS) $(PROCESSOR) > ../$@)
60 51
61sha1-ia64.s: asm/sha1-ia64.pl 52sha1-ia64.s: asm/sha1-ia64.pl
62 (cd asm; $(PERL) sha1-ia64.pl ../$@ $(CFLAGS)) 53 (cd asm; $(PERL) sha1-ia64.pl ../$@ $(CFLAGS))
@@ -65,10 +56,25 @@ sha256-ia64.s: asm/sha512-ia64.pl
65sha512-ia64.s: asm/sha512-ia64.pl 56sha512-ia64.s: asm/sha512-ia64.pl
66 (cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS)) 57 (cd asm; $(PERL) sha512-ia64.pl ../$@ $(CFLAGS))
67 58
59sha256-armv4.s: asm/sha256-armv4.pl
60 $(PERL) $< $@
61
68# Solaris make has to be explicitly told 62# Solaris make has to be explicitly told
69sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $@ 63sha1-x86_64.s: asm/sha1-x86_64.pl; $(PERL) asm/sha1-x86_64.pl $(PERLASM_SCHEME) > $@
70sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $@ 64sha256-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
71sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $@ 65sha512-x86_64.s:asm/sha512-x86_64.pl; $(PERL) asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
66sha1-sparcv9.s: asm/sha1-sparcv9.pl; $(PERL) asm/sha1-sparcv9.pl $@ $(CFLAGS)
67sha256-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS)
68sha512-sparcv9.s:asm/sha512-sparcv9.pl; $(PERL) asm/sha512-sparcv9.pl $@ $(CFLAGS)
69
70sha1-ppc.s: asm/sha1-ppc.pl; $(PERL) asm/sha1-ppc.pl $(PERLASM_SCHEME) $@
71sha256-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@
72sha512-ppc.s: asm/sha512-ppc.pl; $(PERL) asm/sha512-ppc.pl $(PERLASM_SCHEME) $@
73
74# GNU make "catch all"
75sha1-%.s: asm/sha1-%.pl; $(PERL) $< $@
76sha256-%.s: asm/sha512-%.pl; $(PERL) $< $@
77sha512-%.s: asm/sha512-%.pl; $(PERL) $< $@
72 78
73files: 79files:
74 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO 80 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
@@ -113,31 +119,24 @@ sha1_one.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
113sha1_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 119sha1_one.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
114sha1_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 120sha1_one.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
115sha1_one.o: sha1_one.c 121sha1_one.o: sha1_one.c
116sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/fips.h 122sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
117sha1dgst.o: ../../include/openssl/opensslconf.h
118sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h 123sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h
119sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h 124sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h
120sha256.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 125sha256.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
121sha256.o: ../../include/openssl/fips.h ../../include/openssl/opensslconf.h 126sha256.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
122sha256.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h 127sha256.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
123sha256.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h 128sha256.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
124sha256.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 129sha256.o: ../../include/openssl/symhacks.h ../md32_common.h sha256.c
125sha256.o: ../md32_common.h sha256.c
126sha512.o: ../../e_os.h ../../include/openssl/bio.h 130sha512.o: ../../e_os.h ../../include/openssl/bio.h
127sha512.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h 131sha512.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
128sha512.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 132sha512.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
129sha512.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h 133sha512.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
130sha512.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 134sha512.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
131sha512.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h 135sha512.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
132sha512.o: ../../include/openssl/sha.h ../../include/openssl/stack.h 136sha512.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
133sha512.o: ../../include/openssl/symhacks.h ../cryptlib.h sha512.c 137sha512.o: ../cryptlib.h sha512.c
134sha_dgst.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h 138sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
135sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h 139sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h
136sha_dgst.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h
137sha_dgst.o: ../../include/openssl/opensslconf.h
138sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
139sha_dgst.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
140sha_dgst.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
141sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h 140sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h
142sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h 141sha_one.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
143sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 142sha_one.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c
index 598f4d721a..70eb56032c 100644
--- a/src/lib/libcrypto/sha/sha_dgst.c
+++ b/src/lib/libcrypto/sha/sha_dgst.c
@@ -57,12 +57,6 @@
57 */ 57 */
58 58
59#include <openssl/opensslconf.h> 59#include <openssl/opensslconf.h>
60#include <openssl/crypto.h>
61#ifdef OPENSSL_FIPS
62#include <openssl/fips.h>
63#endif
64
65#include <openssl/err.h>
66#if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) 60#if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA)
67 61
68#undef SHA_1 62#undef SHA_1
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c
index ed0fe06a7b..27614646d1 100644
--- a/src/lib/libcrypto/sha/shatest.c
+++ b/src/lib/libcrypto/sha/shatest.c
@@ -123,9 +123,9 @@ int main(int argc, char *argv[])
123 i=1; 123 i=1;
124 while (*P != NULL) 124 while (*P != NULL)
125 { 125 {
126 EVP_Digest(*P,strlen((char *)*P),md,NULL,EVP_sha(), NULL); 126 EVP_Digest(*P,strlen(*P),md,NULL,EVP_sha(), NULL);
127 p=pt(md); 127 p=pt(md);
128 if (strcmp(p,(char *)*R) != 0) 128 if (strcmp(p,*R) != 0)
129 { 129 {
130 printf("error calculating SHA on '%s'\n",*P); 130 printf("error calculating SHA on '%s'\n",*P);
131 printf("got %s instead of %s\n",p,*R); 131 printf("got %s instead of %s\n",p,*R);