summaryrefslogtreecommitdiff
path: root/devel/tcl-trf/files/patch-md5dig
blob: 557a90d7806fa992e147d761bde317212e92c2bf (plain) (blame)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
--- generic/md5dig.c	Wed Aug  9 15:13:17 2000
+++ generic/md5dig.c	Fri Feb 15 00:41:42 2002
@@ -29,5 +29,5 @@
 
 #include "loadman.h"
-
+#include <md5.h>
 /*
  * Generator description
@@ -38,7 +38,4 @@
  */
 
-#define MD5_CTX  struct md5_ctx
-#define MD5_CTXP (struct md5_ctx*)
-
 #ifndef OTP
 #define DIGEST_SIZE               (16)
@@ -72,9 +69,9 @@
   sizeof (CTX_TYPE),
   DIGEST_SIZE,
-  MDmd5_Start,
+  MD5Init,
   MDmd5_Update,
-  MDmd5_UpdateBuf,
+  MD5Update,
   MDmd5_Final,
-  MDmd5_Check
+  NULL,
 };
 
@@ -111,38 +108,4 @@
  *------------------------------------------------------*
  *
- *	MDmd5_Start --
- *
- *	------------------------------------------------*
- *	Initialize the internal state of the message
- *	digest generator.
- *	------------------------------------------------*
- *
- *	Sideeffects:
- *		As of the called procedure.
- *
- *	Result:
- *		None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDmd5_Start (context)
-VOID* context;
-{
-  /*  MD5Init ((MD5_CTX*) context);*/
-  md5f.init (MD5_CTXP context);
-
-#ifdef TRF_DEBUG
-  {
-    MD5_CTX* c = MD5_CTXP context;
-    PRINT ("Init ABCD = %d %d %d %d\n", c->A, c->B, c->C, c->D); FL;
-  }
-#endif
-}
-
-/*
- *------------------------------------------------------*
- *
  *	MDmd5_Update --
  *
@@ -168,52 +131,5 @@
   unsigned char buf = character;
 
-  /*  MD5Update ((MD5_CTX*) context, &buf, 1); */
-
-  md5f.update (&buf, 1, MD5_CTXP context);
-}
-
-/*
- *------------------------------------------------------*
- *
- *	MDmd5_UpdateBuf --
- *
- *	------------------------------------------------*
- *	Update the internal state of the message digest
- *	generator for a character buffer.
- *	------------------------------------------------*
- *
- *	Sideeffects:
- *		As of the called procedure.
- *
- *	Result:
- *		None.
- *
- *------------------------------------------------------*
- */
-
-static void
-MDmd5_UpdateBuf (context, buffer, bufLen)
-VOID* context;
-unsigned char* buffer;
-int   bufLen;
-{
-  /*  MD5Update ((MD5_CTX*) context, (unsigned char*) buffer, bufLen);*/
-
-  PRTSTR ("update by %d (%s)\n", bufLen, buffer);
-#ifdef TRF_DEBUG
-  {
-    MD5_CTX* c = MD5_CTXP context;
-    PRINT ("Upd1 ABCD = %d %d %d %d\n", c->A, c->B, c->C, c->D); FL;
-  }
-#endif
-
-  md5f.update ((unsigned char*) buffer, bufLen, MD5_CTXP context);
-
-#ifdef TRF_DEBUG
-  {
-    MD5_CTX* c = MD5_CTXP context;
-    PRINT ("Upd2 ABCD = %d %d %d %d\n", c->A, c->B, c->C, c->D); FL;
-  }
-#endif
+  MD5Update ((MD5_CTX*) context, &buf, 1);
 }
 
@@ -243,6 +159,5 @@
 {
 #ifndef OTP
-  /*  MD5Final ((unsigned char*) digest, (MD5_CTX*) context); */
-  md5f.final (MD5_CTXP context, (unsigned char*) digest);
+  MD5Final ((unsigned char*) digest, (MD5_CTX*) context);
 #else
     int    i;
@@ -250,5 +165,5 @@
 
     /*    MD5Final ((unsigned char*) result, (MD5_CTX*) context);*/
-    md5f.final (MD5_CTXP context, (unsigned char*) result);
+    MD5Final ((unsigned char*) result, (MD5_CTX*) context);
 
     for (i = 0; i < 8; i++)
@@ -265,54 +180,2 @@
 #endif
 }
-
-/*
- *------------------------------------------------------*
- *
- *	MDmd5_Check --
- *
- *	------------------------------------------------*
- *	Do global one-time initializations of the message
- *	digest generator.
- *	------------------------------------------------*
- *
- *	Sideeffects:
- *		Loads the shared library containing the
- *		SHA1 functionality
- *
- *	Result:
- *		A standard Tcl error code.
- *
- *------------------------------------------------------*
- */
-
-static int
-MDmd5_Check (interp)
-Tcl_Interp* interp;
-{
-#ifdef MD5_STATIC_BUILD
-  return TCL_OK;
-#else
-  return TrfLoadMD5 (interp);
-#endif
-}
-
-/* Import the MD5 code in case of static linkage.
- */
-#ifdef MD5_STATIC_BUILD
-/*
- * External code from here on.
- */
-
-#ifndef OTP
-#include "../md5-crypt/md5.c" /* THREADING: import of one constant var, read-only => safe */
-#endif
-
-md5Functions md5f = {
-  0,
-  md5_init_ctx,
-  md5_process_bytes,
-  md5_finish_ctx,
-  0, /* no crypt code! */
-};
-
-#endif