1/* $NetBSD: hmacmd5.h,v 1.6 2020/05/25 20:47:21 christos Exp $ */ 2 3/* 4 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") 5 * Copyright (C) 2000, 2001 Internet Software Consortium. 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20/* Id: hmacmd5.h,v 1.14 2009/02/06 23:47:42 tbox Exp */ 21 22/*! \file isc/hmacmd5.h 23 * \brief This is the header file for the HMAC-MD5 keyed hash algorithm 24 * described in RFC2104. 25 */ 26 27#ifndef ISC_HMACMD5_H 28#define ISC_HMACMD5_H 1 29 30#include <isc/lang.h> 31#include <isc/md5.h> 32#include <isc/platform.h> 33#include <isc/types.h> 34 35#define ISC_HMACMD5_KEYLENGTH 64 36 37#ifdef ISC_PLATFORM_OPENSSLHASH 38#include <openssl/hmac.h> 39 40typedef HMAC_CTX isc_hmacmd5_t; 41 42#else 43 44typedef struct { 45 isc_md5_t md5ctx; 46 unsigned char key[ISC_HMACMD5_KEYLENGTH]; 47} isc_hmacmd5_t; 48#endif 49 50ISC_LANG_BEGINDECLS 51 52void 53isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key, 54 unsigned int len); 55 56void 57isc_hmacmd5_invalidate(isc_hmacmd5_t *ctx); 58 59void 60isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf, 61 unsigned int len); 62 63void 64isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest); 65 66isc_boolean_t 67isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest); 68 69isc_boolean_t 70isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len); 71 72ISC_LANG_ENDDECLS 73 74#endif /* ISC_HMACMD5_H */ 75