diff options
| author | Greg Hudson <ghudson@mit.edu> | 2011-03-02 05:29:29 +0000 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2011-03-02 05:29:29 +0000 |
| commit | ce6d249fdf1dd7dda5b202836ed387500324ae2a (patch) | |
| tree | b0550b898743ddfdff76ac6647fca7a12d6db284 /src/lib/crypto/nss/sha1 | |
| parent | e2d6d9ce23b878334d70a0f9c697064873619b75 (diff) | |
| download | krb5-ce6d249fdf1dd7dda5b202836ed387500324ae2a.tar.gz krb5-ce6d249fdf1dd7dda5b202836ed387500324ae2a.tar.xz krb5-ce6d249fdf1dd7dda5b202836ed387500324ae2a.zip | |
Consolidate almost all lib/crypto/krb headers into a single
crypto_int.h. In that header, define and document responsibilities
for crypto modules, some of which are satisfied through a
module-specific crypto_mod.h. In the OpenSSL and NSS modules, remove
many of the headers and sources providing functionality which isn't
needed by lib/crypto/krb any more (direct interfaces to MD4, MD5, and
SHA-1 hashing, as well as DES weak key testing). Change most
Makefile.ins to only include headers from lib/crypto/krb and
lib/crypto/$(CRYPTO_IMPL), instead of from many different directories.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24677 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/nss/sha1')
| -rw-r--r-- | src/lib/crypto/nss/sha1/Makefile.in | 12 | ||||
| -rw-r--r-- | src/lib/crypto/nss/sha1/deps | 15 | ||||
| -rw-r--r-- | src/lib/crypto/nss/sha1/shs.c | 77 | ||||
| -rw-r--r-- | src/lib/crypto/nss/sha1/shs.h | 46 |
4 files changed, 5 insertions, 145 deletions
diff --git a/src/lib/crypto/nss/sha1/Makefile.in b/src/lib/crypto/nss/sha1/Makefile.in index 82d6d9b91d..8e7809e7c3 100644 --- a/src/lib/crypto/nss/sha1/Makefile.in +++ b/src/lib/crypto/nss/sha1/Makefile.in @@ -1,17 +1,13 @@ mydir=lib$(S)crypto$(S)nss$(S)sha1 BUILDTOP=$(REL)..$(S)..$(S)..$(S).. DEFS= -CRYPTO_IMPL_CFLAGS=@CRYPTO_IMPL_CFLAGS@ -LOCALINCLUDES = -I$(srcdir)/.. $(CRYPTO_IMPL_CFLAGS) +LOCALINCLUDES = -PROG_LIBPATH=-L$(TOPLIBD) -PROG_RPATH=$(KRB5_LIBDIR) +STLIBOBJS= -STLIBOBJS= shs.o +OBJS= -OBJS= $(OUTPRE)shs.$(OBJEXT) - -SRCS= $(srcdir)/shs.c +SRCS= all-unix:: all-libobjs diff --git a/src/lib/crypto/nss/sha1/deps b/src/lib/crypto/nss/sha1/deps index 9133bb5302..2feac3c9d3 100644 --- a/src/lib/crypto/nss/sha1/deps +++ b/src/lib/crypto/nss/sha1/deps @@ -1,14 +1 @@ -# -# Generated makefile dependencies follow. -# -shs.so shs.po $(OUTPRE)shs.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ - $(BUILDTOP)/include/krb5/krb5.h $(BUILDTOP)/include/osconf.h \ - $(BUILDTOP)/include/profile.h $(COM_ERR_DEPS) $(srcdir)/../nss_gen.h \ - $(top_srcdir)/include/k5-buf.h $(top_srcdir)/include/k5-err.h \ - $(top_srcdir)/include/k5-gmt_mktime.h $(top_srcdir)/include/k5-int-pkinit.h \ - $(top_srcdir)/include/k5-int.h $(top_srcdir)/include/k5-platform.h \ - $(top_srcdir)/include/k5-plugin.h $(top_srcdir)/include/k5-thread.h \ - $(top_srcdir)/include/k5-trace.h $(top_srcdir)/include/krb5.h \ - $(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \ - $(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \ - $(top_srcdir)/include/socket-utils.h shs.c shs.h +# No dependencies here. diff --git a/src/lib/crypto/nss/sha1/shs.c b/src/lib/crypto/nss/sha1/shs.c deleted file mode 100644 index edf4c9a28a..0000000000 --- a/src/lib/crypto/nss/sha1/shs.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* lib/crypto/nss/sha1/shs.c - * - * Copyright (c) 2010 Red Hat, Inc. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of Red Hat, Inc., nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER - * 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. - */ - -#include "k5-int.h" -#include "shs.h" -#include "pk11pub.h" -#include "nss_gen.h" - -/* Initialize the SHS values */ -void shsInit(SHS_INFO *shsInfo) -{ - if (k5_nss_init()) { - shsInfo->nss_ctxt = NULL; - return; - } - shsInfo->nss_ctxt = PK11_CreateDigestContext(SEC_OID_SHA1); - if (shsInfo->nss_ctxt == NULL) - return; - PK11_DigestBegin((PK11Context *)shsInfo->nss_ctxt); -} - -/* Update SHS for a block of data */ -void shsUpdate(SHS_INFO *shsInfo, const SHS_BYTE *buffer, unsigned int count) -{ - if (shsInfo->nss_ctxt == NULL) - return; - PK11_DigestOp((PK11Context *)shsInfo->nss_ctxt, buffer, count); -} - - -/* Final wrapup - pad to SHS_DATASIZE-byte boundary with the bit pattern - * 1 0* (64-bit count of bits processed, MSB-first) */ -void shsFinal(SHS_INFO *shsInfo) -{ - if (shsInfo->nss_ctxt == NULL) - return; - PK11_DigestFinal((PK11Context *)shsInfo->nss_ctxt, shsInfo->digestBuf, - &shsInfo->digestLen, sizeof (shsInfo->digestBuf)); - /* Since there is not separate cleanup step, free the context now. - * (otherwise we could have reused the context for another MD5 operation - * in the future). - */ - PK11_DestroyContext((PK11Context *)shsInfo->nss_ctxt, PR_TRUE); - shsInfo->nss_ctxt = NULL; -} diff --git a/src/lib/crypto/nss/sha1/shs.h b/src/lib/crypto/nss/sha1/shs.h deleted file mode 100644 index 7019504c1c..0000000000 --- a/src/lib/crypto/nss/sha1/shs.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -#ifndef _SHS_DEFINED - -#include "k5-int.h" - -#define _SHS_DEFINED - -/* Some useful types */ - -typedef krb5_octet SHS_BYTE; -typedef krb5_ui_4 SHS_LONG; - -/* Define the following to use the updated SHS implementation */ -#define NEW_SHS /**/ - -/* The SHS block size and message digest sizes, in bytes */ - -#define SHS_DATASIZE 64 -#define SHS_DIGESTSIZE 20 - -/* The structure for storing SHS info */ - -typedef struct { - void *nss_ctxt; - unsigned char digestBuf[SHS_DIGESTSIZE]; /* output */ - unsigned int digestLen; /* output */ -} SHS_INFO; - -/* Message digest functions (shs.c) */ -void shsInit(SHS_INFO *shsInfo); -void shsUpdate(SHS_INFO *shsInfo, const SHS_BYTE *buffer, unsigned int count); -void shsFinal(SHS_INFO *shsInfo); - - -/* Keyed Message digest functions (hmac_sha.c) */ -krb5_error_code hmac_sha(krb5_octet *text, - int text_len, - krb5_octet *key, - int key_len, - krb5_octet *digest); - - -#define NIST_SHA_CKSUM_LENGTH SHS_DIGESTSIZE -#define HMAC_SHA_CKSUM_LENGTH SHS_DIGESTSIZE - -#endif /* _SHS_DEFINED */ |
