00001 /* 00002 * Copyright (C) 2004-2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 2000, 2001 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: hmacmd5.h,v 1.14 2009/02/06 23:47:42 tbox Exp $ */ 00019 00020 /*! \file isc/hmacmd5.h 00021 * \brief This is the header file for the HMAC-MD5 keyed hash algorithm 00022 * described in RFC2104. 00023 */ 00024 00025 #ifndef ISC_HMACMD5_H 00026 #define ISC_HMACMD5_H 1 00027 00028 #include <isc/lang.h> 00029 #include <isc/md5.h> 00030 #include <isc/platform.h> 00031 #include <isc/types.h> 00032 00033 #define ISC_HMACMD5_KEYLENGTH 64 00034 00035 #ifdef ISC_PLATFORM_OPENSSLHASH 00036 #include <openssl/hmac.h> 00037 00038 typedef HMAC_CTX isc_hmacmd5_t; 00039 00040 #elif PKCS11CRYPTO 00041 #include <pk11/pk11.h> 00042 00043 typedef pk11_context_t isc_hmacmd5_t; 00044 00045 #else 00046 00047 typedef struct { 00048 isc_md5_t md5ctx; 00049 unsigned char key[ISC_HMACMD5_KEYLENGTH]; 00050 } isc_hmacmd5_t; 00051 #endif 00052 00053 ISC_LANG_BEGINDECLS 00054 00055 void 00056 isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key, 00057 unsigned int len); 00058 00059 void 00060 isc_hmacmd5_invalidate(isc_hmacmd5_t *ctx); 00061 00062 void 00063 isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf, 00064 unsigned int len); 00065 00066 void 00067 isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest); 00068 00069 isc_boolean_t 00070 isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest); 00071 00072 isc_boolean_t 00073 isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len); 00074 00075 ISC_LANG_ENDDECLS 00076 00077 #endif /* ISC_HMACMD5_H */