md_wrap.c 11.8 KB
Newer Older
1 2 3
/**
 * \file md_wrap.c

4
 * \brief Generic message digest wrapper for mbed TLS
5 6 7
 *
 * \author Adriaan de Jong <dejong@fox-it.com>
 *
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
8
 *  Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
9
 *
10
 *  This file is part of mbed TLS (https://tls.mbed.org)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
27
#if !defined(MBEDTLS_CONFIG_FILE)
28
#include "mbedtls/config.h"
29
#else
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
30
#include MBEDTLS_CONFIG_FILE
31
#endif
32

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
33
#if defined(MBEDTLS_MD_C)
34

35
#include "mbedtls/md_internal.h"
36

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
37
#if defined(MBEDTLS_MD2_C)
38
#include "mbedtls/md2.h"
39 40
#endif

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
41
#if defined(MBEDTLS_MD4_C)
42
#include "mbedtls/md4.h"
43 44
#endif

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
45
#if defined(MBEDTLS_MD5_C)
46
#include "mbedtls/md5.h"
47 48
#endif

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
49
#if defined(MBEDTLS_RIPEMD160_C)
50
#include "mbedtls/ripemd160.h"
51 52
#endif

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
53
#if defined(MBEDTLS_SHA1_C)
54
#include "mbedtls/sha1.h"
55 56
#endif

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
57
#if defined(MBEDTLS_SHA256_C)
58
#include "mbedtls/sha256.h"
59 60
#endif

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
61
#if defined(MBEDTLS_SHA512_C)
62
#include "mbedtls/sha512.h"
63
#endif
64

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
65
#if defined(MBEDTLS_PLATFORM_C)
66
#include "mbedtls/platform.h"
67
#else
68
#include <stdlib.h>
69
#define mbedtls_calloc    calloc
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
70
#define mbedtls_free       free
71 72
#endif

73
/* Implementation that should never be optimized out by the compiler */
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
74
static void mbedtls_zeroize( void *v, size_t n ) {
75 76 77
    volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
78
#if defined(MBEDTLS_MD2_C)
79 80 81

static void md2_starts_wrap( void *ctx )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
82
    mbedtls_md2_starts( (mbedtls_md2_context *) ctx );
83 84
}

85 86
static void md2_update_wrap( void *ctx, const unsigned char *input,
                             size_t ilen )
87
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
88
    mbedtls_md2_update( (mbedtls_md2_context *) ctx, input, ilen );
89 90 91 92
}

static void md2_finish_wrap( void *ctx, unsigned char *output )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
93
    mbedtls_md2_finish( (mbedtls_md2_context *) ctx, output );
94 95
}

96
static void *md2_ctx_alloc( void )
97
{
98 99 100 101 102 103
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_md2_context ) );

    if( ctx != NULL )
        mbedtls_md2_init( (mbedtls_md2_context *) ctx );

    return( ctx );
104 105 106 107
}

static void md2_ctx_free( void *ctx )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
108 109
    mbedtls_zeroize( ctx, sizeof( mbedtls_md2_context ) );
    mbedtls_free( ctx );
110 111
}

112 113 114 115
static void md2_process_wrap( void *ctx, const unsigned char *data )
{
    ((void) data);

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
116
    mbedtls_md2_process( (mbedtls_md2_context *) ctx );
117 118
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
119 120
const mbedtls_md_info_t mbedtls_md2_info = {
    MBEDTLS_MD_MD2,
121 122
    "MD2",
    16,
123
    16,
124 125 126
    md2_starts_wrap,
    md2_update_wrap,
    md2_finish_wrap,
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
127
    mbedtls_md2,
128 129
    md2_ctx_alloc,
    md2_ctx_free,
130
    md2_process_wrap,
131 132
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
133
#endif /* MBEDTLS_MD2_C */
134

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
135
#if defined(MBEDTLS_MD4_C)
136

137
static void md4_starts_wrap( void *ctx )
138
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
139
    mbedtls_md4_starts( (mbedtls_md4_context *) ctx );
140 141
}

142 143
static void md4_update_wrap( void *ctx, const unsigned char *input,
                             size_t ilen )
144
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
145
    mbedtls_md4_update( (mbedtls_md4_context *) ctx, input, ilen );
146 147
}

148
static void md4_finish_wrap( void *ctx, unsigned char *output )
149
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
150
    mbedtls_md4_finish( (mbedtls_md4_context *) ctx, output );
