xref: /OK3568_Linux_fs/u-boot/lib/md5.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This file was transplanted with slight modifications from Linux sources
3*4882a593Smuzhiyun  * (fs/cifs/md5.c) into U-Boot by Bartlomiej Sieka <tur@semihalf.com>.
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun /*
7*4882a593Smuzhiyun  * This code implements the MD5 message-digest algorithm.
8*4882a593Smuzhiyun  * The algorithm is due to Ron Rivest.  This code was
9*4882a593Smuzhiyun  * written by Colin Plumb in 1993, no copyright is claimed.
10*4882a593Smuzhiyun  * This code is in the public domain; do with it what you wish.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Equivalent code is available from RSA Data Security, Inc.
13*4882a593Smuzhiyun  * This code has been tested against that, and is equivalent,
14*4882a593Smuzhiyun  * except that you don't need to include two pages of legalese
15*4882a593Smuzhiyun  * with every copy.
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  * To compute the message digest of a chunk of bytes, declare an
18*4882a593Smuzhiyun  * MD5Context structure, pass it to MD5Init, call MD5Update as
19*4882a593Smuzhiyun  * needed on buffers full of bytes, and then call MD5Final, which
20*4882a593Smuzhiyun  * will fill a supplied 16-byte array with the digest.
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun /* This code slightly modified to fit into Samba by
24*4882a593Smuzhiyun    abartlet@samba.org Jun 2001
25*4882a593Smuzhiyun    and to fit the cifs vfs by
26*4882a593Smuzhiyun    Steve French sfrench@us.ibm.com */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #include "compiler.h"
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #ifndef USE_HOSTCC
31*4882a593Smuzhiyun #include <common.h>
32*4882a593Smuzhiyun #include <watchdog.h>
33*4882a593Smuzhiyun #endif /* USE_HOSTCC */
34*4882a593Smuzhiyun #include <u-boot/md5.h>
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun static void
37*4882a593Smuzhiyun MD5Transform(__u32 buf[4], __u32 const in[16]);
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun /*
40*4882a593Smuzhiyun  * Note: this code is harmless on little-endian machines.
41*4882a593Smuzhiyun  */
42*4882a593Smuzhiyun static void
byteReverse(unsigned char * buf,unsigned longs)43*4882a593Smuzhiyun byteReverse(unsigned char *buf, unsigned longs)
44*4882a593Smuzhiyun {
45*4882a593Smuzhiyun 	__u32 t;
46*4882a593Smuzhiyun 	do {
47*4882a593Smuzhiyun 		t = (__u32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
48*4882a593Smuzhiyun 		    ((unsigned) buf[1] << 8 | buf[0]);
49*4882a593Smuzhiyun 		*(__u32 *) buf = t;
50*4882a593Smuzhiyun 		buf += 4;
51*4882a593Smuzhiyun 	} while (--longs);
52*4882a593Smuzhiyun }
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun /*
55*4882a593Smuzhiyun  * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
56*4882a593Smuzhiyun  * initialization constants.
57*4882a593Smuzhiyun  */
58*4882a593Smuzhiyun static void
MD5Init(struct MD5Context * ctx)59*4882a593Smuzhiyun MD5Init(struct MD5Context *ctx)
60*4882a593Smuzhiyun {
61*4882a593Smuzhiyun 	ctx->buf[0] = 0x67452301;
62*4882a593Smuzhiyun 	ctx->buf[1] = 0xefcdab89;
63*4882a593Smuzhiyun 	ctx->buf[2] = 0x98badcfe;
64*4882a593Smuzhiyun 	ctx->buf[3] = 0x10325476;
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun 	ctx->bits[0] = 0;
67*4882a593Smuzhiyun 	ctx->bits[1] = 0;
68*4882a593Smuzhiyun }
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun /*
71*4882a593Smuzhiyun  * Update context to reflect the concatenation of another buffer full
72*4882a593Smuzhiyun  * of bytes.
73*4882a593Smuzhiyun  */
74*4882a593Smuzhiyun static void
MD5Update(struct MD5Context * ctx,unsigned char const * buf,unsigned len)75*4882a593Smuzhiyun MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
76*4882a593Smuzhiyun {
77*4882a593Smuzhiyun 	register __u32 t;
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun 	/* Update bitcount */
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun 	t = ctx->bits[0];
82*4882a593Smuzhiyun 	if ((ctx->bits[0] = t + ((__u32) len << 3)) < t)
83*4882a593Smuzhiyun 		ctx->bits[1]++;	/* Carry from low to high */
84*4882a593Smuzhiyun 	ctx->bits[1] += len >> 29;
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun 	t = (t >> 3) & 0x3f;	/* Bytes already in shsInfo->data */
87*4882a593Smuzhiyun 
88*4882a593Smuzhiyun 	/* Handle any leading odd-sized chunks */
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun 	if (t) {
91*4882a593Smuzhiyun 		unsigned char *p = (unsigned char *) ctx->in + t;
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun 		t = 64 - t;
94*4882a593Smuzhiyun 		if (len < t) {
95*4882a593Smuzhiyun 			memmove(p, buf, len);
96*4882a593Smuzhiyun 			return;
97*4882a593Smuzhiyun 		}
98*4882a593Smuzhiyun 		memmove(p, buf, t);
99*4882a593Smuzhiyun 		byteReverse(ctx->in, 16);
100*4882a593Smuzhiyun 		MD5Transform(ctx->buf, (__u32 *) ctx->in);
101*4882a593Smuzhiyun 		buf += t;
102*4882a593Smuzhiyun 		len -= t;
103*4882a593Smuzhiyun 	}
104*4882a593Smuzhiyun 	/* Process data in 64-byte chunks */
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun 	while (len >= 64) {
107*4882a593Smuzhiyun 		memmove(ctx->in, buf, 64);
108*4882a593Smuzhiyun 		byteReverse(ctx->in, 16);
109*4882a593Smuzhiyun 		MD5Transform(ctx->buf, (__u32 *) ctx->in);
110*4882a593Smuzhiyun 		buf += 64;
111*4882a593Smuzhiyun 		len -= 64;
112*4882a593Smuzhiyun 	}
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun 	/* Handle any remaining bytes of data. */
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun 	memmove(ctx->in, buf, len);
117*4882a593Smuzhiyun }
118*4882a593Smuzhiyun 
119*4882a593Smuzhiyun /*
120*4882a593Smuzhiyun  * Final wrapup - pad to 64-byte boundary with the bit pattern
121*4882a593Smuzhiyun  * 1 0* (64-bit count of bits processed, MSB-first)
122*4882a593Smuzhiyun  */
123*4882a593Smuzhiyun static void
MD5Final(unsigned char digest[16],struct MD5Context * ctx)124*4882a593Smuzhiyun MD5Final(unsigned char digest[16], struct MD5Context *ctx)
125*4882a593Smuzhiyun {
126*4882a593Smuzhiyun 	unsigned int count;
127*4882a593Smuzhiyun 	unsigned char *p;
128*4882a593Smuzhiyun 
129*4882a593Smuzhiyun 	/* Compute number of bytes mod 64 */
130*4882a593Smuzhiyun 	count = (ctx->bits[0] >> 3) & 0x3F;
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun 	/* Set the first char of padding to 0x80.  This is safe since there is
133*4882a593Smuzhiyun 	   always at least one byte free */
134*4882a593Smuzhiyun 	p = ctx->in + count;
135*4882a593Smuzhiyun 	*p++ = 0x80;
136*4882a593Smuzhiyun 
137*4882a593Smuzhiyun 	/* Bytes of padding needed to make 64 bytes */
138*4882a593Smuzhiyun 	count = 64 - 1 - count;
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun 	/* Pad out to 56 mod 64 */
141*4882a593Smuzhiyun 	if (count < 8) {
142*4882a593Smuzhiyun 		/* Two lots of padding:  Pad the first block to 64 bytes */
143*4882a593Smuzhiyun 		memset(p, 0, count);
144*4882a593Smuzhiyun 		byteReverse(ctx->in, 16);
145*4882a593Smuzhiyun 		MD5Transform(ctx->buf, (__u32 *) ctx->in);
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun 		/* Now fill the next block with 56 bytes */
148*4882a593Smuzhiyun 		memset(ctx->in, 0, 56);
149*4882a593Smuzhiyun 	} else {
150*4882a593Smuzhiyun 		/* Pad block to 56 bytes */
151*4882a593Smuzhiyun 		memset(p, 0, count - 8);
152*4882a593Smuzhiyun 	}
153*4882a593Smuzhiyun 	byteReverse(ctx->in, 14);
154*4882a593Smuzhiyun 
155*4882a593Smuzhiyun 	/* Append length in bits and transform */
156*4882a593Smuzhiyun 	ctx->in32[14] = ctx->bits[0];
157*4882a593Smuzhiyun 	ctx->in32[15] = ctx->bits[1];
158*4882a593Smuzhiyun 
159*4882a593Smuzhiyun 	MD5Transform(ctx->buf, (__u32 *) ctx->in);
160*4882a593Smuzhiyun 	byteReverse((unsigned char *) ctx->buf, 4);
161*4882a593Smuzhiyun 	memmove(digest, ctx->buf, 16);
162*4882a593Smuzhiyun 	memset(ctx, 0, sizeof(*ctx));	/* In case it's sensitive */
163*4882a593Smuzhiyun }
164*4882a593Smuzhiyun 
165*4882a593Smuzhiyun /* The four core functions - F1 is optimized somewhat */
166*4882a593Smuzhiyun 
167*4882a593Smuzhiyun /* #define F1(x, y, z) (x & y | ~x & z) */
168*4882a593Smuzhiyun #define F1(x, y, z) (z ^ (x & (y ^ z)))
169*4882a593Smuzhiyun #define F2(x, y, z) F1(z, x, y)
170*4882a593Smuzhiyun #define F3(x, y, z) (x ^ y ^ z)
171*4882a593Smuzhiyun #define F4(x, y, z) (y ^ (x | ~z))
172*4882a593Smuzhiyun 
173*4882a593Smuzhiyun /* This is the central step in the MD5 algorithm. */
174*4882a593Smuzhiyun #define MD5STEP(f, w, x, y, z, data, s) \
175*4882a593Smuzhiyun 	( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
176*4882a593Smuzhiyun 
177*4882a593Smuzhiyun /*
178*4882a593Smuzhiyun  * The core of the MD5 algorithm, this alters an existing MD5 hash to
179*4882a593Smuzhiyun  * reflect the addition of 16 longwords of new data.  MD5Update blocks
180*4882a593Smuzhiyun  * the data and converts bytes into longwords for this routine.
181*4882a593Smuzhiyun  */
182*4882a593Smuzhiyun static void
MD5Transform(__u32 buf[4],__u32 const in[16])183*4882a593Smuzhiyun MD5Transform(__u32 buf[4], __u32 const in[16])
184*4882a593Smuzhiyun {
185*4882a593Smuzhiyun 	register __u32 a, b, c, d;
186*4882a593Smuzhiyun 
187*4882a593Smuzhiyun 	a = buf[0];
188*4882a593Smuzhiyun 	b = buf[1];
189*4882a593Smuzhiyun 	c = buf[2];
190*4882a593Smuzhiyun 	d = buf[3];
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun 	MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
193*4882a593Smuzhiyun 	MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
194*4882a593Smuzhiyun 	MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
195*4882a593Smuzhiyun 	MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
196*4882a593Smuzhiyun 	MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
197*4882a593Smuzhiyun 	MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
198*4882a593Smuzhiyun 	MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
199*4882a593Smuzhiyun 	MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
200*4882a593Smuzhiyun 	MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
201*4882a593Smuzhiyun 	MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
202*4882a593Smuzhiyun 	MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
203*4882a593Smuzhiyun 	MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
204*4882a593Smuzhiyun 	MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
205*4882a593Smuzhiyun 	MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
206*4882a593Smuzhiyun 	MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
207*4882a593Smuzhiyun 	MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
208*4882a593Smuzhiyun 
209*4882a593Smuzhiyun 	MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
210*4882a593Smuzhiyun 	MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
211*4882a593Smuzhiyun 	MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
212*4882a593Smuzhiyun 	MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
213*4882a593Smuzhiyun 	MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
214*4882a593Smuzhiyun 	MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
215*4882a593Smuzhiyun 	MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
216*4882a593Smuzhiyun 	MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
217*4882a593Smuzhiyun 	MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
218*4882a593Smuzhiyun 	MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
219*4882a593Smuzhiyun 	MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
220*4882a593Smuzhiyun 	MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
221*4882a593Smuzhiyun 	MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
222*4882a593Smuzhiyun 	MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
223*4882a593Smuzhiyun 	MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
224*4882a593Smuzhiyun 	MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
225*4882a593Smuzhiyun 
226*4882a593Smuzhiyun 	MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
227*4882a593Smuzhiyun 	MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
228*4882a593Smuzhiyun 	MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
229*4882a593Smuzhiyun 	MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
230*4882a593Smuzhiyun 	MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
231*4882a593Smuzhiyun 	MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
232*4882a593Smuzhiyun 	MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
233*4882a593Smuzhiyun 	MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
234*4882a593Smuzhiyun 	MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
235*4882a593Smuzhiyun 	MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
236*4882a593Smuzhiyun 	MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
237*4882a593Smuzhiyun 	MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
238*4882a593Smuzhiyun 	MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
239*4882a593Smuzhiyun 	MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
240*4882a593Smuzhiyun 	MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
241*4882a593Smuzhiyun 	MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
242*4882a593Smuzhiyun 
243*4882a593Smuzhiyun 	MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
244*4882a593Smuzhiyun 	MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
245*4882a593Smuzhiyun 	MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
246*4882a593Smuzhiyun 	MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
247*4882a593Smuzhiyun 	MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
248*4882a593Smuzhiyun 	MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
249*4882a593Smuzhiyun 	MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
250*4882a593Smuzhiyun 	MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
251*4882a593Smuzhiyun 	MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
252*4882a593Smuzhiyun 	MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
253*4882a593Smuzhiyun 	MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
254*4882a593Smuzhiyun 	MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
255*4882a593Smuzhiyun 	MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
256*4882a593Smuzhiyun 	MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
257*4882a593Smuzhiyun 	MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
258*4882a593Smuzhiyun 	MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
259*4882a593Smuzhiyun 
260*4882a593Smuzhiyun 	buf[0] += a;
261*4882a593Smuzhiyun 	buf[1] += b;
262*4882a593Smuzhiyun 	buf[2] += c;
263*4882a593Smuzhiyun 	buf[3] += d;
264*4882a593Smuzhiyun }
265*4882a593Smuzhiyun 
266*4882a593Smuzhiyun /*
267*4882a593Smuzhiyun  * Calculate and store in 'output' the MD5 digest of 'len' bytes at
268*4882a593Smuzhiyun  * 'input'. 'output' must have enough space to hold 16 bytes.
269*4882a593Smuzhiyun  */
270*4882a593Smuzhiyun void
md5(unsigned char * input,int len,unsigned char output[16])271*4882a593Smuzhiyun md5 (unsigned char *input, int len, unsigned char output[16])
272*4882a593Smuzhiyun {
273*4882a593Smuzhiyun 	struct MD5Context context;
274*4882a593Smuzhiyun 
275*4882a593Smuzhiyun 	MD5Init(&context);
276*4882a593Smuzhiyun 	MD5Update(&context, input, len);
277*4882a593Smuzhiyun 	MD5Final(output, &context);
278*4882a593Smuzhiyun }
279*4882a593Smuzhiyun 
280*4882a593Smuzhiyun 
281*4882a593Smuzhiyun /*
282*4882a593Smuzhiyun  * Calculate and store in 'output' the MD5 digest of 'len' bytes at 'input'.
283*4882a593Smuzhiyun  * 'output' must have enough space to hold 16 bytes. If 'chunk' Trigger the
284*4882a593Smuzhiyun  * watchdog every 'chunk_sz' bytes of input processed.
285*4882a593Smuzhiyun  */
286*4882a593Smuzhiyun void
md5_wd(unsigned char * input,int len,unsigned char output[16],unsigned int chunk_sz)287*4882a593Smuzhiyun md5_wd (unsigned char *input, int len, unsigned char output[16],
288*4882a593Smuzhiyun 	unsigned int chunk_sz)
289*4882a593Smuzhiyun {
290*4882a593Smuzhiyun 	struct MD5Context context;
291*4882a593Smuzhiyun #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
292*4882a593Smuzhiyun 	unsigned char *end, *curr;
293*4882a593Smuzhiyun 	int chunk;
294*4882a593Smuzhiyun #endif
295*4882a593Smuzhiyun 
296*4882a593Smuzhiyun 	MD5Init(&context);
297*4882a593Smuzhiyun 
298*4882a593Smuzhiyun #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
299*4882a593Smuzhiyun 	curr = input;
300*4882a593Smuzhiyun 	end = input + len;
301*4882a593Smuzhiyun 	while (curr < end) {
302*4882a593Smuzhiyun 		chunk = end - curr;
303*4882a593Smuzhiyun 		if (chunk > chunk_sz)
304*4882a593Smuzhiyun 			chunk = chunk_sz;
305*4882a593Smuzhiyun 		MD5Update(&context, curr, chunk);
306*4882a593Smuzhiyun 		curr += chunk;
307*4882a593Smuzhiyun 		WATCHDOG_RESET ();
308*4882a593Smuzhiyun 	}
309*4882a593Smuzhiyun #else
310*4882a593Smuzhiyun 	MD5Update(&context, input, len);
311*4882a593Smuzhiyun #endif
312*4882a593Smuzhiyun 
313*4882a593Smuzhiyun 	MD5Final(output, &context);
314*4882a593Smuzhiyun }
315