4 * \brief MD2 message digest algorithm (hash function)
6 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
7 * SPDX-License-Identifier: Apache-2.0
9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
10 * not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * This file is part of mbed TLS (https://tls.mbed.org)
26 #if !defined(MBEDTLS_CONFIG_FILE)
29 #include MBEDTLS_CONFIG_FILE
34 #if !defined(MBEDTLS_MD2_ALT)
35 // Regular implementation
43 * \brief MD2 context structure
47 unsigned char cksum[16]; /*!< checksum of the data block */
48 unsigned char state[48]; /*!< intermediate digest state */
49 unsigned char buffer[16]; /*!< data block being processed */
50 size_t left; /*!< amount of data in buffer */
55 * \brief Initialize MD2 context
57 * \param ctx MD2 context to be initialized
59 void mbedtls_md2_init( mbedtls_md2_context *ctx );
62 * \brief Clear MD2 context
64 * \param ctx MD2 context to be cleared
66 void mbedtls_md2_free( mbedtls_md2_context *ctx );
69 * \brief Clone (the state of) an MD2 context
71 * \param dst The destination context
72 * \param src The context to be cloned
74 void mbedtls_md2_clone( mbedtls_md2_context *dst,
75 const mbedtls_md2_context *src );
78 * \brief MD2 context setup
80 * \param ctx context to be initialized
82 void mbedtls_md2_starts( mbedtls_md2_context *ctx );
85 * \brief MD2 process buffer
87 * \param ctx MD2 context
88 * \param input buffer holding the data
89 * \param ilen length of the input data
91 void mbedtls_md2_update( mbedtls_md2_context *ctx, const unsigned char *input, size_t ilen );
94 * \brief MD2 final digest
96 * \param ctx MD2 context
97 * \param output MD2 checksum result
99 void mbedtls_md2_finish( mbedtls_md2_context *ctx, unsigned char output[16] );
105 #else /* MBEDTLS_MD2_ALT */
107 #endif /* MBEDTLS_MD2_ALT */
114 * \brief Output = MD2( input buffer )
116 * \param input buffer holding the data
117 * \param ilen length of the input data
118 * \param output MD2 checksum result
120 void mbedtls_md2( const unsigned char *input, size_t ilen, unsigned char output[16] );
123 * \brief Checkup routine
125 * \return 0 if successful, or 1 if the test failed
127 int mbedtls_md2_self_test( int verbose );
130 void mbedtls_md2_process( mbedtls_md2_context *ctx );
136 #endif /* mbedtls_md2.h */