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 #if !defined(MBEDTLS_RIPEMD160_ALT) 00039 // Regular implementation 00040 // 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 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 /** 00058 * \brief Initialize RIPEMD-160 context 00059 * 00060 * \param ctx RIPEMD-160 context to be initialized 00061 */ 00062 void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx ); 00063 00064 /** 00065 * \brief Clear RIPEMD-160 context 00066 * 00067 * \param ctx RIPEMD-160 context to be cleared 00068 */ 00069 void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx ); 00070 00071 /** 00072 * \brief Clone (the state of) an RIPEMD-160 context 00073 * 00074 * \param dst The destination context 00075 * \param src The context to be cloned 00076 */ 00077 void mbedtls_ripemd160_clone( mbedtls_ripemd160_context *dst, 00078 const mbedtls_ripemd160_context *src ); 00079 00080 /** 00081 * \brief RIPEMD-160 context setup 00082 * 00083 * \param ctx context to be initialized 00084 * 00085 * \return 0 if successful 00086 */ 00087 int mbedtls_ripemd160_starts_ret( mbedtls_ripemd160_context *ctx ); 00088 00089 /** 00090 * \brief RIPEMD-160 process buffer 00091 * 00092 * \param ctx RIPEMD-160 context 00093 * \param input buffer holding the data 00094 * \param ilen length of the input data 00095 * 00096 * \return 0 if successful 00097 */ 00098 int mbedtls_ripemd160_update_ret( mbedtls_ripemd160_context *ctx, 00099 const unsigned char *input, 00100 size_t ilen ); 00101 00102 /** 00103 * \brief RIPEMD-160 final digest 00104 * 00105 * \param ctx RIPEMD-160 context 00106 * \param output RIPEMD-160 checksum result 00107 * 00108 * \return 0 if successful 00109 */ 00110 int mbedtls_ripemd160_finish_ret( mbedtls_ripemd160_context *ctx, 00111 unsigned char output[20] ); 00112 00113 /** 00114 * \brief RIPEMD-160 process data block (internal use only) 00115 * 00116 * \param ctx RIPEMD-160 context 00117 * \param data buffer holding one block of data 00118 * 00119 * \return 0 if successful 00120 */ 00121 int mbedtls_internal_ripemd160_process( mbedtls_ripemd160_context *ctx, 00122 const unsigned char data[64] ); 00123 00124 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 00125 #if defined(MBEDTLS_DEPRECATED_WARNING) 00126 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 00127 #else 00128 #define MBEDTLS_DEPRECATED 00129 #endif 00130 /** 00131 * \brief RIPEMD-160 context setup 00132 * 00133 * \deprecated Superseded by mbedtls_ripemd160_starts_ret() in 2.7.0 00134 * 00135 * \param ctx context to be initialized 00136 */ 00137 MBEDTLS_DEPRECATED void mbedtls_ripemd160_starts( 00138 mbedtls_ripemd160_context *ctx ); 00139 00140 /** 00141 * \brief RIPEMD-160 process buffer 00142 * 00143 * \deprecated Superseded by mbedtls_ripemd160_update_ret() in 2.7.0 00144 * 00145 * \param ctx RIPEMD-160 context 00146 * \param input buffer holding the data 00147 * \param ilen length of the input data 00148 */ 00149 MBEDTLS_DEPRECATED void mbedtls_ripemd160_update( 00150 mbedtls_ripemd160_context *ctx, 00151 const unsigned char *input, 00152 size_t ilen ); 00153 00154 /** 00155 * \brief RIPEMD-160 final digest 00156 * 00157 * \deprecated Superseded by mbedtls_ripemd160_finish_ret() in 2.7.0 00158 * 00159 * \param ctx RIPEMD-160 context 00160 * \param output RIPEMD-160 checksum result 00161 */ 00162 MBEDTLS_DEPRECATED void mbedtls_ripemd160_finish( 00163 mbedtls_ripemd160_context *ctx, 00164 unsigned char output[20] ); 00165 00166 /** 00167 * \brief RIPEMD-160 process data block (internal use only) 00168 * 00169 * \deprecated Superseded by mbedtls_internal_ripemd160_process() in 2.7.0 00170 * 00171 * \param ctx RIPEMD-160 context 00172 * \param data buffer holding one block of data 00173 */ 00174 MBEDTLS_DEPRECATED void mbedtls_ripemd160_process( 00175 mbedtls_ripemd160_context *ctx, 00176 const unsigned char data[64] ); 00177 00178 #undef MBEDTLS_DEPRECATED 00179 #endif /* !MBEDTLS_DEPRECATED_REMOVED */ 00180 00181 #ifdef __cplusplus 00182 } 00183 #endif 00184 00185 #else /* MBEDTLS_RIPEMD160_ALT */ 00186 #include "ripemd160_alt.h" 00187 #endif /* MBEDTLS_RIPEMD160_ALT */ 00188 00189 #ifdef __cplusplus 00190 extern "C" { 00191 #endif 00192 00193 /** 00194 * \brief Output = RIPEMD-160( input buffer ) 00195 * 00196 * \param input buffer holding the data 00197 * \param ilen length of the input data 00198 * \param output RIPEMD-160 checksum result 00199 * 00200 * \return 0 if successful 00201 */ 00202 int mbedtls_ripemd160_ret( const unsigned char *input, 00203 size_t ilen, 00204 unsigned char output[20] ); 00205 00206 #if !defined(MBEDTLS_DEPRECATED_REMOVED) 00207 #if defined(MBEDTLS_DEPRECATED_WARNING) 00208 #define MBEDTLS_DEPRECATED __attribute__((deprecated)) 00209 #else 00210 #define MBEDTLS_DEPRECATED 00211 #endif 00212 /** 00213 * \brief Output = RIPEMD-160( input buffer ) 00214 * 00215 * \deprecated Superseded by mbedtls_ripemd160_ret() in 2.7.0 00216 * 00217 * \param input buffer holding the data 00218 * \param ilen length of the input data 00219 * \param output RIPEMD-160 checksum result 00220 */ 00221 MBEDTLS_DEPRECATED void mbedtls_ripemd160( const unsigned char *input, 00222 size_t ilen, 00223 unsigned char output[20] ); 00224 00225 #undef MBEDTLS_DEPRECATED 00226 #endif /* !MBEDTLS_DEPRECATED_REMOVED */ 00227 00228 /** 00229 * \brief Checkup routine 00230 * 00231 * \return 0 if successful, or 1 if the test failed 00232 */ 00233 int mbedtls_ripemd160_self_test( int verbose ); 00234 00235 #ifdef __cplusplus 00236 } 00237 #endif 00238 00239 #endif /* mbedtls_ripemd160.h */
Generated on Tue Jul 12 2022 14:24:32 by
