From cb1fe7f9bbab7c09c483bac964f4d045b91aec66 Mon Sep 17 00:00:00 2001 From: Zhanna Tsitkov Date: Wed, 30 Sep 2009 22:33:41 +0000 Subject: [PATCH] Crypto modularity proj: SHS_INFO structure is defined differently for crypto impl's. Files hash_sha1.c and yhash.h are affected by this difference. Move hash_provider into the backend The following bigredbutton is used to suppress svn complains about the trailing spaces in the moved/copied dirs. bigredbutton: whitespace git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22815 dc483132-0cff-0310-8789-dd5450dbe970 --- src/Makefile.in | 6 +- src/configure.in | 2 +- src/lib/crypto/Makefile.in | 4 +- src/lib/crypto/builtin/Makefile.in | 16 ++++- src/lib/crypto/builtin/deps | 2 +- .../hash_provider/Makefile.in | 6 +- .../{krb => builtin}/hash_provider/deps | 2 +- .../hash_provider/hash_crc32.c | 0 .../{krb => builtin}/hash_provider/hash_md4.c | 0 .../{krb => builtin}/hash_provider/hash_md5.c | 0 .../hash_provider/hash_provider.h | 0 .../hash_provider/hash_sha1.c | 0 .../crypto/{krb/yarrow => builtin}/yhash.h | 0 src/lib/crypto/crypto_tests/Makefile.in | 2 +- src/lib/crypto/krb/Makefile.in | 19 ++---- src/lib/crypto/krb/deps | 6 +- .../crypto/krb/keyhash_provider/Makefile.in | 2 +- src/lib/crypto/krb/keyhash_provider/deps | 4 +- src/lib/crypto/krb/prf/Makefile.in | 1 + src/lib/crypto/krb/prf/deps | 2 +- src/lib/crypto/krb/yarrow/Makefile.in | 5 +- src/lib/crypto/krb/yarrow/deps | 4 +- src/lib/crypto/krb/yarrow/yarrow.c | 1 - src/lib/crypto/krb/yarrow/yarrow.h | 2 +- .../crypto/openssl/hash_provider/hash_crc32.c | 56 +++++++++++++++++ .../crypto/openssl/hash_provider/hash_md4.c | 56 +++++++++++++++++ .../crypto/openssl/hash_provider/hash_md5.c | 56 +++++++++++++++++ .../openssl/hash_provider/hash_provider.h | 32 ++++++++++ .../crypto/openssl/hash_provider/hash_sha1.c | 61 +++++++++++++++++++ src/lib/crypto/openssl/hmac.c | 2 +- src/lib/crypto/openssl/sha1/shs.c | 18 +++--- src/lib/crypto/openssl/sha1/shs.h | 8 +-- src/lib/crypto/openssl/yhash.h | 30 +++++++++ 33 files changed, 351 insertions(+), 54 deletions(-) rename src/lib/crypto/{krb => builtin}/hash_provider/Makefile.in (81%) rename src/lib/crypto/{krb => builtin}/hash_provider/deps (97%) rename src/lib/crypto/{krb => builtin}/hash_provider/hash_crc32.c (100%) rename src/lib/crypto/{krb => builtin}/hash_provider/hash_md4.c (100%) rename src/lib/crypto/{krb => builtin}/hash_provider/hash_md5.c (100%) rename src/lib/crypto/{krb => builtin}/hash_provider/hash_provider.h (100%) rename src/lib/crypto/{krb => builtin}/hash_provider/hash_sha1.c (100%) rename src/lib/crypto/{krb/yarrow => builtin}/yhash.h (100%) create mode 100644 src/lib/crypto/openssl/hash_provider/hash_crc32.c create mode 100644 src/lib/crypto/openssl/hash_provider/hash_md4.c create mode 100644 src/lib/crypto/openssl/hash_provider/hash_md5.c create mode 100644 src/lib/crypto/openssl/hash_provider/hash_provider.h create mode 100644 src/lib/crypto/openssl/hash_provider/hash_sha1.c create mode 100644 src/lib/crypto/openssl/yhash.h diff --git a/src/Makefile.in b/src/Makefile.in index 3ac3dc4e3..e5be6e164 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -196,7 +196,7 @@ WINMAKEFILES=Makefile \ lib\Makefile lib\crypto\Makefile \ lib\crypto\krb\crc32\Makefile lib\crypto\builtin\des\Makefile \ lib\crypto\krb\dk\Makefile lib\crypto\builtin\enc_provider\Makefile \ - lib\crypto\krb\hash_provider\Makefile \ + lib\crypto\builtin\hash_provider\Makefile \ lib\crypto\krb\keyhash_provider\Makefile \ lib\crypto\krb\prf\Makefile lib\crypto\krb\rand2key\Makefile \ lib\crypto\krb\raw\Makefile lib\crypto\krb\old\Makefile \ @@ -271,7 +271,7 @@ WINMAKEFILES=Makefile \ ##DOS## $(WCONFIG) config < $@.in > $@ ##DOS##lib\crypto\builtin\enc_provider\Makefile: lib\crypto\builtin\enc_provider\Makefile.in $(MKFDEP) ##DOS## $(WCONFIG) config < $@.in > $@ -##DOS##lib\crypto\krb\hash_provider\Makefile: lib\crypto\krb\hash_provider\Makefile.in $(MKFDEP) +##DOS##lib\crypto\builtin\hash_provider\Makefile: lib\crypto\builtin\hash_provider\Makefile.in $(MKFDEP) ##DOS## $(WCONFIG) config < $@.in > $@ ##DOS##lib\crypto\krb\keyhash_provider\Makefile: lib\crypto\krb\keyhash_provider\Makefile.in $(MKFDEP) ##DOS## $(WCONFIG) config < $@.in > $@ @@ -396,7 +396,7 @@ FILES= ./* \ config/* include/* include/kerberosIV/* \ include/krb5/* include/krb5/stock/* include/sys/* lib/* \ lib/crypto/* lib/crypto/krb/crc32/* lib/crypto/builtin/des/* lib/crypto/krb/dk/* \ - lib/crypto/builtin/enc_provider/* lib/crypto/krb/hash_provider/* \ + lib/crypto/builtin/enc_provider/* lib/crypto/builtin/hash_provider/* \ lib/crypto/krb/keyhash_provider/* \ lib/crypto/krb/prf/* lib/crypto/krb/rand2key/* \ lib/crypto/krb/old/* lib/crypto/krb/raw/* \ diff --git a/src/configure.in b/src/configure.in index 8773ee17d..415115172 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1061,7 +1061,7 @@ V5_AC_OUTPUT_MAKEFILE(. lib/crypto lib/crypto/krb lib/crypto/krb/crc32 lib/crypto/builtin/des lib/crypto/krb/dk lib/crypto/builtin/enc_provider - lib/crypto/krb/hash_provider lib/crypto/krb/keyhash_provider + lib/crypto/builtin/hash_provider lib/crypto/krb/keyhash_provider lib/crypto/krb/prf lib/crypto/krb/rand2key lib/crypto/builtin lib/crypto/builtin/md4 lib/crypto/builtin/md5 lib/crypto/krb/old lib/crypto/krb/raw lib/crypto/builtin/sha1 diff --git a/src/lib/crypto/Makefile.in b/src/lib/crypto/Makefile.in index 3a3bab5ff..b89619f4f 100644 --- a/src/lib/crypto/Makefile.in +++ b/src/lib/crypto/Makefile.in @@ -21,7 +21,7 @@ LIBFINIFUNC=cryptoint_cleanup_library RELDIR=crypto STOBJLISTS=krb/crc32/OBJS.ST krb/dk/OBJS.ST builtin/enc_provider/OBJS.ST \ - krb/hash_provider/OBJS.ST krb/keyhash_provider/OBJS.ST \ + builtin/hash_provider/OBJS.ST krb/keyhash_provider/OBJS.ST \ krb/prf/OBJS.ST krb/rand2key/OBJS.ST \ krb/old/OBJS.ST krb/raw/OBJS.ST krb/yarrow/OBJS.ST \ builtin/md4/OBJS.ST builtin/md5/OBJS.ST builtin/sha1/OBJS.ST \ @@ -29,7 +29,7 @@ STOBJLISTS=krb/crc32/OBJS.ST krb/dk/OBJS.ST builtin/enc_provider/OBJS.ST \ krb/OBJS.ST builtin/OBJS.ST SUBDIROBJLISTS=krb/crc32/OBJS.ST krb/dk/OBJS.ST builtin/enc_provider/OBJS.ST \ - krb/hash_provider/OBJS.ST krb/keyhash_provider/OBJS.ST \ + builtin/hash_provider/OBJS.ST krb/keyhash_provider/OBJS.ST \ krb/prf/OBJS.ST krb/rand2key/OBJS.ST \ krb/old/OBJS.ST krb/raw/OBJS.ST krb/yarrow/OBJS.ST \ builtin/md4/OBJS.ST builtin/md5/OBJS.ST builtin/sha1/OBJS.ST \ diff --git a/src/lib/crypto/builtin/Makefile.in b/src/lib/crypto/builtin/Makefile.in index eae7da270..deccbd647 100644 --- a/src/lib/crypto/builtin/Makefile.in +++ b/src/lib/crypto/builtin/Makefile.in @@ -2,7 +2,7 @@ thisconfigdir=../../.. myfulldir=lib/crypto/builtin mydir=lib/crypto/builtin BUILDTOP=$(REL)..$(S)..$(S).. -SUBDIRS=des arcfour aes md4 md5 sha1 enc_provider +SUBDIRS=des arcfour aes md4 md5 sha1 enc_provider hash_provider LOCALINCLUDES = -I$(srcdir)/../krb \ -I$(srcdir)/../krb/hash_provider \ -I$(srcdir)/../@CRYPTO_IMPL@/des \ @@ -11,7 +11,8 @@ LOCALINCLUDES = -I$(srcdir)/../krb \ -I$(srcdir)/../@CRYPTO_IMPL@/sha1 \ -I$(srcdir)/../@CRYPTO_IMPL@/md4 \ -I$(srcdir)/../@CRYPTO_IMPL@/md5 \ - -I$(srcdir)/../@CRYPTO_IMPL@/enc_provider + -I$(srcdir)/../@CRYPTO_IMPL@/enc_provider \ + -I$(srcdir)/../@CRYPTO_IMPL@/hash_provider PROG_LIBPATH=-L$(TOPLIBD) PROG_RPATH=$(KRB5_LIBDIR) DEFS= @@ -38,6 +39,7 @@ SRCS=\ STOBJLISTS= des/OBJS.ST md4/OBJS.ST \ md5/OBJS.ST sha1/OBJS.ST \ enc_provider/OBJS.ST \ + hash_provider/OBJS.ST \ arcfour/OBJS.ST \ aes/OBJS.ST \ OBJS.ST @@ -45,6 +47,7 @@ STOBJLISTS= des/OBJS.ST md4/OBJS.ST \ SUBDIROBJLISTS= des/OBJS.ST md4/OBJS.ST \ md5/OBJS.ST sha1/OBJS.ST \ enc_provider/OBJS.ST \ + hash_provider/OBJS.ST \ arcfour/OBJS.ST \ aes/OBJS.ST @@ -70,6 +73,9 @@ all-windows:: cd ..\sha1 @echo Making in crypto\sha1 $(MAKE) -$(MFLAGS) + cd ..\hash_provider + @echo Making in crypto\hash_provider + $(MAKE) -$(MFLAGS) cd ..\enc_provider @echo Making in crypto\enc_provider $(MAKE) -$(MFLAGS) @@ -94,6 +100,9 @@ clean-windows:: cd ..\sha1 @echo Making clean in crypto\sha1 $(MAKE) -$(MFLAGS) clean + cd ..\hash_provider + @echo Making clean in crypto\hash_provider + $(MAKE) -$(MFLAGS) clean cd ..\enc_provider @echo Making clean in crypto\enc_provider $(MAKE) -$(MFLAGS) clean @@ -118,6 +127,9 @@ check-windows:: cd ..\sha1 @echo Making check in crypto\sha1 $(MAKE) -$(MFLAGS) check + cd ..\hash_provider + @echo Making check in crypto\hash_provider + $(MAKE) -$(MFLAGS) check cd ..\enc_provider @echo Making check in crypto\enc_provider $(MAKE) -$(MFLAGS) check diff --git a/src/lib/crypto/builtin/deps b/src/lib/crypto/builtin/deps index fb4163ea6..55016e958 100644 --- a/src/lib/crypto/builtin/deps +++ b/src/lib/crypto/builtin/deps @@ -21,4 +21,4 @@ pbkdf2.so pbkdf2.po $(OUTPRE)pbkdf2.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/krb5.h \ $(SRCTOP)/include/krb5/locate_plugin.h $(SRCTOP)/include/krb5/preauth_plugin.h \ $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(srcdir)/../builtin/pbkdf2.c $(srcdir)/../krb/hash_provider/hash_provider.h + $(srcdir)/../builtin/pbkdf2.c $(srcdir)/../builtin/hash_provider/hash_provider.h diff --git a/src/lib/crypto/krb/hash_provider/Makefile.in b/src/lib/crypto/builtin/hash_provider/Makefile.in similarity index 81% rename from src/lib/crypto/krb/hash_provider/Makefile.in rename to src/lib/crypto/builtin/hash_provider/Makefile.in index ece3a99ba..75b3d1b0c 100644 --- a/src/lib/crypto/krb/hash_provider/Makefile.in +++ b/src/lib/crypto/builtin/hash_provider/Makefile.in @@ -1,8 +1,8 @@ thisconfigdir=../../../.. -myfulldir=lib/crypto/krb/hash_provider -mydir=lib/crypto/krb/hash_provider +myfulldir=lib/crypto/builtin/hash_provider +mydir=lib/crypto/builtin/hash_provider BUILDTOP=$(REL)..$(S)..$(S)..$(S).. -LOCALINCLUDES = -I$(srcdir)/../crc32 -I$(srcdir)/../../@CRYPTO_IMPL@/md4 \ +LOCALINCLUDES = -I$(srcdir)/../../krb/crc32 -I$(srcdir)/../../@CRYPTO_IMPL@/md4 \ -I$(srcdir)/../../@CRYPTO_IMPL@/md5 -I$(srcdir)/../../@CRYPTO_IMPL@/sha1 DEFS= diff --git a/src/lib/crypto/krb/hash_provider/deps b/src/lib/crypto/builtin/hash_provider/deps similarity index 97% rename from src/lib/crypto/krb/hash_provider/deps rename to src/lib/crypto/builtin/hash_provider/deps index 970777048..deca38437 100644 --- a/src/lib/crypto/krb/hash_provider/deps +++ b/src/lib/crypto/builtin/hash_provider/deps @@ -10,7 +10,7 @@ hash_crc32.so hash_crc32.po $(OUTPRE)hash_crc32.$(OBJEXT): \ $(SRCTOP)/include/k5-plugin.h $(SRCTOP)/include/k5-thread.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ - $(SRCTOP)/include/socket-utils.h $(srcdir)/../crc32/crc-32.h \ + $(SRCTOP)/include/socket-utils.h $(srcdir)/../../krb/crc32/crc-32.h \ hash_crc32.c hash_provider.h hash_md4.so hash_md4.po $(OUTPRE)hash_md4.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ diff --git a/src/lib/crypto/krb/hash_provider/hash_crc32.c b/src/lib/crypto/builtin/hash_provider/hash_crc32.c similarity index 100% rename from src/lib/crypto/krb/hash_provider/hash_crc32.c rename to src/lib/crypto/builtin/hash_provider/hash_crc32.c diff --git a/src/lib/crypto/krb/hash_provider/hash_md4.c b/src/lib/crypto/builtin/hash_provider/hash_md4.c similarity index 100% rename from src/lib/crypto/krb/hash_provider/hash_md4.c rename to src/lib/crypto/builtin/hash_provider/hash_md4.c diff --git a/src/lib/crypto/krb/hash_provider/hash_md5.c b/src/lib/crypto/builtin/hash_provider/hash_md5.c similarity index 100% rename from src/lib/crypto/krb/hash_provider/hash_md5.c rename to src/lib/crypto/builtin/hash_provider/hash_md5.c diff --git a/src/lib/crypto/krb/hash_provider/hash_provider.h b/src/lib/crypto/builtin/hash_provider/hash_provider.h similarity index 100% rename from src/lib/crypto/krb/hash_provider/hash_provider.h rename to src/lib/crypto/builtin/hash_provider/hash_provider.h diff --git a/src/lib/crypto/krb/hash_provider/hash_sha1.c b/src/lib/crypto/builtin/hash_provider/hash_sha1.c similarity index 100% rename from src/lib/crypto/krb/hash_provider/hash_sha1.c rename to src/lib/crypto/builtin/hash_provider/hash_sha1.c diff --git a/src/lib/crypto/krb/yarrow/yhash.h b/src/lib/crypto/builtin/yhash.h similarity index 100% rename from src/lib/crypto/krb/yarrow/yhash.h rename to src/lib/crypto/builtin/yhash.h diff --git a/src/lib/crypto/crypto_tests/Makefile.in b/src/lib/crypto/crypto_tests/Makefile.in index 41704c85c..3d7eca18b 100644 --- a/src/lib/crypto/crypto_tests/Makefile.in +++ b/src/lib/crypto/crypto_tests/Makefile.in @@ -3,7 +3,7 @@ myfulldir=lib/crypto/crypto_tests mydir=lib/crypto/crypto_tests BUILDTOP=$(REL)..$(S)..$(S).. LOCALINCLUDES = -I$(srcdir)/../krb -I$(srcdir)/../@CRYPTO_IMPL@/enc_provider \ - -I$(srcdir)/../krb/hash_provider -I$(srcdir)/../krb/keyhash_provider \ + -I$(srcdir)/../@CRYPTO_IMPL@/hash_provider -I$(srcdir)/../krb/keyhash_provider \ -I$(srcdir)/../krb/dk -I$(srcdir)/../@CRYPTO_IMPL@/ \ -I$(srcdir)/../krb/yarrow \ -I$(srcdir)/../krb/crc32 -I$(srcdir)/../krb/old -I$(srcdir)/../krb/raw \ diff --git a/src/lib/crypto/krb/Makefile.in b/src/lib/crypto/krb/Makefile.in index 909d3de85..e64ef8f31 100644 --- a/src/lib/crypto/krb/Makefile.in +++ b/src/lib/crypto/krb/Makefile.in @@ -2,15 +2,15 @@ thisconfigdir=../../.. myfulldir=lib/crypto/krb mydir=lib/crypto/krb BUILDTOP=$(REL)..$(S)..$(S).. -SUBDIRS= crc32 dk hash_provider keyhash_provider \ +SUBDIRS= crc32 dk keyhash_provider \ prf rand2key old raw yarrow LOCALINCLUDES = -I$(srcdir) -I$(srcdir)/../@CRYPTO_IMPL@/enc_provider -I$(srcdir)/dk \ - -I$(srcdir)/hash_provider -I$(srcdir)/keyhash_provider \ + -I$(srcdir)/../@CRYPTO_IMPL@/hash_provider -I$(srcdir)/keyhash_provider \ -I$(srcdir)/prf -I$(srcdir)/rand2key \ -I$(srcdir)/old -I$(srcdir)/raw -I$(srcdir)/yarrow \ -I$(srcdir)/../@CRYPTO_IMPL@/ -I$(srcdir)/../@CRYPTO_IMPL@/des \ -I$(srcdir)/../@CRYPTO_IMPL@/aes -I$(srcdir)/../@CRYPTO_IMPL@/arcfour \ - -I$(srcdir)/../@CRYPTO_IMPL@/sha1 + -I$(srcdir)/../@CRYPTO_IMPL@/sha1 -I$(srcdir)/../@CRYPTO_IMPL@ PROG_LIBPATH=-L$(TOPLIBD) PROG_RPATH=$(KRB5_LIBDIR) DEFS= @@ -151,12 +151,12 @@ SRCS=\ $(srcdir)/verify_checksum_iov.c STOBJLISTS=crc32/OBJS.ST dk/OBJS.ST \ - hash_provider/OBJS.ST keyhash_provider/OBJS.ST \ + keyhash_provider/OBJS.ST \ prf/OBJS.ST rand2key/OBJS.ST \ old/OBJS.ST raw/OBJS.ST yarrow/OBJS.ST OBJS.ST SUBDIROBJLISTS=crc32/OBJS.ST dk/OBJS.ST \ - hash_provider/OBJS.ST keyhash_provider/OBJS.ST \ + keyhash_provider/OBJS.ST \ prf/OBJS.ST rand2key/OBJS.ST \ old/OBJS.ST raw/OBJS.ST yarrow/OBJS.ST @@ -176,9 +176,6 @@ all-windows:: cd ..\dk @echo Making in crypto\dk $(MAKE) -$(MFLAGS) - cd ..\hash_provider - @echo Making in crypto\hash_provider - $(MAKE) -$(MFLAGS) cd ..\keyhash_provider @echo Making in crypto\keyhash_provider $(MAKE) -$(MFLAGS) @@ -206,9 +203,6 @@ clean-windows:: cd ..\dk @echo Making clean in crypto\dk $(MAKE) -$(MFLAGS) clean - cd ..\hash_provider - @echo Making clean in crypto\hash_provider - $(MAKE) -$(MFLAGS) clean cd ..\keyhash_provider @echo Making clean in crypto\keyhash_provider $(MAKE) -$(MFLAGS) clean @@ -236,9 +230,6 @@ check-windows:: cd ..\dk @echo Making check in crypto\dk $(MAKE) -$(MFLAGS) check - cd ..\hash_provider - @echo Making check in crypto\hash_provider - $(MAKE) -$(MFLAGS) check cd ..\keyhash_provider @echo Making check in crypto\keyhash_provider $(MAKE) -$(MFLAGS) check diff --git a/src/lib/crypto/krb/deps b/src/lib/crypto/krb/deps index 271ec907f..aafb06b00 100644 --- a/src/lib/crypto/krb/deps +++ b/src/lib/crypto/krb/deps @@ -52,7 +52,7 @@ cksumtypes.so cksumtypes.po $(OUTPRE)cksumtypes.$(OBJEXT): \ $(SRCTOP)/include/k5-plugin.h $(SRCTOP)/include/k5-thread.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ - $(SRCTOP)/include/socket-utils.h $(srcdir)/hash_provider/hash_provider.h \ + $(SRCTOP)/include/socket-utils.h $(srcdir)/../builtin/hash_provider/hash_provider.h \ $(srcdir)/keyhash_provider/keyhash_provider.h cksumtypes.c \ cksumtypes.h coll_proof_cksum.so coll_proof_cksum.po $(OUTPRE)coll_proof_cksum.$(OBJEXT): \ @@ -192,7 +192,7 @@ etypes.so etypes.po $(OUTPRE)etypes.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ $(srcdir)/../builtin/aes/aes_s2k.h $(srcdir)/../builtin/arcfour/arcfour.h \ $(srcdir)/../builtin/des/des_int.h $(srcdir)/../builtin/enc_provider/enc_provider.h \ - $(srcdir)/dk/dk.h $(srcdir)/hash_provider/hash_provider.h \ + $(srcdir)/dk/dk.h $(srcdir)/../builtin/hash_provider/hash_provider.h \ $(srcdir)/old/old.h $(srcdir)/prf/prf_int.h $(srcdir)/raw/raw.h \ etypes.c etypes.h keyblocks.so keyblocks.po $(OUTPRE)keyblocks.$(OBJEXT): \ @@ -329,7 +329,7 @@ prng.so prng.po $(OUTPRE)prng.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ $(srcdir)/../builtin/enc_provider/enc_provider.h $(srcdir)/../builtin/sha1/shs.h \ $(srcdir)/yarrow/yarrow.h $(srcdir)/yarrow/ycipher.h \ - $(srcdir)/yarrow/yhash.h $(srcdir)/yarrow/ytypes.h \ + $(srcdir)/../builtin/yhash.h $(srcdir)/yarrow/ytypes.h \ prng.c random_to_key.so random_to_key.po $(OUTPRE)random_to_key.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ diff --git a/src/lib/crypto/krb/keyhash_provider/Makefile.in b/src/lib/crypto/krb/keyhash_provider/Makefile.in index d84ce7967..d30f6c4f0 100644 --- a/src/lib/crypto/krb/keyhash_provider/Makefile.in +++ b/src/lib/crypto/krb/keyhash_provider/Makefile.in @@ -4,7 +4,7 @@ mydir=lib/crypto/krb/keyhash_provider BUILDTOP=$(REL)..$(S)..$(S)..$(S).. LOCALINCLUDES = -I$(srcdir)/../../@CRYPTO_IMPL@/des -I$(srcdir)/../../@CRYPTO_IMPL@/md4 \ -I$(srcdir)/../../@CRYPTO_IMPL@/md5 -I$(srcdir)/../../@CRYPTO_IMPL@/arcfour \ - -I$(srcdir)/../hash_provider + -I$(srcdir)/../../@CRYPTO_IMPL@/hash_provider -I$(srcdir)/../../@CRYPTO_IMPL@ DEFS= ##DOS##BUILDTOP = ..\..\..\.. diff --git a/src/lib/crypto/krb/keyhash_provider/deps b/src/lib/crypto/krb/keyhash_provider/deps index bfd980b0e..09af19d59 100644 --- a/src/lib/crypto/krb/keyhash_provider/deps +++ b/src/lib/crypto/krb/keyhash_provider/deps @@ -44,7 +44,7 @@ hmac_md5.so hmac_md5.po $(OUTPRE)hmac_md5.$(OBJEXT): \ $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ $(SRCTOP)/include/socket-utils.h $(srcdir)/../../builtin/arcfour/arcfour-int.h \ $(srcdir)/../../builtin/arcfour/arcfour.h $(srcdir)/../../builtin/md5/rsa-md5.h \ - $(srcdir)/../aead.h $(srcdir)/../cksumtypes.h $(srcdir)/../hash_provider/hash_provider.h \ + $(srcdir)/../aead.h $(srcdir)/../cksumtypes.h $(srcdir)/../../builtin/hash_provider/hash_provider.h \ hmac_md5.c keyhash_provider.h md5_hmac.so md5_hmac.po $(OUTPRE)md5_hmac.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ @@ -57,5 +57,5 @@ md5_hmac.so md5_hmac.po $(OUTPRE)md5_hmac.$(OBJEXT): \ $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ $(SRCTOP)/include/socket-utils.h $(srcdir)/../../builtin/arcfour/arcfour-int.h \ $(srcdir)/../../builtin/arcfour/arcfour.h $(srcdir)/../../builtin/md5/rsa-md5.h \ - $(srcdir)/../hash_provider/hash_provider.h keyhash_provider.h \ + $(srcdir)/../../builtin/hash_provider/hash_provider.h keyhash_provider.h \ md5_hmac.c diff --git a/src/lib/crypto/krb/prf/Makefile.in b/src/lib/crypto/krb/prf/Makefile.in index f16308b95..42b14b95a 100644 --- a/src/lib/crypto/krb/prf/Makefile.in +++ b/src/lib/crypto/krb/prf/Makefile.in @@ -4,6 +4,7 @@ mydir=lib/crypto/krb/prf BUILDTOP=$(REL)..$(S)..$(S)..$(S).. LOCALINCLUDES = -I$(srcdir) -I$(srcdir)/.. \ -I$(srcdir)/../dk \ + -I$(srcdir)/../../@CRYPTO_IMPL@ \ -I$(srcdir)/../../@CRYPTO_IMPL@/md5 \ -I$(srcdir)/../../@CRYPTO_IMPL@/sha1 DEFS= diff --git a/src/lib/crypto/krb/prf/deps b/src/lib/crypto/krb/prf/deps index a3c9c7636..c0b02f1c4 100644 --- a/src/lib/crypto/krb/prf/deps +++ b/src/lib/crypto/krb/prf/deps @@ -30,5 +30,5 @@ rc4_prf.so rc4_prf.po $(OUTPRE)rc4_prf.$(OBJEXT): $(BUILDTOP)/include/autoconf.h $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/krb5.h \ $(SRCTOP)/include/krb5/locate_plugin.h $(SRCTOP)/include/krb5/preauth_plugin.h \ $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(srcdir)/../hash_provider/hash_provider.h prf_int.h \ + $(srcdir)/../../builtin/hash_provider/hash_provider.h prf_int.h \ rc4_prf.c diff --git a/src/lib/crypto/krb/yarrow/Makefile.in b/src/lib/crypto/krb/yarrow/Makefile.in index b246c6cc0..0a3c1e708 100644 --- a/src/lib/crypto/krb/yarrow/Makefile.in +++ b/src/lib/crypto/krb/yarrow/Makefile.in @@ -2,7 +2,10 @@ thisconfigdir=../../../.. myfulldir=lib/crypto/krb/yarrow mydir=lib/crypto/krb/yarrow BUILDTOP=$(REL)..$(S)..$(S)..$(S).. -LOCALINCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../@CRYPTO_IMPL@ -I$(srcdir)/../../@CRYPTO_IMPL@/sha1 -I$(srcdir)/../../@CRYPTO_IMPL@/enc_provider +LOCALINCLUDES = -I$(srcdir)/.. \ + -I$(srcdir)/../../@CRYPTO_IMPL@ \ + -I$(srcdir)/../../@CRYPTO_IMPL@/sha1 \ + -I$(srcdir)/../../@CRYPTO_IMPL@/enc_provider DEFS= ##DOS##BUILDTOP = ..\..\..\.. diff --git a/src/lib/crypto/krb/yarrow/deps b/src/lib/crypto/krb/yarrow/deps index bfda3af5b..ebc455065 100644 --- a/src/lib/crypto/krb/yarrow/deps +++ b/src/lib/crypto/krb/yarrow/deps @@ -11,7 +11,7 @@ yarrow.so yarrow.po $(OUTPRE)yarrow.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(SRCTOP)/include/krb5/locate_plugin.h $(SRCTOP)/include/krb5/preauth_plugin.h \ $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ $(srcdir)/../../builtin/sha1/shs.h yarrow.c yarrow.h \ - ycipher.h yexcep.h yhash.h ylock.h ystate.h ytypes.h + ycipher.h yexcep.h $(srcdir)/../../builtin/yhash.h ylock.h ystate.h ytypes.h ycipher.so ycipher.po $(OUTPRE)ycipher.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(BUILDTOP)/include/krb5/krb5.h $(BUILDTOP)/include/osconf.h \ $(BUILDTOP)/include/profile.h $(COM_ERR_DEPS) $(SRCTOP)/include/k5-buf.h \ @@ -23,4 +23,4 @@ ycipher.so ycipher.po $(OUTPRE)ycipher.$(OBJEXT): $(BUILDTOP)/include/autoconf.h $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ $(srcdir)/../../builtin/enc_provider/enc_provider.h \ $(srcdir)/../../builtin/sha1/shs.h yarrow.h ycipher.c \ - ycipher.h yhash.h ytypes.h + ycipher.h $(srcdir)/../../builtin/yhash.h ytypes.h diff --git a/src/lib/crypto/krb/yarrow/yarrow.c b/src/lib/crypto/krb/yarrow/yarrow.c index ff25fa9c5..b1533daf4 100644 --- a/src/lib/crypto/krb/yarrow/yarrow.c +++ b/src/lib/crypto/krb/yarrow/yarrow.c @@ -34,7 +34,6 @@ #define YARROW_IMPL #include "yarrow.h" -#include "yhash.h" #include "ycipher.h" #include "ylock.h" #include "ystate.h" diff --git a/src/lib/crypto/krb/yarrow/yarrow.h b/src/lib/crypto/krb/yarrow/yarrow.h index 7e1fe1442..bb8c63ac0 100644 --- a/src/lib/crypto/krb/yarrow/yarrow.h +++ b/src/lib/crypto/krb/yarrow/yarrow.h @@ -10,7 +10,7 @@ #define YARROW_NO_MATHLIB #include "ytypes.h" -#include "yhash.h" +#include #include "ycipher.h" /* These error codes are returned by the functions below. */ diff --git a/src/lib/crypto/openssl/hash_provider/hash_crc32.c b/src/lib/crypto/openssl/hash_provider/hash_crc32.c new file mode 100644 index 000000000..a3d3028e8 --- /dev/null +++ b/src/lib/crypto/openssl/hash_provider/hash_crc32.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "k5-int.h" +#include "crc-32.h" +#include "hash_provider.h" + +static krb5_error_code +k5_crc32_hash(unsigned int icount, const krb5_data *input, + krb5_data *output) +{ + unsigned long c, cn; + unsigned int i; + + if (output->length != CRC32_CKSUM_LENGTH) + return(KRB5_CRYPTO_INTERNAL); + + c = 0; + for (i=0; idata); + return(0); +} + +const struct krb5_hash_provider krb5int_hash_crc32 = { + "CRC32", + CRC32_CKSUM_LENGTH, + 1, + k5_crc32_hash +}; diff --git a/src/lib/crypto/openssl/hash_provider/hash_md4.c b/src/lib/crypto/openssl/hash_provider/hash_md4.c new file mode 100644 index 000000000..f507aaaf7 --- /dev/null +++ b/src/lib/crypto/openssl/hash_provider/hash_md4.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "k5-int.h" +#include "rsa-md4.h" +#include "hash_provider.h" + +static krb5_error_code +k5_md4_hash(unsigned int icount, const krb5_data *input, + krb5_data *output) +{ + krb5_MD4_CTX ctx; + unsigned int i; + + if (output->length != RSA_MD4_CKSUM_LENGTH) + return(KRB5_CRYPTO_INTERNAL); + + krb5_MD4Init(&ctx); + for (i=0; idata, ctx.digest, RSA_MD4_CKSUM_LENGTH); + + return(0); +} + +const struct krb5_hash_provider krb5int_hash_md4 = { + "MD4", + RSA_MD4_CKSUM_LENGTH, + 64, + k5_md4_hash +}; diff --git a/src/lib/crypto/openssl/hash_provider/hash_md5.c b/src/lib/crypto/openssl/hash_provider/hash_md5.c new file mode 100644 index 000000000..a6e380ae2 --- /dev/null +++ b/src/lib/crypto/openssl/hash_provider/hash_md5.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "k5-int.h" +#include "rsa-md5.h" +#include "hash_provider.h" + +static krb5_error_code +k5_md5_hash(unsigned int icount, const krb5_data *input, + krb5_data *output) +{ + krb5_MD5_CTX ctx; + unsigned int i; + + if (output->length != RSA_MD5_CKSUM_LENGTH) + return(KRB5_CRYPTO_INTERNAL); + + krb5_MD5Init(&ctx); + for (i=0; idata, ctx.digest, RSA_MD5_CKSUM_LENGTH); + + return(0); +} + +const struct krb5_hash_provider krb5int_hash_md5 = { + "MD5", + RSA_MD5_CKSUM_LENGTH, + 64, + k5_md5_hash +}; diff --git a/src/lib/crypto/openssl/hash_provider/hash_provider.h b/src/lib/crypto/openssl/hash_provider/hash_provider.h new file mode 100644 index 000000000..4fa46097d --- /dev/null +++ b/src/lib/crypto/openssl/hash_provider/hash_provider.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "k5-int.h" + +extern const struct krb5_hash_provider krb5int_hash_crc32; +extern const struct krb5_hash_provider krb5int_hash_md4; +extern const struct krb5_hash_provider krb5int_hash_md5; +extern const struct krb5_hash_provider krb5int_hash_sha1; diff --git a/src/lib/crypto/openssl/hash_provider/hash_sha1.c b/src/lib/crypto/openssl/hash_provider/hash_sha1.c new file mode 100644 index 000000000..d217086e6 --- /dev/null +++ b/src/lib/crypto/openssl/hash_provider/hash_sha1.c @@ -0,0 +1,61 @@ +/* lib/crypto/openssl/hash/yhash.h + * + * Copyright (C) 1998 by the FundsXpress, INC. + * + * All rights reserved. + * + * Export of this software from the United States of America may require + * a specific license from the United States Government. It is the + * responsibility of any person or organization contemplating export to + * obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of FundsXpress. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. FundsXpress makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "k5-int.h" +#include "shs.h" +#include "hash_provider.h" + +static krb5_error_code +k5_sha1_hash(unsigned int icount, const krb5_data *input, + krb5_data *output) +{ + SHS_INFO ctx; + unsigned int i; + + if (output->length != SHS_DIGESTSIZE) + return(KRB5_CRYPTO_INTERNAL); + + shsInit(&ctx); + for (i=0; i 0 && ctx.digestLen <= output->length){ + output->length = ctx.digestLen; + memcpy(output->data, ctx.digestBuf,ctx.digestLen); + } + + return(0); +} + +const struct krb5_hash_provider krb5int_hash_sha1 = { + "SHA1", + SHS_DIGESTSIZE, + SHS_DATASIZE, + k5_sha1_hash +}; + diff --git a/src/lib/crypto/openssl/hmac.c b/src/lib/crypto/openssl/hmac.c index a5543c977..e0c8dec79 100644 --- a/src/lib/crypto/openssl/hmac.c +++ b/src/lib/crypto/openssl/hmac.c @@ -1,4 +1,4 @@ -/* +/* lib/crypto/openssl/hmac.c */ #include "k5-int.h" diff --git a/src/lib/crypto/openssl/sha1/shs.c b/src/lib/crypto/openssl/sha1/shs.c index 9fb60f87c..7cc864bb8 100644 --- a/src/lib/crypto/openssl/sha1/shs.c +++ b/src/lib/crypto/openssl/sha1/shs.c @@ -3,12 +3,19 @@ #include #endif #include +#define h0init 0x67452301L +#define h1init 0xEFCDAB89L +#define h2init 0x98BADCFEL +#define h3init 0x10325476L +#define h4init 0xC3D2E1F0L /* Initialize the SHS values */ void shsInit(SHS_INFO *shsInfo) { EVP_MD_CTX_init(&shsInfo->ossl_sha1_ctx ); EVP_DigestInit_ex(&shsInfo->ossl_sha1_ctx , EVP_sha1(), NULL); + shsInfo->digestLen = 0; + memset(shsInfo->digestBuf, 0 , sizeof(shsInfo->digestBuf)); } /* Update SHS for a block of data */ @@ -22,13 +29,8 @@ void shsUpdate(SHS_INFO *shsInfo, const SHS_BYTE *buffer, unsigned int count) void shsFinal(SHS_INFO *shsInfo) { - unsigned char *digest_buf = NULL; - - digest_buf = (unsigned char *)OPENSSL_malloc( sizeof(shsInfo->digest)); - - EVP_DigestFinal_ex(&shsInfo->ossl_sha1_ctx , digest_buf , &shsInfo->digest_len); - - memcpy(shsInfo->digest, digest_buf, shsInfo->digest_len); - OPENSSL_free(digest_buf); + EVP_DigestFinal_ex(&shsInfo->ossl_sha1_ctx ,(unsigned char *)shsInfo->digestBuf , &shsInfo->digestLen); EVP_MD_CTX_cleanup(&shsInfo->ossl_sha1_ctx ); } + + diff --git a/src/lib/crypto/openssl/sha1/shs.h b/src/lib/crypto/openssl/sha1/shs.h index 66e91b69b..772c72ac6 100644 --- a/src/lib/crypto/openssl/sha1/shs.h +++ b/src/lib/crypto/openssl/sha1/shs.h @@ -22,11 +22,9 @@ typedef krb5_ui_4 SHS_LONG; /* The structure for storing SHS info */ typedef struct { - EVP_MD_CTX ossl_sha1_ctx; - unsigned int digest_len; - SHS_LONG digest[ 5 ]; /* Message digest */ - SHS_LONG countLo, countHi; /* 64-bit bit count */ - SHS_LONG data[ 16 ]; /* SHS data buffer */ + EVP_MD_CTX ossl_sha1_ctx; + unsigned char digestBuf[SHS_DIGESTSIZE]; /* output */ + unsigned int digestLen; /* output */ } SHS_INFO; /* Message digest functions (shs.c) */ diff --git a/src/lib/crypto/openssl/yhash.h b/src/lib/crypto/openssl/yhash.h new file mode 100644 index 000000000..94c557c64 --- /dev/null +++ b/src/lib/crypto/openssl/yhash.h @@ -0,0 +1,30 @@ +/* -*- Mode: C; c-file-style: "bsd" -*- */ +/* lib/crypto/openssl/hash/yhash.h + */ + +#ifndef YHASH_H +#define YHASH_H + +/* hash function interface */ + +/* default to SHA1 for yarrow 160 */ + +#include "shs.h" + + +#define HASH_CTX SHS_INFO +#define HASH_Init(x) shsInit(x) +#define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz) + +#define HASH_Final(x, tdigest) do { \ + int loopvar; \ + unsigned char *out2 = (void *)(tdigest); \ + HASH_CTX *ctx = (x); \ + shsFinal(ctx); \ + memcpy(out2, ctx->digestBuf, ctx->digestLen); \ + } while(0) + +#define HASH_DIGEST_SIZE SHS_DIGESTSIZE + +#endif /* YHASH_H */ + -- 2.26.2