blob: 62f619bc0dc8e3f417d710291c085cafa2f2e16d [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/*
2 * RFC 1321 compliant MD5 implementation
3 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00004 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
Paul Bakkerb96f1542010-07-18 20:36:00 +00005 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +00006 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakkerb96f1542010-07-18 20:36:00 +00007 *
Paul Bakker5121ce52009-01-03 21:22:43 +00008 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22/*
23 * The MD5 algorithm was designed by Ron Rivest in 1991.
24 *
25 * http://www.ietf.org/rfc/rfc1321.txt
26 */
27
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020028#if !defined(POLARSSL_CONFIG_FILE)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000029#include "mbedtls/config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020030#else
31#include POLARSSL_CONFIG_FILE
32#endif
Paul Bakker5121ce52009-01-03 21:22:43 +000033
Paul Bakker40e46942009-01-03 21:51:57 +000034#if defined(POLARSSL_MD5_C)
Paul Bakker5121ce52009-01-03 21:22:43 +000035
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000036#include "mbedtls/md5.h"
Paul Bakker5121ce52009-01-03 21:22:43 +000037
Rich Evans00ab4702015-02-06 13:43:58 +000038#include <string.h>
39
40#if defined(POLARSSL_FS_IO)
Paul Bakker5121ce52009-01-03 21:22:43 +000041#include <stdio.h>
Paul Bakker335db3f2011-04-25 15:28:35 +000042#endif
Paul Bakker5121ce52009-01-03 21:22:43 +000043
Rich Evans00ab4702015-02-06 13:43:58 +000044#if defined(POLARSSL_SELF_TEST)
Paul Bakker7dc4c442014-02-01 22:50:26 +010045#if defined(POLARSSL_PLATFORM_C)
Manuel Pégourié-Gonnard7f809972015-03-09 17:05:11 +000046#include "mbedtls/platform.h"
Paul Bakker7dc4c442014-02-01 22:50:26 +010047#else
Rich Evans00ab4702015-02-06 13:43:58 +000048#include <stdio.h>
Paul Bakker7dc4c442014-02-01 22:50:26 +010049#define polarssl_printf printf
Rich Evans00ab4702015-02-06 13:43:58 +000050#endif /* POLARSSL_PLATFORM_C */
51#endif /* POLARSSL_SELF_TEST */
Paul Bakker7dc4c442014-02-01 22:50:26 +010052
Paul Bakker34617722014-06-13 17:20:13 +020053/* Implementation that should never be optimized out by the compiler */
54static void polarssl_zeroize( void *v, size_t n ) {
55 volatile unsigned char *p = v; while( n-- ) *p++ = 0;
56}
57
Paul Bakker90995b52013-06-24 19:20:35 +020058#if !defined(POLARSSL_MD5_ALT)
59
Paul Bakker5121ce52009-01-03 21:22:43 +000060/*
61 * 32-bit integer manipulation macros (little endian)
62 */
Paul Bakker5c2364c2012-10-01 14:41:15 +000063#ifndef GET_UINT32_LE
64#define GET_UINT32_LE(n,b,i) \
Paul Bakker5121ce52009-01-03 21:22:43 +000065{ \
Paul Bakker5c2364c2012-10-01 14:41:15 +000066 (n) = ( (uint32_t) (b)[(i) ] ) \
67 | ( (uint32_t) (b)[(i) + 1] << 8 ) \
68 | ( (uint32_t) (b)[(i) + 2] << 16 ) \
69 | ( (uint32_t) (b)[(i) + 3] << 24 ); \
Paul Bakker5121ce52009-01-03 21:22:43 +000070}
71#endif
72
Paul Bakker5c2364c2012-10-01 14:41:15 +000073#ifndef PUT_UINT32_LE
Manuel Pégourié-Gonnardceedb822015-01-23 15:02:43 +000074#define PUT_UINT32_LE(n,b,i) \
75{ \
76 (b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
77 (b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
78 (b)[(i) + 2] = (unsigned char) ( ( (n) >> 16 ) & 0xFF ); \
79 (b)[(i) + 3] = (unsigned char) ( ( (n) >> 24 ) & 0xFF ); \
Paul Bakker5121ce52009-01-03 21:22:43 +000080}
81#endif
82
Paul Bakker5b4af392014-06-26 12:09:34 +020083void md5_init( md5_context *ctx )
84{
85 memset( ctx, 0, sizeof( md5_context ) );
86}
87
88void md5_free( md5_context *ctx )
89{
90 if( ctx == NULL )
91 return;
92
93 polarssl_zeroize( ctx, sizeof( md5_context ) );
94}
95
Paul Bakker5121ce52009-01-03 21:22:43 +000096/*
97 * MD5 context setup
98 */
99void md5_starts( md5_context *ctx )
100{
101 ctx->total[0] = 0;
102 ctx->total[1] = 0;
103
104 ctx->state[0] = 0x67452301;
105 ctx->state[1] = 0xEFCDAB89;
106 ctx->state[2] = 0x98BADCFE;
107 ctx->state[3] = 0x10325476;
108}
109
Paul Bakkere47b34b2013-02-27 14:48:00 +0100110void md5_process( md5_context *ctx, const unsigned char data[64] )
Paul Bakker5121ce52009-01-03 21:22:43 +0000111{
Paul Bakker5c2364c2012-10-01 14:41:15 +0000112 uint32_t X[16], A, B, C, D;
Paul Bakker5121ce52009-01-03 21:22:43 +0000113
Paul Bakker5c2364c2012-10-01 14:41:15 +0000114 GET_UINT32_LE( X[ 0], data, 0 );
115 GET_UINT32_LE( X[ 1], data, 4 );
116 GET_UINT32_LE( X[ 2], data, 8 );
117 GET_UINT32_LE( X[ 3], data, 12 );
118 GET_UINT32_LE( X[ 4], data, 16 );
119 GET_UINT32_LE( X[ 5], data, 20 );
120 GET_UINT32_LE( X[ 6], data, 24 );
121 GET_UINT32_LE( X[ 7], data, 28 );
122 GET_UINT32_LE( X[ 8], data, 32 );
123 GET_UINT32_LE( X[ 9], data, 36 );
124 GET_UINT32_LE( X[10], data, 40 );
125 GET_UINT32_LE( X[11], data, 44 );
126 GET_UINT32_LE( X[12], data, 48 );
127 GET_UINT32_LE( X[13], data, 52 );
128 GET_UINT32_LE( X[14], data, 56 );
129 GET_UINT32_LE( X[15], data, 60 );
Paul Bakker5121ce52009-01-03 21:22:43 +0000130
131#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
132
133#define P(a,b,c,d,k,s,t) \
134{ \
135 a += F(b,c,d) + X[k] + t; a = S(a,s) + b; \
136}
137
138 A = ctx->state[0];
139 B = ctx->state[1];
140 C = ctx->state[2];
141 D = ctx->state[3];
142
143#define F(x,y,z) (z ^ (x & (y ^ z)))
144
145 P( A, B, C, D, 0, 7, 0xD76AA478 );
146 P( D, A, B, C, 1, 12, 0xE8C7B756 );
147 P( C, D, A, B, 2, 17, 0x242070DB );
148 P( B, C, D, A, 3, 22, 0xC1BDCEEE );
149 P( A, B, C, D, 4, 7, 0xF57C0FAF );
150 P( D, A, B, C, 5, 12, 0x4787C62A );
151 P( C, D, A, B, 6, 17, 0xA8304613 );
152 P( B, C, D, A, 7, 22, 0xFD469501 );
153 P( A, B, C, D, 8, 7, 0x698098D8 );
154 P( D, A, B, C, 9, 12, 0x8B44F7AF );
155 P( C, D, A, B, 10, 17, 0xFFFF5BB1 );
156 P( B, C, D, A, 11, 22, 0x895CD7BE );
157 P( A, B, C, D, 12, 7, 0x6B901122 );
158 P( D, A, B, C, 13, 12, 0xFD987193 );
159 P( C, D, A, B, 14, 17, 0xA679438E );
160 P( B, C, D, A, 15, 22, 0x49B40821 );
161
162#undef F
163
164#define F(x,y,z) (y ^ (z & (x ^ y)))
165
166 P( A, B, C, D, 1, 5, 0xF61E2562 );
167 P( D, A, B, C, 6, 9, 0xC040B340 );
168 P( C, D, A, B, 11, 14, 0x265E5A51 );
169 P( B, C, D, A, 0, 20, 0xE9B6C7AA );
170 P( A, B, C, D, 5, 5, 0xD62F105D );
171 P( D, A, B, C, 10, 9, 0x02441453 );
172 P( C, D, A, B, 15, 14, 0xD8A1E681 );
173 P( B, C, D, A, 4, 20, 0xE7D3FBC8 );
174 P( A, B, C, D, 9, 5, 0x21E1CDE6 );
175 P( D, A, B, C, 14, 9, 0xC33707D6 );
176 P( C, D, A, B, 3, 14, 0xF4D50D87 );
177 P( B, C, D, A, 8, 20, 0x455A14ED );
178 P( A, B, C, D, 13, 5, 0xA9E3E905 );
179 P( D, A, B, C, 2, 9, 0xFCEFA3F8 );
180 P( C, D, A, B, 7, 14, 0x676F02D9 );
181 P( B, C, D, A, 12, 20, 0x8D2A4C8A );
182
183#undef F
Paul Bakker9af723c2014-05-01 13:03:14 +0200184
Paul Bakker5121ce52009-01-03 21:22:43 +0000185#define F(x,y,z) (x ^ y ^ z)
186
187 P( A, B, C, D, 5, 4, 0xFFFA3942 );
188 P( D, A, B, C, 8, 11, 0x8771F681 );
189 P( C, D, A, B, 11, 16, 0x6D9D6122 );
190 P( B, C, D, A, 14, 23, 0xFDE5380C );
191 P( A, B, C, D, 1, 4, 0xA4BEEA44 );
192 P( D, A, B, C, 4, 11, 0x4BDECFA9 );
193 P( C, D, A, B, 7, 16, 0xF6BB4B60 );
194 P( B, C, D, A, 10, 23, 0xBEBFBC70 );
195 P( A, B, C, D, 13, 4, 0x289B7EC6 );
196 P( D, A, B, C, 0, 11, 0xEAA127FA );
197 P( C, D, A, B, 3, 16, 0xD4EF3085 );
198 P( B, C, D, A, 6, 23, 0x04881D05 );
199 P( A, B, C, D, 9, 4, 0xD9D4D039 );
200 P( D, A, B, C, 12, 11, 0xE6DB99E5 );
201 P( C, D, A, B, 15, 16, 0x1FA27CF8 );
202 P( B, C, D, A, 2, 23, 0xC4AC5665 );
203
204#undef F
205
206#define F(x,y,z) (y ^ (x | ~z))
207
208 P( A, B, C, D, 0, 6, 0xF4292244 );
209 P( D, A, B, C, 7, 10, 0x432AFF97 );
210 P( C, D, A, B, 14, 15, 0xAB9423A7 );
211 P( B, C, D, A, 5, 21, 0xFC93A039 );
212 P( A, B, C, D, 12, 6, 0x655B59C3 );
213 P( D, A, B, C, 3, 10, 0x8F0CCC92 );
214 P( C, D, A, B, 10, 15, 0xFFEFF47D );
215 P( B, C, D, A, 1, 21, 0x85845DD1 );
216 P( A, B, C, D, 8, 6, 0x6FA87E4F );
217 P( D, A, B, C, 15, 10, 0xFE2CE6E0 );
218 P( C, D, A, B, 6, 15, 0xA3014314 );
219 P( B, C, D, A, 13, 21, 0x4E0811A1 );
220 P( A, B, C, D, 4, 6, 0xF7537E82 );
221 P( D, A, B, C, 11, 10, 0xBD3AF235 );
222 P( C, D, A, B, 2, 15, 0x2AD7D2BB );
223 P( B, C, D, A, 9, 21, 0xEB86D391 );
224
225#undef F
226
227 ctx->state[0] += A;
228 ctx->state[1] += B;
229 ctx->state[2] += C;
230 ctx->state[3] += D;
231}
232
233/*
234 * MD5 process buffer
235 */
Paul Bakker23986e52011-04-24 08:57:21 +0000236void md5_update( md5_context *ctx, const unsigned char *input, size_t ilen )
Paul Bakker5121ce52009-01-03 21:22:43 +0000237{
Paul Bakker23986e52011-04-24 08:57:21 +0000238 size_t fill;
Paul Bakker5c2364c2012-10-01 14:41:15 +0000239 uint32_t left;
Paul Bakker5121ce52009-01-03 21:22:43 +0000240
Brian White12895d12014-04-11 11:29:42 -0400241 if( ilen == 0 )
Paul Bakker5121ce52009-01-03 21:22:43 +0000242 return;
243
244 left = ctx->total[0] & 0x3F;
245 fill = 64 - left;
246
Paul Bakker5c2364c2012-10-01 14:41:15 +0000247 ctx->total[0] += (uint32_t) ilen;
Paul Bakker5121ce52009-01-03 21:22:43 +0000248 ctx->total[0] &= 0xFFFFFFFF;
249
Paul Bakker5c2364c2012-10-01 14:41:15 +0000250 if( ctx->total[0] < (uint32_t) ilen )
Paul Bakker5121ce52009-01-03 21:22:43 +0000251 ctx->total[1]++;
252
253 if( left && ilen >= fill )
254 {
Paul Bakker3c2122f2013-06-24 19:03:14 +0200255 memcpy( (void *) (ctx->buffer + left), input, fill );
Paul Bakker5121ce52009-01-03 21:22:43 +0000256 md5_process( ctx, ctx->buffer );
257 input += fill;
258 ilen -= fill;
259 left = 0;
260 }
261
262 while( ilen >= 64 )
263 {
264 md5_process( ctx, input );
265 input += 64;
266 ilen -= 64;
267 }
268
269 if( ilen > 0 )
270 {
Paul Bakker3c2122f2013-06-24 19:03:14 +0200271 memcpy( (void *) (ctx->buffer + left), input, ilen );
Paul Bakker5121ce52009-01-03 21:22:43 +0000272 }
273}
274
275static const unsigned char md5_padding[64] =
276{
277 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
278 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
279 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
280 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
281};
282
283/*
284 * MD5 final digest
285 */
286void md5_finish( md5_context *ctx, unsigned char output[16] )
287{
Paul Bakker5c2364c2012-10-01 14:41:15 +0000288 uint32_t last, padn;
289 uint32_t high, low;
Paul Bakker5121ce52009-01-03 21:22:43 +0000290 unsigned char msglen[8];
291
292 high = ( ctx->total[0] >> 29 )
293 | ( ctx->total[1] << 3 );
294 low = ( ctx->total[0] << 3 );
295
Paul Bakker5c2364c2012-10-01 14:41:15 +0000296 PUT_UINT32_LE( low, msglen, 0 );
297 PUT_UINT32_LE( high, msglen, 4 );
Paul Bakker5121ce52009-01-03 21:22:43 +0000298
299 last = ctx->total[0] & 0x3F;
300 padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
301
Paul Bakker3c2122f2013-06-24 19:03:14 +0200302 md5_update( ctx, md5_padding, padn );
Paul Bakker5121ce52009-01-03 21:22:43 +0000303 md5_update( ctx, msglen, 8 );
304
Paul Bakker5c2364c2012-10-01 14:41:15 +0000305 PUT_UINT32_LE( ctx->state[0], output, 0 );
306 PUT_UINT32_LE( ctx->state[1], output, 4 );
307 PUT_UINT32_LE( ctx->state[2], output, 8 );
308 PUT_UINT32_LE( ctx->state[3], output, 12 );
Paul Bakker5121ce52009-01-03 21:22:43 +0000309}
310
Paul Bakker90995b52013-06-24 19:20:35 +0200311#endif /* !POLARSSL_MD5_ALT */
312
Paul Bakker5121ce52009-01-03 21:22:43 +0000313/*
314 * output = MD5( input buffer )
315 */
Paul Bakker23986e52011-04-24 08:57:21 +0000316void md5( const unsigned char *input, size_t ilen, unsigned char output[16] )
Paul Bakker5121ce52009-01-03 21:22:43 +0000317{
318 md5_context ctx;
319
Paul Bakker5b4af392014-06-26 12:09:34 +0200320 md5_init( &ctx );
Paul Bakker5121ce52009-01-03 21:22:43 +0000321 md5_starts( &ctx );
322 md5_update( &ctx, input, ilen );
323 md5_finish( &ctx, output );
Paul Bakker5b4af392014-06-26 12:09:34 +0200324 md5_free( &ctx );
Paul Bakker5121ce52009-01-03 21:22:43 +0000325}
326
Paul Bakker335db3f2011-04-25 15:28:35 +0000327#if defined(POLARSSL_FS_IO)
Paul Bakker5121ce52009-01-03 21:22:43 +0000328/*
329 * output = MD5( file contents )
330 */
Paul Bakkerff60ee62010-03-16 21:09:09 +0000331int md5_file( const char *path, unsigned char output[16] )
Paul Bakker5121ce52009-01-03 21:22:43 +0000332{
333 FILE *f;
334 size_t n;
335 md5_context ctx;
336 unsigned char buf[1024];
337
338 if( ( f = fopen( path, "rb" ) ) == NULL )
Paul Bakker69e095c2011-12-10 21:55:01 +0000339 return( POLARSSL_ERR_MD5_FILE_IO_ERROR );
Paul Bakker5121ce52009-01-03 21:22:43 +0000340
Paul Bakker5b4af392014-06-26 12:09:34 +0200341 md5_init( &ctx );
Paul Bakker5121ce52009-01-03 21:22:43 +0000342 md5_starts( &ctx );
343
344 while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
Paul Bakker27fdf462011-06-09 13:55:13 +0000345 md5_update( &ctx, buf, n );
Paul Bakker5121ce52009-01-03 21:22:43 +0000346
347 md5_finish( &ctx, output );
Paul Bakker5b4af392014-06-26 12:09:34 +0200348 md5_free( &ctx );
Paul Bakker5121ce52009-01-03 21:22:43 +0000349
350 if( ferror( f ) != 0 )
351 {
352 fclose( f );
Paul Bakker69e095c2011-12-10 21:55:01 +0000353 return( POLARSSL_ERR_MD5_FILE_IO_ERROR );
Paul Bakker5121ce52009-01-03 21:22:43 +0000354 }
355
356 fclose( f );
357 return( 0 );
358}
Paul Bakker335db3f2011-04-25 15:28:35 +0000359#endif /* POLARSSL_FS_IO */
Paul Bakker5121ce52009-01-03 21:22:43 +0000360
Paul Bakker40e46942009-01-03 21:51:57 +0000361#if defined(POLARSSL_SELF_TEST)
Paul Bakker5121ce52009-01-03 21:22:43 +0000362/*
363 * RFC 1321 test vectors
364 */
Manuel Pégourié-Gonnard28122e42015-03-11 09:13:42 +0000365static const unsigned char md5_test_buf[7][81] =
Paul Bakker5121ce52009-01-03 21:22:43 +0000366{
Paul Bakker9af723c2014-05-01 13:03:14 +0200367 { "" },
Paul Bakker5121ce52009-01-03 21:22:43 +0000368 { "a" },
369 { "abc" },
370 { "message digest" },
371 { "abcdefghijklmnopqrstuvwxyz" },
372 { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
373 { "12345678901234567890123456789012345678901234567890123456789012" \
374 "345678901234567890" }
375};
376
377static const int md5_test_buflen[7] =
378{
379 0, 1, 3, 14, 26, 62, 80
380};
381
382static const unsigned char md5_test_sum[7][16] =
383{
384 { 0xD4, 0x1D, 0x8C, 0xD9, 0x8F, 0x00, 0xB2, 0x04,
385 0xE9, 0x80, 0x09, 0x98, 0xEC, 0xF8, 0x42, 0x7E },
386 { 0x0C, 0xC1, 0x75, 0xB9, 0xC0, 0xF1, 0xB6, 0xA8,
387 0x31, 0xC3, 0x99, 0xE2, 0x69, 0x77, 0x26, 0x61 },
388 { 0x90, 0x01, 0x50, 0x98, 0x3C, 0xD2, 0x4F, 0xB0,
389 0xD6, 0x96, 0x3F, 0x7D, 0x28, 0xE1, 0x7F, 0x72 },
390 { 0xF9, 0x6B, 0x69, 0x7D, 0x7C, 0xB7, 0x93, 0x8D,
391 0x52, 0x5A, 0x2F, 0x31, 0xAA, 0xF1, 0x61, 0xD0 },
392 { 0xC3, 0xFC, 0xD3, 0xD7, 0x61, 0x92, 0xE4, 0x00,
393 0x7D, 0xFB, 0x49, 0x6C, 0xCA, 0x67, 0xE1, 0x3B },
394 { 0xD1, 0x74, 0xAB, 0x98, 0xD2, 0x77, 0xD9, 0xF5,
395 0xA5, 0x61, 0x1C, 0x2C, 0x9F, 0x41, 0x9D, 0x9F },
396 { 0x57, 0xED, 0xF4, 0xA2, 0x2B, 0xE3, 0xC9, 0x55,
397 0xAC, 0x49, 0xDA, 0x2E, 0x21, 0x07, 0xB6, 0x7A }
398};
399
400/*
Paul Bakker5121ce52009-01-03 21:22:43 +0000401 * Checkup routine
402 */
403int md5_self_test( int verbose )
404{
Manuel Pégourié-Gonnard4da88c52015-03-24 18:23:20 +0100405 int i;
Paul Bakker5121ce52009-01-03 21:22:43 +0000406 unsigned char md5sum[16];
Paul Bakker5121ce52009-01-03 21:22:43 +0000407
408 for( i = 0; i < 7; i++ )
409 {
410 if( verbose != 0 )
Paul Bakker7dc4c442014-02-01 22:50:26 +0100411 polarssl_printf( " MD5 test #%d: ", i + 1 );
Paul Bakker5121ce52009-01-03 21:22:43 +0000412
413 md5( md5_test_buf[i], md5_test_buflen[i], md5sum );
414
415 if( memcmp( md5sum, md5_test_sum[i], 16 ) != 0 )
416 {
417 if( verbose != 0 )
Paul Bakker7dc4c442014-02-01 22:50:26 +0100418 polarssl_printf( "failed\n" );
Paul Bakker5121ce52009-01-03 21:22:43 +0000419
420 return( 1 );
421 }
422
423 if( verbose != 0 )
Paul Bakker7dc4c442014-02-01 22:50:26 +0100424 polarssl_printf( "passed\n" );
Paul Bakker5121ce52009-01-03 21:22:43 +0000425 }
426
427 if( verbose != 0 )
Paul Bakker7dc4c442014-02-01 22:50:26 +0100428 polarssl_printf( "\n" );
Paul Bakker5121ce52009-01-03 21:22:43 +0000429
Paul Bakker5121ce52009-01-03 21:22:43 +0000430 return( 0 );
431}
432
Paul Bakker9af723c2014-05-01 13:03:14 +0200433#endif /* POLARSSL_SELF_TEST */
Paul Bakker5121ce52009-01-03 21:22:43 +0000434
Paul Bakker9af723c2014-05-01 13:03:14 +0200435#endif /* POLARSSL_MD5_C */