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: Apache-2.0
13 * Licensed under the Apache License, Version 2.0 (the "License"); you may
14 * not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
17 * http://www.apache.org/licenses/LICENSE-2.0
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
25 * This file is part of mbed TLS (https://tls.mbed.org)
27 #ifndef MBEDTLS_MD_WRAP_H
28 #define MBEDTLS_MD_WRAP_H
30 #if !defined(MBEDTLS_CONFIG_FILE)
33 #include MBEDTLS_CONFIG_FILE
43 * Message digest information.
44 * Allows message digest functions to be called in a generic way.
46 struct mbedtls_md_info_t
48 /** Digest identifier */
49 mbedtls_md_type_t type;
51 /** Name of the message digest */
54 /** Output length of the digest function in bytes */
57 /** Block length of the digest function in bytes */
60 /** Digest initialisation function */
61 void (*starts_func)( void *ctx );
63 /** Digest update function */
64 void (*update_func)( void *ctx, const unsigned char *input, size_t ilen );
66 /** Digest finalisation function */
67 void (*finish_func)( void *ctx, unsigned char *output );
69 /** Generic digest function */
70 void (*digest_func)( const unsigned char *input, size_t ilen,
71 unsigned char *output );
73 /** Allocate a new context */
74 void * (*ctx_alloc_func)( void );
76 /** Free the given context */
77 void (*ctx_free_func)( void *ctx );
79 /** Clone state from a context */
80 void (*clone_func)( void *dst, const void *src );
82 /** Internal use only */
83 void (*process_func)( void *ctx, const unsigned char *input );
86 #if defined(MBEDTLS_MD2_C)
87 extern const mbedtls_md_info_t mbedtls_md2_info;
89 #if defined(MBEDTLS_MD4_C)
90 extern const mbedtls_md_info_t mbedtls_md4_info;
92 #if defined(MBEDTLS_MD5_C)
93 extern const mbedtls_md_info_t mbedtls_md5_info;
95 #if defined(MBEDTLS_RIPEMD160_C)
96 extern const mbedtls_md_info_t mbedtls_ripemd160_info;
98 #if defined(MBEDTLS_SHA1_C)
99 extern const mbedtls_md_info_t mbedtls_sha1_info;
101 #if defined(MBEDTLS_SHA256_C)
102 extern const mbedtls_md_info_t mbedtls_sha224_info;
103 extern const mbedtls_md_info_t mbedtls_sha256_info;
105 #if defined(MBEDTLS_SHA512_C)
106 extern const mbedtls_md_info_t mbedtls_sha384_info;
107 extern const mbedtls_md_info_t mbedtls_sha512_info;
114 #endif /* MBEDTLS_MD_WRAP_H */