2 * \file md_internal.h
\r
4 * \brief Message digest wrappers.
\r
6 * \warning This in an internal header. Do not include directly.
\r
8 * \author Adriaan de Jong <dejong@fox-it.com>
\r
11 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
\r
12 * SPDX-License-Identifier: Apache-2.0
\r
14 * Licensed under the Apache License, Version 2.0 (the "License"); you may
\r
15 * not use this file except in compliance with the License.
\r
16 * You may obtain a copy of the License at
\r
18 * http://www.apache.org/licenses/LICENSE-2.0
\r
20 * Unless required by applicable law or agreed to in writing, software
\r
21 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
\r
22 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
23 * See the License for the specific language governing permissions and
\r
24 * limitations under the License.
\r
26 * This file is part of mbed TLS (https://tls.mbed.org)
\r
28 #ifndef MBEDTLS_MD_WRAP_H
\r
29 #define MBEDTLS_MD_WRAP_H
\r
31 #if !defined(MBEDTLS_CONFIG_FILE)
\r
34 #include MBEDTLS_CONFIG_FILE
\r
44 * Message digest information.
\r
45 * Allows message digest functions to be called in a generic way.
\r
47 struct mbedtls_md_info_t
\r
49 /** Digest identifier */
\r
50 mbedtls_md_type_t type;
\r
52 /** Name of the message digest */
\r
55 /** Output length of the digest function in bytes */
\r
58 /** Block length of the digest function in bytes */
\r
61 /** Digest initialisation function */
\r
62 int (*starts_func)( void *ctx );
\r
64 /** Digest update function */
\r
65 int (*update_func)( void *ctx, const unsigned char *input, size_t ilen );
\r
67 /** Digest finalisation function */
\r
68 int (*finish_func)( void *ctx, unsigned char *output );
\r
70 /** Generic digest function */
\r
71 int (*digest_func)( const unsigned char *input, size_t ilen,
\r
72 unsigned char *output );
\r
74 /** Allocate a new context */
\r
75 void * (*ctx_alloc_func)( void );
\r
77 /** Free the given context */
\r
78 void (*ctx_free_func)( void *ctx );
\r
80 /** Clone state from a context */
\r
81 void (*clone_func)( void *dst, const void *src );
\r
83 /** Internal use only */
\r
84 int (*process_func)( void *ctx, const unsigned char *input );
\r
87 #if defined(MBEDTLS_MD2_C)
\r
88 extern const mbedtls_md_info_t mbedtls_md2_info;
\r
90 #if defined(MBEDTLS_MD4_C)
\r
91 extern const mbedtls_md_info_t mbedtls_md4_info;
\r
93 #if defined(MBEDTLS_MD5_C)
\r
94 extern const mbedtls_md_info_t mbedtls_md5_info;
\r
96 #if defined(MBEDTLS_RIPEMD160_C)
\r
97 extern const mbedtls_md_info_t mbedtls_ripemd160_info;
\r
99 #if defined(MBEDTLS_SHA1_C)
\r
100 extern const mbedtls_md_info_t mbedtls_sha1_info;
\r
102 #if defined(MBEDTLS_SHA256_C)
\r
103 extern const mbedtls_md_info_t mbedtls_sha224_info;
\r
104 extern const mbedtls_md_info_t mbedtls_sha256_info;
\r
106 #if defined(MBEDTLS_SHA512_C)
\r
107 extern const mbedtls_md_info_t mbedtls_sha384_info;
\r
108 extern const mbedtls_md_info_t mbedtls_sha512_info;
\r
115 #endif /* MBEDTLS_MD_WRAP_H */
\r