~ubuntu-branches/ubuntu/lucid/apr-util/lucid

« back to all changes in this revision

Viewing changes to include/apr_md4.h

  • Committer: Bazaar Package Importer
  • Author(s): Tollef Fog Heen
  • Date: 2006-08-18 19:50:31 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060818195031-vddj2q74qlfp4gtx
Tags: 1.2.7+dfsg-2
Fix stupid code duplication in apr_md[45].c resulting from C&P.
Thanks to Peter Samuelson for notifying me.  This makes md[45] work
correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
2
 
 * applicable.
3
 
 *
4
 
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 
 * you may not use this file except in compliance with the License.
6
 
 * You may obtain a copy of the License at
7
 
 *
8
 
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 
 *
10
 
 * Unless required by applicable law or agreed to in writing, software
11
 
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 
 * See the License for the specific language governing permissions and
14
 
 * limitations under the License.
15
 
 */
16
 
/* This is derived from material copyright RSA Data Security, Inc.
17
 
 * Their notice is reproduced below in its entirety.
18
 
 *
19
 
 * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
20
 
 * rights reserved.
21
 
 *
22
 
 * License to copy and use this software is granted provided that it
23
 
 * is identified as the "RSA Data Security, Inc. MD4 Message-Digest
24
 
 * Algorithm" in all material mentioning or referencing this software
25
 
 * or this function.
26
 
 *
27
 
 * License is also granted to make and use derivative works provided
28
 
 * that such works are identified as "derived from the RSA Data
29
 
 * Security, Inc. MD4 Message-Digest Algorithm" in all material
30
 
 * mentioning or referencing the derived work.
31
 
 *
32
 
 * RSA Data Security, Inc. makes no representations concerning either
33
 
 * the merchantability of this software or the suitability of this
34
 
 * software for any particular purpose. It is provided "as is"
35
 
 * without express or implied warranty of any kind.
36
 
 *
37
 
 * These notices must be retained in any copies of any part of this
38
 
 * documentation and/or software.
39
 
 */
40
 
 
41
 
#ifndef APR_MD4_H
42
 
#define APR_MD4_H
43
 
 
44
 
#include "apu.h"
45
 
#include "apr_xlate.h"
46
 
/**
47
 
 * @file apr_md4.h
48
 
 * @brief APR-UTIL MD4 Library
49
 
 */
50
 
#ifdef __cplusplus
51
 
extern "C" {
52
 
#endif
53
 
 
54
 
/**
55
 
 * @defgroup APR_Util_MD4 MD4 Library
56
 
 * @ingroup APR_Util
57
 
 * @{
58
 
 */
59
 
 
60
 
/** The digestsize for MD4 */
61
 
#define APR_MD4_DIGESTSIZE 16
62
 
 
63
 
/** @see apr_md4_ctx_t */
64
 
typedef struct apr_md4_ctx_t apr_md4_ctx_t;
65
 
 
66
 
/** MD4 context. */
67
 
struct apr_md4_ctx_t {
68
 
    /** state (ABCD) */
69
 
    apr_uint32_t state[4];
70
 
    /** number of bits, modulo 2^64 (lsb first) */
71
 
    apr_uint32_t count[2];
72
 
    /** input buffer */
73
 
    unsigned char buffer[64];
74
 
#if APR_HAS_XLATE
75
 
    /** translation handle */
76
 
    apr_xlate_t *xlate;
77
 
#endif
78
 
};
79
 
 
80
 
/**
81
 
 * MD4 Initialize.  Begins an MD4 operation, writing a new context.
82
 
 * @param context The MD4 context to initialize.
83
 
 */
84
 
APU_DECLARE(apr_status_t) apr_md4_init(apr_md4_ctx_t *context);
85
 
 
86
 
#if APR_HAS_XLATE
87
 
/**
88
 
 * MDr4 translation setup.  Provides the APR translation handle to be used 
89
 
 * for translating the content before calculating the digest.
90
 
 * @param context The MD4 content to set the translation for.
91
 
 * @param xlate The translation handle to use for this MD4 context 
92
 
 */
93
 
APU_DECLARE(apr_status_t) apr_md4_set_xlate(apr_md4_ctx_t *context,
94
 
                                            apr_xlate_t *xlate);
95
 
#else
96
 
#define apr_md4_set_xlate(context, xlate) APR_ENOTIMPL
97
 
#endif
98
 
 
99
 
/**
100
 
 * MD4 block update operation.  Continue an MD4 message-digest operation, 
101
 
 * processing another message block, and updating the context.
102
 
 * @param context The MD4 content to update.
103
 
 * @param input next message block to update
104
 
 * @param inputLen The length of the next message block
105
 
 */
106
 
APU_DECLARE(apr_status_t) apr_md4_update(apr_md4_ctx_t *context,
107
 
                                         const unsigned char *input,
108
 
                                         apr_size_t inputLen);
109
 
 
110
 
/**
111
 
 * MD4 finalization.  Ends an MD4 message-digest operation, writing the 
112
 
 * message digest and zeroing the context
113
 
 * @param digest The final MD4 digest
114
 
 * @param context The MD4 content we are finalizing.
115
 
 */
116
 
APU_DECLARE(apr_status_t) apr_md4_final(
117
 
                                    unsigned char digest[APR_MD4_DIGESTSIZE],
118
 
                                    apr_md4_ctx_t *context);
119
 
 
120
 
/**
121
 
 * MD4 digest computation
122
 
 * @param digest The MD4 digest
123
 
 * @param input message block to use
124
 
 * @param inputLen The length of the message block
125
 
 */
126
 
APU_DECLARE(apr_status_t) apr_md4(unsigned char digest[APR_MD4_DIGESTSIZE],
127
 
                                  const unsigned char *input,
128
 
                                  apr_size_t inputLen);
129
 
 
130
 
/** @} */
131
 
#ifdef __cplusplus
132
 
}
133
 
#endif
134
 
 
135
 
#endif /* !APR_MD4_H */