1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
--- generic/md2.c Wed Aug 9 15:13:17 2000
+++ generic/md2.c Fri Feb 15 14:55:50 2002
@@ -30,13 +30,8 @@
#include "loadman.h"
-/*
- * Generator description
- * ---------------------
- *
- * The MD2 alogrithm is used to compute a cryptographically strong
- * message digest.
- */
+#include <sys/types.h>
+#include <md2.h>
-#define DIGEST_SIZE (MD2_DIGEST_LENGTH)
+#define DIGEST_SIZE 16
#define CTX_TYPE MD2_CTX
@@ -59,9 +54,9 @@
sizeof (CTX_TYPE),
DIGEST_SIZE,
- MDmd2_Start,
+ MD2Init,
MDmd2_Update,
- MDmd2_UpdateBuf,
+ MD2Update,
MDmd2_Final,
- MDmd2_Check
+ NULL
};
@@ -94,30 +89,4 @@
*------------------------------------------------------*
*
- * MDmd2_Start --
- *
- * ------------------------------------------------*
- * Initialize the internal state of the message
- * digest generator.
- * ------------------------------------------------*
- *
- * Sideeffects:
- * As of the called procedure.
- *
- * Result:
- * None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDmd2_Start (context)
-VOID* context;
-{
- md2f.init ((MD2_CTX*) context);
-}
-
-/*
- *------------------------------------------------------*
- *
* MDmd2_Update --
*
@@ -143,33 +112,5 @@
unsigned char buf = character;
- md2f.update ((MD2_CTX*) context, &buf, 1);
-}
-
-/*
- *------------------------------------------------------*
- *
- * MDmd2_UpdateBuf --
- *
- * ------------------------------------------------*
- * Update the internal state of the message digest
- * generator for a character buffer.
- * ------------------------------------------------*
- *
- * Sideeffects:
- * As of the called procedure.
- *
- * Result:
- * None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDmd2_UpdateBuf (context, buffer, bufLen)
-VOID* context;
-unsigned char* buffer;
-int bufLen;
-{
- md2f.update ((MD2_CTX*) context, (unsigned char*) buffer, bufLen);
+ MD2Update ((MD2_CTX*) context, &buf, 1);
}
@@ -198,31 +139,4 @@
VOID* digest;
{
- md2f.final ((unsigned char*) digest, (MD2_CTX*) context);
-}
-
-/*
- *------------------------------------------------------*
- *
- * MDmd2_Check --
- *
- * ------------------------------------------------*
- * Do global one-time initializations of the message
- * digest generator.
- * ------------------------------------------------*
- *
- * Sideeffects:
- * Loads the shared library containing the
- * MD2 functionality
- *
- * Result:
- * A standard Tcl error code.
- *
- *------------------------------------------------------*
- */
-
-static int
-MDmd2_Check (interp)
-Tcl_Interp* interp;
-{
- return TrfLoadMD2 (interp);
+ MD2Final ((unsigned char*) digest, (MD2_CTX*) context);
}
|