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.
ripemd160.h
00001 /** 00002 * \file ripemd160.h 00003 * 00004 * \brief RIPE MD-160 message digest 00005 */ 00006 /* 00007 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 00008 * SPDX-License-Identifier: Apache-2.0 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00011 * not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00018 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 * 00022 * This file is part of mbed TLS (https://tls.mbed.org) 00023 */ 00024 #ifndef MBEDTLS_RIPEMD160_H 00025 #define MBEDTLS_RIPEMD160_H 00026 00027 #if !defined(MBEDTLS_CONFIG_FILE) 00028 #include "config.h" 00029 #else 00030 #include MBEDTLS_CONFIG_FILE 00031 #endif 00032 00033 #include <stddef.h> 00034 #include <stdint.h> 00035 00036 #define MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED -0x0031 /**< RIPEMD160 hardware accelerator failed */ 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 #if !defined(MBEDTLS_RIPEMD160_ALT) 00043 // Regular implementation 00044 // 00045 00046 /** 00047 * \brief RIPEMD-160 context structure 00048 */ 00049 typedef struct 00050 { 00051 uint32_t total[2]; /*!< number of bytes processed */ 00052 uint32_t state[5]; /*!< intermediate digest state */ 00053 unsigned char buffer[64]; /*!< data block being processed */ 00054 } 00055 mbedtls_ripemd160_context; 00056 00057 #else /* MBEDTLS_RIPEMD160_ALT */ 00058 #include "ripemd160.h" 00059 #endif /* MBEDTLS_RIPEMD160_ALT */ 00060 00061 /** 00062 * \brief Initialize RIPEMD-160 context 00063 * 00064 * \param ctx RIPEMD-160 context to be initialized 00065 */ 00066 void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx ); 00067 00068 /** 00069 * \brief Clear RIPEMD-160 context 00070 * 00071 * \param ctx RIPEMD-160 context to be cleared 00072 */ 00073 void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx ); 00074 00075 /** 00076 * \brief Clone (the state of) an RIPEMD-160 context 00077 * 00078 * \param dst The destination context 00079 * \param src The context to be cloned 00080 */ 00081 void mbedtls_ripemd160_clone( mbedtls_ripemd160_context *dst, 00082 const mbedtls_ripemd160_context *src ); 00083 00084 /** 00085 * \brief RIPEMD-160 context setup 00086 * 00087 * \param ctx context to be initialized 00088 * 00089 * \return 0 if successful 00090 */ 00091 int mbedtls_ripemd160_starts_ret( mbedtls_ripemd160_context *ctx ); 00092 00093 /** 00094 * \brief RIPEMD-160 process buffer 00095 * 00096 * \param ctx RIPEMD-160 context 00097 * \param input buffer holding the data 00098 * \param ilen length of the input data 00099 * 00100 * \return 0 if successful 00101 */ 00102 int mbedtls_ripemd160_update_ret( mbedtls_ripemd160_context *ctx, 00103 const unsigned char *input, 00104 size_t ilen ); 00105 00106 /** 00107 * \brief RIPEMD-160 final digest 00108 * 00109 * \param ctx RIPEMD-160 context 00110 * \param output RIPEMD-160 checksum result 00111 * 00112 * \return 0 if successful 00113 */ 00114 int mbedtls_ripemd160_finish_ret( mbedtls_ripemd160_context *ctx, 00115 unsigned char output[20] ); 00116 00117 /** 00118 * \brief RIPEMD-160 process data block (internal use only) 00119 * 00120 * \param ctx RIPEMD-160 context 00121 * \param data buffer holding one block of data 00122 * 00123 * \return 0 if successful 00124 */ 00125 int mbedtls_internal_ripemd160_process( mbedtls_ripemd160_context *ctx, 00126 const unsigned char data[64] ); 00127 00128 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 00129 #if defined(MBEDTLS_DEPRECATED_WARNING) 00130 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 00131 #else 00132 #define MBEDTLS_DEPRECATED 00133 #endif 00134 /** 00135 * \brief RIPEMD-160 context setup 00136 * 00137 * \deprecated Superseded by mbedtls_ripemd160_starts_ret() in 2.7.0 00138 * 00139 * \param ctx context to be initialized 00140 */ 00141 MBEDTLS_DEPRECATED void mbedtls_ripemd160_starts( 00142 mbedtls_ripemd160_context *ctx ); 00143 00144 /** 00145 * \brief RIPEMD-160 process buffer 00146 * 00147 * \deprecated Superseded by mbedtls_ripemd160_update_ret() in 2.7.0 00148 * 00149 * \param ctx RIPEMD-160 context 00150 * \param input buffer holding the data 00151 * \param ilen length of the input data 00152 */ 00153 MBEDTLS_DEPRECATED void mbedtls_ripemd160_update( 00154 mbedtls_ripemd160_context *ctx, 00155 const unsigned char *input, 00156 size_t ilen ); 00157 00158 /** 00159 * \brief RIPEMD-160 final digest 00160 * 00161 * \deprecated Superseded by mbedtls_ripemd160_finish_ret() in 2.7.0 00162 * 00163 * \param ctx RIPEMD-160 context 00164 * \param output RIPEMD-160 checksum result 00165 */ 00166 MBEDTLS_DEPRECATED void mbedtls_ripemd160_finish( 00167 mbedtls_ripemd160_context *ctx, 00168 unsigned char output[20] ); 00169 00170 /** 00171 * \brief RIPEMD-160 process data block (internal use only) 00172 * 00173 * \deprecated Superseded by mbedtls_internal_ripemd160_process() in 2.7.0 00174 * 00175 * \param ctx RIPEMD-160 context 00176 * \param data buffer holding one block of data 00177 */ 00178 MBEDTLS_DEPRECATED void mbedtls_ripemd160_process( 00179 mbedtls_ripemd160_context *ctx, 00180 const unsigned char data[64] ); 00181 00182 #undef MBEDTLS_DEPRECATED 00183 #endif /* !MBEDTLS_DEPRECATED_REMOVED */ 00184 00185 /** 00186 * \brief Output = RIPEMD-160( input buffer ) 00187 * 00188 * \param input buffer holding the data 00189 * \param ilen length of the input data 00190 * \param output RIPEMD-160 checksum result 00191 * 00192 * \return 0 if successful 00193 */ 00194 int mbedtls_ripemd160_ret( const unsigned char *input, 00195 size_t ilen, 00196 unsigned char output[20] ); 00197 00198 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 00199 #if defined(MBEDTLS_DEPRECATED_WARNING) 00200 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 00201 #else 00202 #define MBEDTLS_DEPRECATED 00203 #endif 00204 /** 00205 * \brief Output = RIPEMD-160( input buffer ) 00206 * 00207 * \deprecated Superseded by mbedtls_ripemd160_ret() in 2.7.0 00208 * 00209 * \param input buffer holding the data 00210 * \param ilen length of the input data 00211 * \param output RIPEMD-160 checksum result 00212 */ 00213 MBEDTLS_DEPRECATED void mbedtls_ripemd160( const unsigned char *input, 00214 size_t ilen, 00215 unsigned char output[20] ); 00216 00217 #undef MBEDTLS_DEPRECATED 00218 #endif /* !MBEDTLS_DEPRECATED_REMOVED */ 00219 00220 /** 00221 * \brief Checkup routine 00222 * 00223 * \return 0 if successful, or 1 if the test failed 00224 */ 00225 int mbedtls_ripemd160_self_test( int verbose ); 00226 00227 #ifdef __cplusplus 00228 } 00229 #endif 00230 00231 #endif /* mbedtls_ripemd160.h */
Generated on Tue Jul 12 2022 12:45:43 by
