summaryrefslogtreecommitdiffstats
path: root/libhmac
diff options
context:
space:
mode:
authorSam Varshavchik2013-08-19 16:39:41 -0400
committerSam Varshavchik2013-08-25 14:43:51 -0400
commit9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch)
tree7a81a04cb51efb078ee350859a64be2ebc6b8813 /libhmac
parenta9520698b770168d1f33d6301463bb70a19655ec (diff)
downloadcourier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2
Initial checkin
Imported from subversion report, converted to git. Updated all paths in scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'libhmac')
-rw-r--r--libhmac/.gitignore2
-rw-r--r--libhmac/Makefile.am28
-rw-r--r--libhmac/configure.in71
-rw-r--r--libhmac/hmac.c150
-rw-r--r--libhmac/hmac.h90
-rw-r--r--libhmac/md5hmactest.c60
-rw-r--r--libhmac/md5hmactest.txt7
-rw-r--r--libhmac/sha1hmactest.c76
-rw-r--r--libhmac/sha1hmactest.txt14
9 files changed, 498 insertions, 0 deletions
diff --git a/libhmac/.gitignore b/libhmac/.gitignore
new file mode 100644
index 0000000..b95414a
--- /dev/null
+++ b/libhmac/.gitignore
@@ -0,0 +1,2 @@
+/md5hmactest
+/sha1hmactest
diff --git a/libhmac/Makefile.am b/libhmac/Makefile.am
new file mode 100644
index 0000000..514155b
--- /dev/null
+++ b/libhmac/Makefile.am
@@ -0,0 +1,28 @@
+#
+# Copyright 1998 - 2005 Double Precision, Inc. See COPYING for
+# distribution information.
+
+
+noinst_LTLIBRARIES=libhmac.la
+
+libhmac_la_SOURCES=hmac.c hmac.h
+
+noinst_PROGRAMS= @TESTPROGS@
+
+EXTRA_PROGRAMS=md5hmactest sha1hmactest
+
+md5hmactest_SOURCES=md5hmactest.c
+md5hmactest_DEPENDENCIES=libhmac.la @hashlibs@
+md5hmactest_LDADD=$(md5hmactest_DEPENDENCIES)
+md5hmactest_LDFLAGS=-static
+
+sha1hmactest_SOURCES=sha1hmactest.c
+sha1hmactest_DEPENDENCIES=libhmac.la @hashlibs@
+sha1hmactest_LDADD=$(sha1hmactest_DEPENDENCIES)
+sha1hmactest_LDFLAGS=-static
+
+EXTRA_DIST=md5hmactest.txt sha1hmactest.txt
+
+check-am:
+ test ! -x ./md5hmactest || ./md5hmactest | cmp -s - $(srcdir)/md5hmactest.txt
+ test ! -x ./sha1hmactest || ./sha1hmactest | cmp -s - $(srcdir)/sha1hmactest.txt
diff --git a/libhmac/configure.in b/libhmac/configure.in
new file mode 100644
index 0000000..b9bf870
--- /dev/null
+++ b/libhmac/configure.in
@@ -0,0 +1,71 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl
+dnl Copyright 1998 - 2001 Double Precision, Inc. See COPYING for
+dnl distribution information.
+
+
+AC_INIT(libhmac, 1.00, [courier-users@lists.sourceforge.net])
+
+>confdefs.h # Kill PACKAGE_ macros
+
+AC_CONFIG_SRCDIR(hmac.h)
+AC_CONFIG_AUX_DIR(../..)
+AM_INIT_AUTOMAKE([foreign no-define])
+
+
+AM_CONFIG_HEADER(config.h)
+
+dnl Checks for programs.
+AC_PROG_AWK
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+if test "$GCC" = yes
+then
+ CFLAGS="-Wall $CFLAGS"
+fi
+
+CPPFLAGS="$CPPFLAGS -I$srcdir/.. -I.."
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+AC_HEADER_STDC
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+
+dnl Checks for library functions.
+
+dnl Other checks
+
+TESTPROGS=""
+
+hmac_list=""
+
+hashlibs=""
+if test -d ${srcdir}/../md5
+then
+ TESTPROGS="$TESTPROGS md5hmactest${EXEEXT}"
+ hmac_list="$hmac_list &hmac_md5,"
+ hashlibs="$hashlibs ../md5/libmd5.la"
+fi
+
+if test -d ${srcdir}/../sha1
+then
+ TESTPROGS="$TESTPROGS sha1hmactest${EXEEXT}"
+ hmac_list="$hmac_list &hmac_sha1, &hmac_sha256, "
+ hashlibs="$hashlibs ../sha1/libsha1.la"
+fi
+
+AC_SUBST(hashlibs)
+hmac_list="$hmac_list 0"
+
+AC_SUBST(TESTPROGS)
+AC_DEFINE_UNQUOTED(HMAC_LIST,$hmac_list,
+ [ Dynamically-generated list of installed HMAC hash functions ])
+
+AC_OUTPUT(Makefile)
diff --git a/libhmac/hmac.c b/libhmac/hmac.c
new file mode 100644
index 0000000..b624fa9
--- /dev/null
+++ b/libhmac/hmac.c
@@ -0,0 +1,150 @@
+/*
+** Copyright 1998 - 1999 Double Precision, Inc.
+** See COPYING for distribution information.
+*/
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "hmac.h"
+
+
+struct hmac_hashinfo *hmac_list[]= {HMAC_LIST};
+
+struct hhki {
+ const struct hmac_hashinfo *hh;
+ const char *k;
+ size_t kl;
+ unsigned char *kxopad;
+ unsigned char *kxipad;
+
+ void *context;
+ } ;
+
+static void dohashkey(unsigned char *, void *);
+static void docalcc(void *, void *);
+
+void hmac_hashkey(const struct hmac_hashinfo *hh, const char *k,
+ size_t kl, unsigned char *kxopad, unsigned char *kxipad)
+{
+struct hhki i;
+
+ i.hh=hh;
+ i.k=k;
+ i.kl=kl;
+ i.kxopad=kxopad;
+ i.kxipad=kxipad;
+
+ (*hh->hh_allocacontext)( docalcc, (void *)&i );
+}
+
+static void dokeycalc(struct hhki *);
+
+static void docalcc(void *c, void *v)
+{
+struct hhki *i=(struct hhki *)v;
+
+ i->context=c;
+
+ if (i->kl > i->hh->hh_B)
+ (*i->hh->hh_allocaval)(dohashkey, (void *)i);
+ else
+ dokeycalc( i );
+}
+
+static void dohashkey(unsigned char *keybuf, void *v)
+{
+struct hhki *i=(struct hhki *)v;
+
+ (*i->hh->hh_init)(i->context);
+ (*i->hh->hh_hash)(i->context, i->k, i->kl);
+ (*i->hh->hh_endhash)(i->context, i->kl);
+ (*i->hh->hh_getdigest)(i->context, keybuf);
+ i->k=(char *)keybuf;
+ i->kl=i->hh->hh_L;
+ dokeycalc(i);
+}
+
+static void dokeycalc(struct hhki *i)
+{
+char buf[64]; /* Random guess :-) */
+unsigned n;
+unsigned l;
+
+ (*i->hh->hh_init)(i->context);
+ n=0;
+ for (l=0; l<i->hh->hh_B; l++)
+ {
+ buf[n] = ( l < i->kl ? i->k[l]:0) ^ 0x5C;
+ if ( ++n >= sizeof(buf))
+ {
+ (*i->hh->hh_hash)(i->context, buf, sizeof(buf));
+ n=0;
+ }
+ }
+ if (n)
+ (*i->hh->hh_hash)(i->context, buf, n);
+ (*i->hh->hh_getdigest)(i->context, i->kxopad);
+
+ (*i->hh->hh_init)(i->context);
+ n=0;
+ for (l=0; l<i->hh->hh_B; l++)
+ {
+ buf[n] = ( l < i->kl ? i->k[l]:0) ^ 0x36;
+ if ( ++n >= sizeof(buf))
+ {
+ (*i->hh->hh_hash)(i->context, buf, sizeof(buf));
+ n=0;
+ }
+ }
+ if (n)
+ (*i->hh->hh_hash)(i->context, buf, n);
+ (*i->hh->hh_getdigest)(i->context, i->kxipad);
+}
+
+struct hhko {
+ const struct hmac_hashinfo *hh;
+ const char *t;
+ size_t tl;
+ const unsigned char *kxopad;
+ const unsigned char *kxipad;
+ unsigned char *hash;
+ } ;
+
+static void docalch(void *, void *);
+
+void hmac_hashtext (
+ const struct hmac_hashinfo *hh,
+ const char *t,
+ size_t tl,
+ const unsigned char *kxopad,
+ const unsigned char *kxipad,
+ unsigned char *hash)
+{
+struct hhko o;
+
+ o.hh=hh;
+ o.t=t;
+ o.tl=tl;
+ o.kxopad=kxopad;
+ o.kxipad=kxipad;
+ o.hash=hash;
+
+ (*hh->hh_allocacontext)( docalch, (void *)&o );
+}
+
+static void docalch(void *c, void *v)
+{
+struct hhko *o=(struct hhko *)v;
+
+ (o->hh->hh_setdigest)(c, o->kxipad);
+ (o->hh->hh_hash)(c, o->t, o->tl);
+ (o->hh->hh_endhash)(c, o->tl+o->hh->hh_B);
+ (o->hh->hh_getdigest)(c, o->hash);
+
+ (o->hh->hh_setdigest)(c, o->kxopad);
+ (o->hh->hh_hash)(c, o->hash, o->hh->hh_L);
+ (o->hh->hh_endhash)(c, o->hh->hh_L + o->hh->hh_B);
+ (o->hh->hh_getdigest)(c, o->hash);
+}
diff --git a/libhmac/hmac.h b/libhmac/hmac.h
new file mode 100644
index 0000000..6696efb
--- /dev/null
+++ b/libhmac/hmac.h
@@ -0,0 +1,90 @@
+#ifndef hmac_h
+#define hmac_h
+
+#include <string.h>
+
+/*
+** Copyright 1998 - 2005 Double Precision, Inc.
+** See COPYING for distribution information.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct hmac_hashinfo { /* HMAC hash function descriptor */
+
+ const char *hh_name; /* Name of this hash function (md5, sha1...) */
+
+ size_t hh_B; /* Length of compression blocks */
+ size_t hh_L; /* Length of hash outputs */
+
+ size_t hh_S; /* Length of 'context structure' */
+
+ /* Hash functions */
+
+ void (*hh_init)(void *); /* Initialize context structure */
+ void (*hh_hash)(void *, const void *, unsigned);
+ /* Feed the hash function */
+ void (*hh_endhash)(void *, unsigned long); /* Calculate final hash */
+
+ void (*hh_getdigest)(void *, unsigned char *); /* Get the hash value */
+ void (*hh_setdigest)(void *, const unsigned char *);
+ /* Set the hash value */
+
+ /* Some helper functions */
+
+ /* Allocate context on stack, instead of mallocing it. Calls the
+ ** provided function pointer, with context as first arg. The second
+ ** arg will be passed as provided.
+ */
+
+ void (*hh_allocacontext)(void (*)(void *, void *), void *);
+
+ /* Like allocacontext, but alloc buffer for hash value, hh_L */
+
+ void (*hh_allocaval)(void (*)(unsigned char *, void *), void *);
+
+ } ;
+
+/* Known hash functions */
+
+extern struct hmac_hashinfo hmac_md5, hmac_sha1, hmac_sha256;
+
+/*
+** List of installed hash functions, dynamically generated at configuration
+** time.
+*/
+
+extern struct hmac_hashinfo *hmac_list[];
+
+/*
+ To calculate an HMAC, allocate three buffers - outer, inner, and hash.
+ Call hmac_hashkey, then hmac_hashtext.
+
+ After hmac_haskey returns, the contents of inner and outer can be
+ saved, as they contain a complete intermediate state of the hash
+ calculation.
+*/
+
+void hmac_hashkey(
+ const struct hmac_hashinfo *,
+ const char *, /* Key */
+ size_t, /* Key length */
+ unsigned char *, /* Output - outer buffer, prehashed */
+ unsigned char *); /* Output - inner buffer, prehashed */
+
+void hmac_hashtext (
+ const struct hmac_hashinfo *,
+ const char *, /* Text */
+ size_t, /* Text length */
+ const unsigned char *, /* outer buffer, prehashed */
+ const unsigned char *, /* inner buffer, prehashed */
+ unsigned char *); /* Output - the hash */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libhmac/md5hmactest.c b/libhmac/md5hmactest.c
new file mode 100644
index 0000000..0cada2d
--- /dev/null
+++ b/libhmac/md5hmactest.c
@@ -0,0 +1,60 @@
+/*
+** Copyright 1998 - 1999 Double Precision, Inc.
+** See COPYING for distribution information.
+*/
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define MD5_INTERNAL
+#include "../md5/md5.h"
+#include "hmac.h"
+
+#include <stdio.h>
+
+
+static struct {
+ const char *key, *data;
+ } testcases[]={
+ {"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ "Hi There"},
+ {"Jefe", "what do ya want for nothing?" },
+
+ {"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
+ "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"},
+
+ {"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0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Size Key and Larger Than One Block-Size Data"}
+ } ;
+
+int main()
+{
+unsigned i, j;
+
+ for (i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++)
+ {
+ MD5_DIGEST ok, ik, hash;
+
+ hmac_hashkey(&hmac_md5, testcases[i].key,
+ strlen(testcases[i].key), ok, ik);
+
+ hmac_hashtext(&hmac_md5, testcases[i].data,
+ strlen(testcases[i].data), ok, ik, hash);
+
+ printf("test_cases[%i].digest=0x", i+1);
+ for (j=0; j<MD5_DIGEST_SIZE; j++)
+ printf("%02x", hash[j]);
+ printf("\n");
+ }
+ return (0);
+}
diff --git a/libhmac/md5hmactest.txt b/libhmac/md5hmactest.txt
new file mode 100644
index 0000000..5d69a11
--- /dev/null
+++ b/libhmac/md5hmactest.txt
@@ -0,0 +1,7 @@
+test_cases[1].digest=0x9294727a3638bb1c13f48ef8158bfc9d
+test_cases[2].digest=0x750c783e6ab0b503eaa86e310a5db738
+test_cases[3].digest=0x56be34521d144c88dbb8c733f0e8b3f6
+test_cases[4].digest=0x697eaf0aca3a3aea3a75164746ffaa79
+test_cases[5].digest=0x56461ef2342edc00f9bab995690efd4c
+test_cases[6].digest=0x6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd
+test_cases[7].digest=0x6f630fad67cda0ee1fb1f562db3aa53e
diff --git a/libhmac/sha1hmactest.c b/libhmac/sha1hmactest.c
new file mode 100644
index 0000000..d571571
--- /dev/null
+++ b/libhmac/sha1hmactest.c
@@ -0,0 +1,76 @@
+/*
+** Copyright 1998 - 1999 Double Precision, Inc.
+** See COPYING for distribution information.
+*/
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define SHA1_INTERNAL
+#include "../sha1/sha1.h"
+#include "hmac.h"
+
+#include <stdio.h>
+
+
+static struct {
+ const char *key, *data;
+ } testcases[]={
+ {"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
+ "H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\xaa\xaa\xaa\xaa\xaa",
+ "Test Using Larger Than Block-Size Key - Hash Key First"},
+
+ {"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
+ "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"}
+ } ;
+
+int main()
+{
+ unsigned i, j;
+
+ for (i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++)
+ {
+ SHA1_DIGEST ok, ik, hash;
+
+ hmac_hashkey(&hmac_sha1, testcases[i].key,
+ strlen(testcases[i].key), ok, ik);
+
+ hmac_hashtext(&hmac_sha1, testcases[i].data,
+ strlen(testcases[i].data), ok, ik, hash);
+
+ printf("test_cases[%i].digest=0x", i+1);
+ for (j=0; j<SHA1_DIGEST_SIZE; j++)
+ printf("%02x", hash[j]);
+ printf("\n");
+ }
+
+ for (i=0; i<sizeof(testcases)/sizeof(testcases[0]); i++)
+ {
+ SHA256_DIGEST ok, ik, hash;
+
+ hmac_hashkey(&hmac_sha256, testcases[i].key,
+ strlen(testcases[i].key), ok, ik);
+
+ hmac_hashtext(&hmac_sha256, testcases[i].data,
+ strlen(testcases[i].data), ok, ik, hash);
+
+ printf("test_cases[%i].digest256=0x", i+1);
+ for (j=0; j<SHA256_DIGEST_SIZE; j++)
+ printf("%02x", hash[j]);
+ printf("\n");
+ }
+ return (0);
+}
diff --git a/libhmac/sha1hmactest.txt b/libhmac/sha1hmactest.txt
new file mode 100644
index 0000000..b5e59c9
--- /dev/null
+++ b/libhmac/sha1hmactest.txt
@@ -0,0 +1,14 @@
+test_cases[1].digest=0xb617318655057264e28bc0b6fb378c8ef146be00
+test_cases[2].digest=0xeffcdf6ae5eb2fa2d27416d5f184df9c259a7c79
+test_cases[3].digest=0x125d7342b9ac11cd91a39af48aa17b4f63f175d3
+test_cases[4].digest=0x4c9007f4026250c6bc8414f9bf50c86c2d7235da
+test_cases[5].digest=0x4c1a03424b55e07fe7f27be1d58bb9324a9a5a04
+test_cases[6].digest=0xaa4ae5e15272d00e95705637ce8a3b55ed402112
+test_cases[7].digest=0xe8e99d0f45237d786d6bbaa7965c7808bbff1a91
+test_cases[1].digest256=0xb0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7
+test_cases[2].digest256=0x5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
+test_cases[3].digest256=0x773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe
+test_cases[4].digest256=0x82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b
+test_cases[5].digest256=0xa3b6167473100ee06e0c796c2955552bfa6f7c0a6a8aef8b93f860aab0cd20c5
+test_cases[6].digest256=0x6953025ed96f0c09f80a96f78e6538dbe2e7b820e3dd970e7ddd39091b32352f
+test_cases[7].digest256=0x6355ac22e890d0a3c8481a5ca4825bc884d3e7a1ff98a2fc2ac7d8e064c3b2e6