1258945Sroberto/*
2280849Scy * Copyright (C) 2004-2007, 2009, 2010  Internet Systems Consortium, Inc. ("ISC")
3258945Sroberto * Copyright (C) 2000, 2001  Internet Software Consortium.
4258945Sroberto *
5258945Sroberto * Permission to use, copy, modify, and/or distribute this software for any
6258945Sroberto * purpose with or without fee is hereby granted, provided that the above
7258945Sroberto * copyright notice and this permission notice appear in all copies.
8258945Sroberto *
9258945Sroberto * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10258945Sroberto * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11258945Sroberto * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12258945Sroberto * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13258945Sroberto * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14258945Sroberto * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15258945Sroberto * PERFORMANCE OF THIS SOFTWARE.
16258945Sroberto */
17258945Sroberto
18280849Scy/* $Id: md5.h,v 1.20 2010/01/07 23:48:54 tbox Exp $ */
19258945Sroberto
20258945Sroberto/*! \file isc/md5.h
21258945Sroberto * \brief This is the header file for the MD5 message-digest algorithm.
22258945Sroberto *
23258945Sroberto * The algorithm is due to Ron Rivest.  This code was
24258945Sroberto * written by Colin Plumb in 1993, no copyright is claimed.
25258945Sroberto * This code is in the public domain; do with it what you wish.
26258945Sroberto *
27258945Sroberto * Equivalent code is available from RSA Data Security, Inc.
28258945Sroberto * This code has been tested against that, and is equivalent,
29258945Sroberto * except that you don't need to include two pages of legalese
30258945Sroberto * with every copy.
31258945Sroberto *
32258945Sroberto * To compute the message digest of a chunk of bytes, declare an
33258945Sroberto * MD5Context structure, pass it to MD5Init, call MD5Update as
34258945Sroberto * needed on buffers full of bytes, and then call MD5Final, which
35258945Sroberto * will fill a supplied 16-byte array with the digest.
36258945Sroberto *
37258945Sroberto * Changed so as no longer to depend on Colin Plumb's `usual.h'
38258945Sroberto * header definitions; now uses stuff from dpkg's config.h
39258945Sroberto *  - Ian Jackson <ijackson@nyx.cs.du.edu>.
40258945Sroberto * Still in the public domain.
41258945Sroberto */
42258945Sroberto
43258945Sroberto#ifndef ISC_MD5_H
44258945Sroberto#define ISC_MD5_H 1
45258945Sroberto
46258945Sroberto#include <isc/lang.h>
47280849Scy#include <isc/platform.h>
48258945Sroberto#include <isc/types.h>
49258945Sroberto
50258945Sroberto#define ISC_MD5_DIGESTLENGTH 16U
51280849Scy#define ISC_MD5_BLOCK_LENGTH 64U
52258945Sroberto
53280849Scy#ifdef ISC_PLATFORM_OPENSSLHASH
54280849Scy#include <openssl/evp.h>
55280849Scy
56280849Scytypedef EVP_MD_CTX isc_md5_t;
57280849Scy
58280849Scy#else
59280849Scy
60258945Srobertotypedef struct {
61258945Sroberto	isc_uint32_t buf[4];
62258945Sroberto	isc_uint32_t bytes[2];
63258945Sroberto	isc_uint32_t in[16];
64258945Sroberto} isc_md5_t;
65280849Scy#endif
66258945Sroberto
67258945SrobertoISC_LANG_BEGINDECLS
68258945Sroberto
69258945Srobertovoid
70258945Srobertoisc_md5_init(isc_md5_t *ctx);
71258945Sroberto
72258945Srobertovoid
73258945Srobertoisc_md5_invalidate(isc_md5_t *ctx);
74258945Sroberto
75258945Srobertovoid
76258945Srobertoisc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len);
77258945Sroberto
78258945Srobertovoid
79258945Srobertoisc_md5_final(isc_md5_t *ctx, unsigned char *digest);
80258945Sroberto
81258945SrobertoISC_LANG_ENDDECLS
82258945Sroberto
83258945Sroberto#endif /* ISC_MD5_H */
84