Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbedtls by
md2.h
00001 /** 00002 * \file mbedtls_md2.h 00003 * 00004 * \brief MD2 message digest algorithm (hash function) 00005 * 00006 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 * 00021 * This file is part of mbed TLS (https://tls.mbed.org) 00022 */ 00023 #ifndef MBEDTLS_MD2_H 00024 #define MBEDTLS_MD2_H 00025 00026 #if !defined(MBEDTLS_CONFIG_FILE) 00027 #include "config.h" 00028 #else 00029 #include MBEDTLS_CONFIG_FILE 00030 #endif 00031 00032 #include <stddef.h> 00033 00034 #if !defined(MBEDTLS_MD2_ALT) 00035 // Regular implementation 00036 // 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 /** 00043 * \brief MD2 context structure 00044 */ 00045 typedef struct 00046 { 00047 unsigned char cksum[16]; /*!< checksum of the data block */ 00048 unsigned char state[48]; /*!< intermediate digest state */ 00049 unsigned char buffer[16]; /*!< data block being processed */ 00050 size_t left ; /*!< amount of data in buffer */ 00051 } 00052 mbedtls_md2_context; 00053 00054 /** 00055 * \brief Initialize MD2 context 00056 * 00057 * \param ctx MD2 context to be initialized 00058 */ 00059 void mbedtls_md2_init( mbedtls_md2_context *ctx ); 00060 00061 /** 00062 * \brief Clear MD2 context 00063 * 00064 * \param ctx MD2 context to be cleared 00065 */ 00066 void mbedtls_md2_free( mbedtls_md2_context *ctx ); 00067 00068 /** 00069 * \brief Clone (the state of) an MD2 context 00070 * 00071 * \param dst The destination context 00072 * \param src The context to be cloned 00073 */ 00074 void mbedtls_md2_clone( mbedtls_md2_context *dst, 00075 const mbedtls_md2_context *src ); 00076 00077 /** 00078 * \brief MD2 context setup 00079 * 00080 * \param ctx context to be initialized 00081 */ 00082 void mbedtls_md2_starts( mbedtls_md2_context *ctx ); 00083 00084 /** 00085 * \brief MD2 process buffer 00086 * 00087 * \param ctx MD2 context 00088 * \param input buffer holding the data 00089 * \param ilen length of the input data 00090 */ 00091 void mbedtls_md2_update( mbedtls_md2_context *ctx, const unsigned char *input, size_t ilen ); 00092 00093 /** 00094 * \brief MD2 final digest 00095 * 00096 * \param ctx MD2 context 00097 * \param output MD2 checksum result 00098 */ 00099 void mbedtls_md2_finish( mbedtls_md2_context *ctx, unsigned char output[16] ); 00100 00101 #ifdef __cplusplus 00102 } 00103 #endif 00104 00105 #else /* MBEDTLS_MD2_ALT */ 00106 #include "md2_alt.h" 00107 #endif /* MBEDTLS_MD2_ALT */ 00108 00109 #ifdef __cplusplus 00110 extern "C" { 00111 #endif 00112 00113 /** 00114 * \brief Output = MD2( input buffer ) 00115 * 00116 * \param input buffer holding the data 00117 * \param ilen length of the input data 00118 * \param output MD2 checksum result 00119 */ 00120 void mbedtls_md2( const unsigned char *input, size_t ilen, unsigned char output[16] ); 00121 00122 /** 00123 * \brief Checkup routine 00124 * 00125 * \return 0 if successful, or 1 if the test failed 00126 */ 00127 int mbedtls_md2_self_test( int verbose ); 00128 00129 /* Internal use */ 00130 void mbedtls_md2_process( mbedtls_md2_context *ctx ); 00131 00132 #ifdef __cplusplus 00133 } 00134 #endif 00135 00136 #endif /* mbedtls_md2.h */
Generated on Tue Jul 12 2022 12:52:44 by
