4 * \brief Message digest wrappers.
6 * \warning This in an internal header. Do not include directly.
8 * \author Adriaan de Jong <dejong@fox-it.com>
10 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
11 * SPDX-License-Identifier: GPL-2.0
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * This file is part of mbed TLS (https://tls.mbed.org)
29 #ifndef MBEDTLS_MD_WRAP_H
30 #define MBEDTLS_MD_WRAP_H
32 #if !defined(MBEDTLS_CONFIG_FILE)
35 #include MBEDTLS_CONFIG_FILE
45 * Message digest information.
46 * Allows message digest functions to be called in a generic way.
48 struct mbedtls_md_info_t
50 /** Digest identifier */
51 mbedtls_md_type_t type
;
53 /** Name of the message digest */
56 /** Output length of the digest function in bytes */
59 /** Block length of the digest function in bytes */
62 /** Digest initialisation function */
63 void (*starts_func
)( void *ctx
);
65 /** Digest update function */
66 void (*update_func
)( void *ctx
, const unsigned char *input
, size_t ilen
);
68 /** Digest finalisation function */
69 void (*finish_func
)( void *ctx
, unsigned char *output
);
71 /** Generic digest function */
72 void (*digest_func
)( const unsigned char *input
, size_t ilen
,
73 unsigned char *output
);
75 /** Allocate a new context */
76 void * (*ctx_alloc_func
)( void );
78 /** Free the given context */
79 void (*ctx_free_func
)( void *ctx
);
81 /** Clone state from a context */
82 void (*clone_func
)( void *dst
, const void *src
);
84 /** Internal use only */
85 void (*process_func
)( void *ctx
, const unsigned char *input
);
88 #if defined(MBEDTLS_MD2_C)
89 extern const mbedtls_md_info_t mbedtls_md2_info
;
91 #if defined(MBEDTLS_MD4_C)
92 extern const mbedtls_md_info_t mbedtls_md4_info
;
94 #if defined(MBEDTLS_MD5_C)
95 extern const mbedtls_md_info_t mbedtls_md5_info
;
97 #if defined(MBEDTLS_RIPEMD160_C)
98 extern const mbedtls_md_info_t mbedtls_ripemd160_info
;
100 #if defined(MBEDTLS_SHA1_C)
101 extern const mbedtls_md_info_t mbedtls_sha1_info
;
103 #if defined(MBEDTLS_SHA256_C)
104 extern const mbedtls_md_info_t mbedtls_sha224_info
;
105 extern const mbedtls_md_info_t mbedtls_sha256_info
;
107 #if defined(MBEDTLS_SHA512_C)
108 extern const mbedtls_md_info_t mbedtls_sha384_info
;
109 extern const mbedtls_md_info_t mbedtls_sha512_info
;
116 #endif /* MBEDTLS_MD_WRAP_H */