]> git.zerfleddert.de Git - proxmark3-svn/blob - common/mbedtls/md_internal.h
Fix #912
[proxmark3-svn] / common / mbedtls / md_internal.h
1 /**
2 * \file md_internal.h
3 *
4 * \brief Message digest wrappers.
5 *
6 * \warning This in an internal header. Do not include directly.
7 *
8 * \author Adriaan de Jong <dejong@fox-it.com>
9 */
10 /*
11 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
12 * SPDX-License-Identifier: GPL-2.0
13 *
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.
18 *
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.
23 *
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.
27 *
28 * This file is part of mbed TLS (https://tls.mbed.org)
29 */
30 #ifndef MBEDTLS_MD_WRAP_H
31 #define MBEDTLS_MD_WRAP_H
32
33 #if !defined(MBEDTLS_CONFIG_FILE)
34 #include "config.h"
35 #else
36 #include MBEDTLS_CONFIG_FILE
37 #endif
38
39 #include "md.h"
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /**
46 * Message digest information.
47 * Allows message digest functions to be called in a generic way.
48 */
49 struct mbedtls_md_info_t
50 {
51 /** Digest identifier */
52 mbedtls_md_type_t type;
53
54 /** Name of the message digest */
55 const char * name;
56
57 /** Output length of the digest function in bytes */
58 int size;
59
60 /** Block length of the digest function in bytes */
61 int block_size;
62
63 /** Digest initialisation function */
64 int (*starts_func)( void *ctx );
65
66 /** Digest update function */
67 int (*update_func)( void *ctx, const unsigned char *input, size_t ilen );
68
69 /** Digest finalisation function */
70 int (*finish_func)( void *ctx, unsigned char *output );
71
72 /** Generic digest function */
73 int (*digest_func)( const unsigned char *input, size_t ilen,
74 unsigned char *output );
75
76 /** Allocate a new context */
77 void * (*ctx_alloc_func)( void );
78
79 /** Free the given context */
80 void (*ctx_free_func)( void *ctx );
81
82 /** Clone state from a context */
83 void (*clone_func)( void *dst, const void *src );
84
85 /** Internal use only */
86 int (*process_func)( void *ctx, const unsigned char *input );
87 };
88
89 #if defined(MBEDTLS_MD2_C)
90 extern const mbedtls_md_info_t mbedtls_md2_info;
91 #endif
92 #if defined(MBEDTLS_MD4_C)
93 extern const mbedtls_md_info_t mbedtls_md4_info;
94 #endif
95 #if defined(MBEDTLS_MD5_C)
96 extern const mbedtls_md_info_t mbedtls_md5_info;
97 #endif
98 #if defined(MBEDTLS_RIPEMD160_C)
99 extern const mbedtls_md_info_t mbedtls_ripemd160_info;
100 #endif
101 #if defined(MBEDTLS_SHA1_C)
102 extern const mbedtls_md_info_t mbedtls_sha1_info;
103 #endif
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;
107 #endif
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;
111 #endif
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #endif /* MBEDTLS_MD_WRAP_H */
Impressum, Datenschutz