/* -*-c-*-
*
- * $Id: hmac.h,v 1.2 1999/12/10 23:17:39 mdw Exp $
+ * $Id: hmac.h,v 1.7 2004/04/08 01:36:15 mdw Exp $
*
* Generic code for HMAC and NMAC
*
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: hmac.h,v $
- * Revision 1.2 1999/12/10 23:17:39 mdw
- * Split mode macros into interface and implementation.
- *
- * Revision 1.1 1999/09/03 08:41:12 mdw
- * Initial import.
- *
- */
-
/*----- Notes on the HMAC and NMAC constructions --------------------------*
*
* Designed by Mihir Bellare, Ran Canetti and Hugo Krawczyk, NMAC is a method
/* --- An HMAC or NMAC key --- */ \
\
typedef struct pre##_mackey { \
- octet ochain[PRE##_HASHSZ]; /* Chaining for outer hash */ \
+ octet ochain[PRE##_STATESZ]; /* Chaining for outer hash */ \
unsigned ocount; /* Byte count for outer hash */ \
- octet ichain[PRE##_HASHSZ]; /* Chaining for inner hash */ \
+ octet ichain[PRE##_STATESZ]; /* Chaining for inner hash */ \
unsigned icount; /* Byte count for inner hash */ \
} pre##_mackey; \
\
\
typedef struct pre##_macctx { \
pre##_ctx ctx; /* Context for main hashing */ \
- octet chain[PRE##_HASHSZ]; /* Chaining for outer hash */ \
+ octet chain[PRE##_STATESZ]; /* Chaining for outer hash */ \
unsigned count; /* Byte count for outer hash */ \
} pre##_macctx; \
\
+/* --- Other useful constants --- */ \
+ \
+extern const octet pre##_hmackeysz[]; \
+extern const octet pre##_nmackeysz[]; \
+extern const octet pre##_sslmackeysz[]; \
+ \
/* --- @pre_nmacinit@ --- * \
* \
* Arguments: @pre_macctx *key@ = pointer to a MAC key object \
* use, as specified in RFC2104. \
*/ \
\
-extern void pre##_hmacinit(pre##_mackey */*key*/, \
+extern void pre##_hmacinit(pre##_mackey */*key*/, \
const void */*k*/, size_t /*sz*/); \
\
+/* --- @pre_sslmacinit@ --- * \
+ * \
+ * Arguments: @pre_mackey *key@ = pointer to MAC key object \
+ * @const void *k@ = pointer to key to use \
+ * @size_t sz@ = size of key data \
+ * \
+ * Returns: --- \
+ * \
+ * Use: Initializes a MAC key for doing hasing using the SSL3 \
+ * variant of HMAC. \
+ */ \
+ \
+extern void pre##_sslmacinit(pre##_mackey */*key*/, \
+ const void */*k*/, size_t /*sz*/); \
+ \
/* --- @pre_macinit@ --- * \
* \
* Arguments: @pre_macctx *ctx@ = pointer to MAC context block \
\
/* --- Generic MAC interface --- */ \
\
-extern const gcmac pre##_hmac;
+extern const gcmac pre##_hmac; \
+extern const gcmac pre##_nmac; \
+extern const gcmac pre##_sslmac;
/*----- That's all, folks -------------------------------------------------*/