Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
ripemd160.h
Go to the documentation of this file.
00001 /** 00002 * \file ripemd160.h 00003 * 00004 * \brief RIPE MD-160 message digest 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_RIPEMD160_H 00024 #define MBEDTLS_RIPEMD160_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 #include <stdint.h> 00034 00035 #if !defined(MBEDTLS_RIPEMD160_ALT) 00036 // Regular implementation 00037 // 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00043 /** 00044 * \brief RIPEMD-160 context structure 00045 */ 00046 typedef struct 00047 { 00048 uint32_t total[2]; /*!< number of bytes processed */ 00049 uint32_t state[5]; /*!< intermediate digest state */ 00050 unsigned char buffer[64]; /*!< data block being processed */ 00051 } 00052 mbedtls_ripemd160_context; 00053 00054 /** 00055 * \brief Initialize RIPEMD-160 context 00056 * 00057 * \param ctx RIPEMD-160 context to be initialized 00058 */ 00059 void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx ); 00060 00061 /** 00062 * \brief Clear RIPEMD-160 context 00063 * 00064 * \param ctx RIPEMD-160 context to be cleared 00065 */ 00066 void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx ); 00067 00068 /** 00069 * \brief Clone (the state of) an RIPEMD-160 context 00070 * 00071 * \param dst The destination context 00072 * \param src The context to be cloned 00073 */ 00074 void mbedtls_ripemd160_clone( mbedtls_ripemd160_context *dst, 00075 const mbedtls_ripemd160_context *src ); 00076 00077 /** 00078 * \brief RIPEMD-160 context setup 00079 * 00080 * \param ctx context to be initialized 00081 */ 00082 void mbedtls_ripemd160_starts( mbedtls_ripemd160_context *ctx ); 00083 00084 /** 00085 * \brief RIPEMD-160 process buffer 00086 * 00087 * \param ctx RIPEMD-160 context 00088 * \param input buffer holding the data 00089 * \param ilen length of the input data 00090 */ 00091 void mbedtls_ripemd160_update( mbedtls_ripemd160_context *ctx, 00092 const unsigned char *input, size_t ilen ); 00093 00094 /** 00095 * \brief RIPEMD-160 final digest 00096 * 00097 * \param ctx RIPEMD-160 context 00098 * \param output RIPEMD-160 checksum result 00099 */ 00100 void mbedtls_ripemd160_finish( mbedtls_ripemd160_context *ctx, unsigned char output[20] ); 00101 00102 /* Internal use */ 00103 void mbedtls_ripemd160_process( mbedtls_ripemd160_context *ctx, const unsigned char data[64] ); 00104 00105 #ifdef __cplusplus 00106 } 00107 #endif 00108 00109 #else /* MBEDTLS_RIPEMD160_ALT */ 00110 #include "ripemd160.h" 00111 #endif /* MBEDTLS_RIPEMD160_ALT */ 00112 00113 #ifdef __cplusplus 00114 extern "C" { 00115 #endif 00116 00117 /** 00118 * \brief Output = RIPEMD-160( input buffer ) 00119 * 00120 * \param input buffer holding the data 00121 * \param ilen length of the input data 00122 * \param output RIPEMD-160 checksum result 00123 */ 00124 void mbedtls_ripemd160( const unsigned char *input, size_t ilen, 00125 unsigned char output[20] ); 00126 00127 /** 00128 * \brief Checkup routine 00129 * 00130 * \return 0 if successful, or 1 if the test failed 00131 */ 00132 int mbedtls_ripemd160_self_test( int verbose ); 00133 00134 #ifdef __cplusplus 00135 } 00136 #endif 00137 00138 #endif /* mbedtls_ripemd160.h */
Generated on Sun Jul 17 2022 08:25:29 by 1.7.2