mbed TLS v2.24.0
md2.h
Go to the documentation of this file.
1 
10 /*
11  * Copyright The Mbed TLS Contributors
12  * SPDX-License-Identifier: Apache-2.0
13  *
14  * Licensed under the Apache License, Version 2.0 (the "License"); you may
15  * not use this file except in compliance with the License.
16  * You may obtain a copy of the License at
17  *
18  * http://www.apache.org/licenses/LICENSE-2.0
19  *
20  * Unless required by applicable law or agreed to in writing, software
21  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  * See the License for the specific language governing permissions and
24  * limitations under the License.
25  *
26  */
27 #ifndef MBEDTLS_MD2_H
28 #define MBEDTLS_MD2_H
29 
30 #if !defined(MBEDTLS_CONFIG_FILE)
31 #include "mbedtls/config.h"
32 #else
33 #include MBEDTLS_CONFIG_FILE
34 #endif
35 
36 #include <stddef.h>
37 
38 /* MBEDTLS_ERR_MD2_HW_ACCEL_FAILED is deprecated and should not be used. */
39 #define MBEDTLS_ERR_MD2_HW_ACCEL_FAILED -0x002B
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 #if !defined(MBEDTLS_MD2_ALT)
46 // Regular implementation
47 //
48 
57 typedef struct mbedtls_md2_context
58 {
59  unsigned char cksum[16];
60  unsigned char state[48];
61  unsigned char buffer[16];
62  size_t left;
63 }
64 mbedtls_md2_context;
65 
66 #else /* MBEDTLS_MD2_ALT */
67 #include "md2_alt.h"
68 #endif /* MBEDTLS_MD2_ALT */
69 
80 void mbedtls_md2_init( mbedtls_md2_context *ctx );
81 
92 void mbedtls_md2_free( mbedtls_md2_context *ctx );
93 
105 void mbedtls_md2_clone( mbedtls_md2_context *dst,
106  const mbedtls_md2_context *src );
107 
120 int mbedtls_md2_starts_ret( mbedtls_md2_context *ctx );
121 
136 int mbedtls_md2_update_ret( mbedtls_md2_context *ctx,
137  const unsigned char *input,
138  size_t ilen );
139 
153 int mbedtls_md2_finish_ret( mbedtls_md2_context *ctx,
154  unsigned char output[16] );
155 
168 int mbedtls_internal_md2_process( mbedtls_md2_context *ctx );
169 
170 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
171 #if defined(MBEDTLS_DEPRECATED_WARNING)
172 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
173 #else
174 #define MBEDTLS_DEPRECATED
175 #endif
176 
188 MBEDTLS_DEPRECATED void mbedtls_md2_starts( mbedtls_md2_context *ctx );
189 
204 MBEDTLS_DEPRECATED void mbedtls_md2_update( mbedtls_md2_context *ctx,
205  const unsigned char *input,
206  size_t ilen );
207 
221 MBEDTLS_DEPRECATED void mbedtls_md2_finish( mbedtls_md2_context *ctx,
222  unsigned char output[16] );
223 
236 MBEDTLS_DEPRECATED void mbedtls_md2_process( mbedtls_md2_context *ctx );
237 
238 #undef MBEDTLS_DEPRECATED
239 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
240 
253 int mbedtls_md2_ret( const unsigned char *input,
254  size_t ilen,
255  unsigned char output[16] );
256 
257 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
258 #if defined(MBEDTLS_DEPRECATED_WARNING)
259 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
260 #else
261 #define MBEDTLS_DEPRECATED
262 #endif
263 
277 MBEDTLS_DEPRECATED void mbedtls_md2( const unsigned char *input,
278  size_t ilen,
279  unsigned char output[16] );
280 
281 #undef MBEDTLS_DEPRECATED
282 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
283 
284 #if defined(MBEDTLS_SELF_TEST)
285 
296 int mbedtls_md2_self_test( int verbose );
297 
298 #endif /* MBEDTLS_SELF_TEST */
299 
300 #ifdef __cplusplus
301 }
302 #endif
303 
304 #endif /* mbedtls_md2.h */
int mbedtls_md2_update_ret(mbedtls_md2_context *ctx, const unsigned char *input, size_t ilen)
MD2 process buffer.
Configuration options (set of defines)
#define MBEDTLS_DEPRECATED
Definition: pkcs11.h:60
int mbedtls_md2_self_test(int verbose)
Checkup routine.
void mbedtls_md2_init(mbedtls_md2_context *ctx)
Initialize MD2 context.
int mbedtls_internal_md2_process(mbedtls_md2_context *ctx)
MD2 process data block (internal use only)
int mbedtls_md2_ret(const unsigned char *input, size_t ilen, unsigned char output[16])
Output = MD2( input buffer )
void mbedtls_md2_clone(mbedtls_md2_context *dst, const mbedtls_md2_context *src)
Clone (the state of) an MD2 context.
int mbedtls_md2_finish_ret(mbedtls_md2_context *ctx, unsigned char output[16])
MD2 final digest.
int mbedtls_md2_starts_ret(mbedtls_md2_context *ctx)
MD2 context setup.
void mbedtls_md2_free(mbedtls_md2_context *ctx)
Clear MD2 context.