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>
11 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
12 * SPDX-License-Identifier: GPL-2.0
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 * This file is part of mbed TLS (https://tls.mbed.org)
30 #ifndef MBEDTLS_MD_WRAP_H
31 #define MBEDTLS_MD_WRAP_H
33 #if !defined(MBEDTLS_CONFIG_FILE)
36 #include MBEDTLS_CONFIG_FILE
46 * Message digest information.
47 * Allows message digest functions to be called in a generic way.
49 struct mbedtls_md_info_t
51 /** Digest identifier */
52 mbedtls_md_type_t type
;
54 /** Name of the message digest */
57 /** Output length of the digest function in bytes */
60 /** Block length of the digest function in bytes */
63 /** Digest initialisation function */
64 int (*starts_func
)( void *ctx
);
66 /** Digest update function */
67 int (*update_func
)( void *ctx
, const unsigned char *input
, size_t ilen
);
69 /** Digest finalisation function */
70 int (*finish_func
)( void *ctx
, unsigned char *output
);
72 /** Generic digest function */
73 int (*digest_func
)( const unsigned char *input
, size_t ilen
,
74 unsigned char *output
);
76 /** Allocate a new context */
77 void * (*ctx_alloc_func
)( void );
79 /** Free the given context */
80 void (*ctx_free_func
)( void *ctx
);
82 /** Clone state from a context */
83 void (*clone_func
)( void *dst
, const void *src
);
85 /** Internal use only */
86 int (*process_func
)( void *ctx
, const unsigned char *input
);
89 #if defined(MBEDTLS_MD2_C)
90 extern const mbedtls_md_info_t mbedtls_md2_info
;
92 #if defined(MBEDTLS_MD4_C)
93 extern const mbedtls_md_info_t mbedtls_md4_info
;
95 #if defined(MBEDTLS_MD5_C)
96 extern const mbedtls_md_info_t mbedtls_md5_info
;
98 #if defined(MBEDTLS_RIPEMD160_C)
99 extern const mbedtls_md_info_t mbedtls_ripemd160_info
;
101 #if defined(MBEDTLS_SHA1_C)
102 extern const mbedtls_md_info_t mbedtls_sha1_info
;
104 #if defined(MBEDTLS_SHA256_C)
105 extern const mbedtls_md_info_t mbedtls_sha224_info
;
106 extern const mbedtls_md_info_t mbedtls_sha256_info
;
108 #if defined(MBEDTLS_SHA512_C)
109 extern const mbedtls_md_info_t mbedtls_sha384_info
;
110 extern const mbedtls_md_info_t mbedtls_sha512_info
;
117 #endif /* MBEDTLS_MD_WRAP_H */