151 152
}

153
static void *md4_ctx_alloc( void )
154
{
155 156 157 158 159 160
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_md4_context ) );

    if( ctx != NULL )
        mbedtls_md4_init( (mbedtls_md4_context *) ctx );

    return( ctx );
161 162
}

163
static void md4_ctx_free( void *ctx )
164
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
165 166
    mbedtls_zeroize( ctx, sizeof( mbedtls_md4_context ) );
    mbedtls_free( ctx );
167 168
}

169
static void md4_process_wrap( void *ctx, const unsigned char *data )
170
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
171
    mbedtls_md4_process( (mbedtls_md4_context *) ctx, data );
172 173
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
174 175
const mbedtls_md_info_t mbedtls_md4_info = {
    MBEDTLS_MD_MD4,
176 177
    "MD4",
    16,
178
    64,
179 180 181
    md4_starts_wrap,
    md4_update_wrap,
    md4_finish_wrap,
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
182
    mbedtls_md4,
183 184
    md4_ctx_alloc,
    md4_ctx_free,
185
    md4_process_wrap,
186 187
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
188
#endif /* MBEDTLS_MD4_C */
189

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
190
#if defined(MBEDTLS_MD5_C)
191 192 193

static void md5_starts_wrap( void *ctx )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
194
    mbedtls_md5_starts( (mbedtls_md5_context *) ctx );
195 196
}

197 198
static void md5_update_wrap( void *ctx, const unsigned char *input,
                             size_t ilen )
199
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
200
    mbedtls_md5_update( (mbedtls_md5_context *) ctx, input, ilen );
201 202 203 204
}

static void md5_finish_wrap( void *ctx, unsigned char *output )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
205
    mbedtls_md5_finish( (mbedtls_md5_context *) ctx, output );
206 207
}

208
static void *md5_ctx_alloc( void )
209
{
210 211 212 213 214 215
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_md5_context ) );

    if( ctx != NULL )
        mbedtls_md5_init( (mbedtls_md5_context *) ctx );

    return( ctx );
216 217 218 219
}

static void md5_ctx_free( void *ctx )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
220 221
    mbedtls_zeroize( ctx, sizeof( mbedtls_md5_context ) );
    mbedtls_free( ctx );
222 223
}

224 225
static void md5_process_wrap( void *ctx, const unsigned char *data )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
226
    mbedtls_md5_process( (mbedtls_md5_context *) ctx, data );
227 228
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
229 230
const mbedtls_md_info_t mbedtls_md5_info = {
    MBEDTLS_MD_MD5,
231 232
    "MD5",
    16,
233
    64,
234 235 236
    md5_starts_wrap,
    md5_update_wrap,
    md5_finish_wrap,
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
237
    mbedtls_md5,
238 239
    md5_ctx_alloc,
    md5_ctx_free,
240
    md5_process_wrap,
241 242
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
243
#endif /* MBEDTLS_MD5_C */
244

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
245
#if defined(MBEDTLS_RIPEMD160_C)
246

Paul Bakker's avatar
Paul Bakker committed
247
static void ripemd160_starts_wrap( void *ctx )
248
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
249
    mbedtls_ripemd160_starts( (mbedtls_ripemd160_context *) ctx );
250 251
}

252 253
static void ripemd160_update_wrap( void *ctx, const unsigned char *input,
                                   size_t ilen )
254
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
255
    mbedtls_ripemd160_update( (mbedtls_ripemd160_context *) ctx, input, ilen );
256 257
}

Paul Bakker's avatar
Paul Bakker committed
258
static void ripemd160_finish_wrap( void *ctx, unsigned char *output )
259
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
260
    mbedtls_ripemd160_finish( (mbedtls_ripemd160_context *) ctx, output );
261 262
}

263
static void *ripemd160_ctx_alloc( void )
264
{
265
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_ripemd160_context ) );
266

267 268
    if( ctx != NULL )
        mbedtls_ripemd160_init( (mbedtls_ripemd160_context *) ctx );
269 270

    return( ctx );
271 272
}

Paul Bakker's avatar
Paul Bakker committed
273
static void ripemd160_ctx_free( void *ctx )
274
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
275 276
    mbedtls_ripemd160_free( (mbedtls_ripemd160_context *) ctx );
    mbedtls_free( ctx );
277 278
}

