Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-27 09:37:33

0001 /**
0002  * \file ripemd160.h
0003  *
0004  * \brief RIPE MD-160 message digest
0005  */
0006 /*
0007  *  Copyright The Mbed TLS Contributors
0008  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
0009  */
0010 #ifndef MBEDTLS_RIPEMD160_H
0011 #define MBEDTLS_RIPEMD160_H
0012 #include "mbedtls/private_access.h"
0013 
0014 #include "mbedtls/build_info.h"
0015 
0016 #include <stddef.h>
0017 #include <stdint.h>
0018 
0019 #ifdef __cplusplus
0020 extern "C" {
0021 #endif
0022 
0023 #if !defined(MBEDTLS_RIPEMD160_ALT)
0024 // Regular implementation
0025 //
0026 
0027 /**
0028  * \brief          RIPEMD-160 context structure
0029  */
0030 typedef struct mbedtls_ripemd160_context {
0031     uint32_t MBEDTLS_PRIVATE(total)[2];          /*!< number of bytes processed  */
0032     uint32_t MBEDTLS_PRIVATE(state)[5];          /*!< intermediate digest state  */
0033     unsigned char MBEDTLS_PRIVATE(buffer)[64];   /*!< data block being processed */
0034 }
0035 mbedtls_ripemd160_context;
0036 
0037 #else  /* MBEDTLS_RIPEMD160_ALT */
0038 #include "ripemd160_alt.h"
0039 #endif /* MBEDTLS_RIPEMD160_ALT */
0040 
0041 /**
0042  * \brief          Initialize RIPEMD-160 context
0043  *
0044  * \param ctx      RIPEMD-160 context to be initialized
0045  */
0046 void mbedtls_ripemd160_init(mbedtls_ripemd160_context *ctx);
0047 
0048 /**
0049  * \brief          Clear RIPEMD-160 context
0050  *
0051  * \param ctx      RIPEMD-160 context to be cleared
0052  */
0053 void mbedtls_ripemd160_free(mbedtls_ripemd160_context *ctx);
0054 
0055 /**
0056  * \brief          Clone (the state of) a RIPEMD-160 context
0057  *
0058  * \param dst      The destination context
0059  * \param src      The context to be cloned
0060  */
0061 void mbedtls_ripemd160_clone(mbedtls_ripemd160_context *dst,
0062                              const mbedtls_ripemd160_context *src);
0063 
0064 /**
0065  * \brief          RIPEMD-160 context setup
0066  *
0067  * \param ctx      context to be initialized
0068  *
0069  * \return         0 if successful
0070  */
0071 int mbedtls_ripemd160_starts(mbedtls_ripemd160_context *ctx);
0072 
0073 /**
0074  * \brief          RIPEMD-160 process buffer
0075  *
0076  * \param ctx      RIPEMD-160 context
0077  * \param input    buffer holding the data
0078  * \param ilen     length of the input data
0079  *
0080  * \return         0 if successful
0081  */
0082 int mbedtls_ripemd160_update(mbedtls_ripemd160_context *ctx,
0083                              const unsigned char *input,
0084                              size_t ilen);
0085 
0086 /**
0087  * \brief          RIPEMD-160 final digest
0088  *
0089  * \param ctx      RIPEMD-160 context
0090  * \param output   RIPEMD-160 checksum result
0091  *
0092  * \return         0 if successful
0093  */
0094 int mbedtls_ripemd160_finish(mbedtls_ripemd160_context *ctx,
0095                              unsigned char output[20]);
0096 
0097 /**
0098  * \brief          RIPEMD-160 process data block (internal use only)
0099  *
0100  * \param ctx      RIPEMD-160 context
0101  * \param data     buffer holding one block of data
0102  *
0103  * \return         0 if successful
0104  */
0105 int mbedtls_internal_ripemd160_process(mbedtls_ripemd160_context *ctx,
0106                                        const unsigned char data[64]);
0107 
0108 /**
0109  * \brief          Output = RIPEMD-160( input buffer )
0110  *
0111  * \param input    buffer holding the data
0112  * \param ilen     length of the input data
0113  * \param output   RIPEMD-160 checksum result
0114  *
0115  * \return         0 if successful
0116  */
0117 int mbedtls_ripemd160(const unsigned char *input,
0118                       size_t ilen,
0119                       unsigned char output[20]);
0120 
0121 #if defined(MBEDTLS_SELF_TEST)
0122 
0123 /**
0124  * \brief          Checkup routine
0125  *
0126  * \return         0 if successful, or 1 if the test failed
0127  */
0128 int mbedtls_ripemd160_self_test(int verbose);
0129 
0130 #endif /* MBEDTLS_SELF_TEST */
0131 
0132 #ifdef __cplusplus
0133 }
0134 #endif
0135 
0136 #endif /* mbedtls_ripemd160.h */