~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to include/md5.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SQUID_MD5_H
 
2
#define SQUID_MD5_H
 
3
 
 
4
#if USE_OPENSSL
 
5
 
 
6
/*
 
7
 * If Squid is compiled with OpenSSL then we use the MD5 routines
 
8
 * from there via some wrapper macros, and the rest of this file is ignored..
 
9
 */
 
10
 
 
11
#if HAVE_OPENSSL_MD5_H
 
12
#include <openssl/md5.h>
 
13
#else
 
14
#error Cannot find OpenSSL headers
 
15
#endif
 
16
 
 
17
/* Hack to adopt Squid to the OpenSSL syntax */
 
18
#define MD5_DIGEST_CHARS MD5_DIGEST_LENGTH
 
19
 
 
20
#define MD5Init MD5_Init
 
21
#define MD5Update MD5_Update
 
22
#define MD5Final MD5_Final
 
23
 
 
24
#else /* USE_OPENSSL */
 
25
 
 
26
/*
 
27
 * This is the header file for the MD5 message-digest algorithm.
 
28
 * The algorithm is due to Ron Rivest.  This code was
 
29
 * written by Colin Plumb in 1993, no copyright is claimed.
 
30
 * This code is in the public domain; do with it what you wish.
 
31
 *
 
32
 * Equivalent code is available from RSA Data Security, Inc.
 
33
 * This code has been tested against that, and is equivalent,
 
34
 * except that you don't need to include two pages of legalese
 
35
 * with every copy.
 
36
 *
 
37
 * To compute the message digest of a chunk of bytes, declare an
 
38
 * MD5Context structure, pass it to MD5Init, call MD5Update as
 
39
 * needed on buffers full of bytes, and then call MD5Final, which
 
40
 * will fill a supplied 16-byte array with the digest.
 
41
 *
 
42
 * Changed so as no longer to depend on Colin Plumb's `usual.h'
 
43
 * header definitions; now uses stuff from dpkg's config.h
 
44
 *  - Ian Jackson <ian@chiark.greenend.org.uk>.
 
45
 * Still in the public domain.
 
46
 *
 
47
 * Changed MD5Update to take a void * for easier use and some other
 
48
 * minor cleanup. - Henrik Nordstrom <henrik@henriknordstrom.net>.
 
49
 * Still in the public domain.
 
50
 *
 
51
 */
 
52
 
 
53
#include "squid_types.h"
 
54
 
 
55
typedef struct MD5Context {
 
56
    uint32_t buf[4];
 
57
    uint32_t bytes[2];
 
58
    uint32_t in[16];
 
59
} MD5_CTX;
 
60
 
 
61
SQUIDCEXTERN void MD5Init(struct MD5Context *context);
 
62
SQUIDCEXTERN void MD5Update(struct MD5Context *context, const void *buf, unsigned len);
 
63
SQUIDCEXTERN void MD5Final(uint8_t digest[16], struct MD5Context *context);
 
64
SQUIDCEXTERN void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
 
65
 
 
66
#define MD5_DIGEST_CHARS         16
 
67
 
 
68
#endif /* USE_OPENSSL */
 
69
#endif /* SQUID_MD5_H */