Paul Bakker's avatar
Paul Bakker committed
279
static void ripemd160_process_wrap( void *ctx, const unsigned char *data )
280
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
281
    mbedtls_ripemd160_process( (mbedtls_ripemd160_context *) ctx, data );
282 283
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
284 285
const mbedtls_md_info_t mbedtls_ripemd160_info = {
    MBEDTLS_MD_RIPEMD160,
Paul Bakker's avatar
Paul Bakker committed
286
    "RIPEMD160",
287
    20,
288
    64,
Paul Bakker's avatar
Paul Bakker committed
289 290 291
    ripemd160_starts_wrap,
    ripemd160_update_wrap,
    ripemd160_finish_wrap,
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
292
    mbedtls_ripemd160,
Paul Bakker's avatar
Paul Bakker committed
293 294 295
    ripemd160_ctx_alloc,
    ripemd160_ctx_free,
    ripemd160_process_wrap,
296 297
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
298
#endif /* MBEDTLS_RIPEMD160_C */
299

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
300
#if defined(MBEDTLS_SHA1_C)
301

302
static void sha1_starts_wrap( void *ctx )
303
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
304
    mbedtls_sha1_starts( (mbedtls_sha1_context *) ctx );
305 306
}

307 308
static void sha1_update_wrap( void *ctx, const unsigned char *input,
                              size_t ilen )
309
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
310
    mbedtls_sha1_update( (mbedtls_sha1_context *) ctx, input, ilen );
311 312
}

313
static void sha1_finish_wrap( void *ctx, unsigned char *output )
314
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
315
    mbedtls_sha1_finish( (mbedtls_sha1_context *) ctx, output );
316 317
}

318
static void *sha1_ctx_alloc( void )
319
{
320
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_sha1_context ) );
321

322 323
    if( ctx != NULL )
        mbedtls_sha1_init( (mbedtls_sha1_context *) ctx );
324 325

    return( ctx );
326 327
}

328
static void sha1_ctx_free( void *ctx )
329
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
330 331
    mbedtls_sha1_free( (mbedtls_sha1_context *) ctx );
    mbedtls_free( ctx );
332 333
}

334
static void sha1_process_wrap( void *ctx, const unsigned char *data )
335
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
336
    mbedtls_sha1_process( (mbedtls_sha1_context *) ctx, data );
337 338
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
339 340
const mbedtls_md_info_t mbedtls_sha1_info = {
    MBEDTLS_MD_SHA1,
341 342
    "SHA1",
    20,
343
    64,
344 345 346
    sha1_starts_wrap,
    sha1_update_wrap,
    sha1_finish_wrap,
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
347
    mbedtls_sha1,
348 349
    sha1_ctx_alloc,
    sha1_ctx_free,
350
    sha1_process_wrap,
351 352
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
353
#endif /* MBEDTLS_SHA1_C */
354 355 356 357

/*
 * Wrappers for generic message digests
 */
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
358
#if defined(MBEDTLS_SHA256_C)
359

360
static void sha224_starts_wrap( void *ctx )
361
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
362
    mbedtls_sha256_starts( (mbedtls_sha256_context *) ctx, 1 );
363 364
}

365 366
static void sha224_update_wrap( void *ctx, const unsigned char *input,
                                size_t ilen )
367
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
368
    mbedtls_sha256_update( (mbedtls_sha256_context *) ctx, input, ilen );
369 370
}

371
static void sha224_finish_wrap( void *ctx, unsigned char *output )
372
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
373
    mbedtls_sha256_finish( (mbedtls_sha256_context *) ctx, output );
374 375
}

376
static void sha224_wrap( const unsigned char *input, size_t ilen,
377 378
                    unsigned char *output )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
379
    mbedtls_sha256( input, ilen, output, 1 );
380 381
}

382
static void *sha224_ctx_alloc( void )
383
{
384 385 386 387 388 389
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_sha256_context ) );

    if( ctx != NULL )
        mbedtls_sha256_init( (mbedtls_sha256_context *) ctx );

    return( ctx );
390 391
}

392
static void sha224_ctx_free( void *ctx )
393
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
394 395
    mbedtls_zeroize( ctx, sizeof( mbedtls_sha256_context ) );
    mbedtls_free( ctx );
396 397
}

398
static void sha224_process_wrap( void *ctx, const unsigned char *data )
399
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
400
    mbedtls_sha256_process( (mbedtls_sha256_context *) ctx, data );
401 402
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
403 404
const mbedtls_md_info_t mbedtls_sha224_info = {
    MBEDTLS_MD_SHA224,
405 406
    "SHA224",
    28,
407
    64,
408 409 410 411 412 413
    sha224_starts_wrap,
    sha224_update_wrap,
    sha224_finish_wrap,
    sha224_wrap,
    sha224_ctx_alloc,
    sha224_ctx_free,
414
    sha224_process_wrap,
415 416
};

417
static void sha256_starts_wrap( void *ctx )
418
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
419
    mbedtls_sha256_starts( (mbedtls_sha256_context *) ctx, 0 );
420 421
}

422
static void sha256_wrap( const unsigned char *input, size_t ilen,
423 424
                    unsigned char *output )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
425
    mbedtls_sha256( input, ilen, output, 0 );
426 427
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
428 429
const mbedtls_md_info_t mbedtls_sha256_info = {
    MBEDTLS_MD_SHA256,
430 431
    "SHA256",
    32,
432
    64,
433
    sha256_starts_wrap,
434 435
    sha224_update_wrap,
    sha224_finish_wrap,
436
    sha256_wrap,
437 438 439
    sha224_ctx_alloc,
    sha224_ctx_free,
    sha224_process_wrap,
440 441
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
442
#endif /* MBEDTLS_SHA256_C */
443

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
444
#if defined(MBEDTLS_SHA512_C)
445

446
static void sha384_starts_wrap( void *ctx )
447
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
448
    mbedtls_sha512_starts( (mbedtls_sha512_context *) ctx, 1 );
449 450
}

451 452
static void sha384_update_wrap( void *ctx, const unsigned char *input,
                                size_t ilen )
453
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
454
    mbedtls_sha512_update( (mbedtls_sha512_context *) ctx, input, ilen );
455 456
}

457
static void sha384_finish_wrap( void *ctx, unsigned char *output )
458
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
459
    mbedtls_sha512_finish( (mbedtls_sha512_context *) ctx, output );
460 461
}

462
static void sha384_wrap( const unsigned char *input, size_t ilen,
463 464
                    unsigned char *output )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
465
    mbedtls_sha512( input, ilen, output, 1 );
466 467
}

468
static void *sha384_ctx_alloc( void )
469
{
470 471 472 473 474 475
    void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_sha512_context ) );

    if( ctx != NULL )
        mbedtls_sha512_init( (mbedtls_sha512_context *) ctx );

    return( ctx );
476 477
}

478
static void sha384_ctx_free( void *ctx )
479
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
480 481
    mbedtls_zeroize( ctx, sizeof( mbedtls_sha512_context ) );
    mbedtls_free( ctx );
482 483
}

484
static void sha384_process_wrap( void *ctx, const unsigned char *data )
485
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
486
    mbedtls_sha512_process( (mbedtls_sha512_context *) ctx, data );
487 488
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
489 490
const mbedtls_md_info_t mbedtls_sha384_info = {
    MBEDTLS_MD_SHA384,
491 492
    "SHA384",
    48,
493
    128,
494 495 496 497 498 499
    sha384_starts_wrap,
    sha384_update_wrap,
    sha384_finish_wrap,
    sha384_wrap,
    sha384_ctx_alloc,
    sha384_ctx_free,
500
    sha384_process_wrap,
501 502
};

503
static void sha512_starts_wrap( void *ctx )
504
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
505
    mbedtls_sha512_starts( (mbedtls_sha512_context *) ctx, 0 );
506 507
}

508
static void sha512_wrap( const unsigned char *input, size_t ilen,
509 510
                    unsigned char *output )
{
Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
511
    mbedtls_sha512( input, ilen, output, 0 );
512 513
}

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
514 515
const mbedtls_md_info_t mbedtls_sha512_info = {
    MBEDTLS_MD_SHA512,
516 517
    "SHA512",
    64,
518
    128,
519
    sha512_starts_wrap,
520 521
    sha384_update_wrap,
    sha384_finish_wrap,
522
    sha512_wrap,
523 524 525
    sha384_ctx_alloc,
    sha384_ctx_free,
    sha384_process_wrap,
526 527
};

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
528
#endif /* MBEDTLS_SHA512_C */
529

Manuel Pégourié-Gonnard's avatar
Manuel Pégourié-Gonnard committed
530
#endif /* MBEDTLS_MD_C */