Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:50

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 "tf-psa-crypto/build_info.h"
0015 
0016 #include <stddef.h>
0017 #include <stdint.h>
0018 
0019 #ifdef __cplusplus
0020 extern "C" {
0021 #endif
0022 
0023 /**
0024  * \brief          RIPEMD-160 context structure
0025  */
0026 typedef struct mbedtls_ripemd160_context {
0027     uint32_t MBEDTLS_PRIVATE(total)[2];          /*!< number of bytes processed  */
0028     uint32_t MBEDTLS_PRIVATE(state)[5];          /*!< intermediate digest state  */
0029     unsigned char MBEDTLS_PRIVATE(buffer)[64];   /*!< data block being processed */
0030 }
0031 mbedtls_ripemd160_context;
0032 
0033 #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
0034 /**
0035  * \brief          Initialize RIPEMD-160 context
0036  *
0037  * \param ctx      RIPEMD-160 context to be initialized
0038  */
0039 void mbedtls_ripemd160_init(mbedtls_ripemd160_context *ctx);
0040 
0041 /**
0042  * \brief          Clear RIPEMD-160 context
0043  *
0044  * \param ctx      RIPEMD-160 context to be cleared
0045  */
0046 void mbedtls_ripemd160_free(mbedtls_ripemd160_context *ctx);
0047 
0048 /**
0049  * \brief          Clone (the state of) a RIPEMD-160 context
0050  *
0051  * \param dst      The destination context
0052  * \param src      The context to be cloned
0053  */
0054 void mbedtls_ripemd160_clone(mbedtls_ripemd160_context *dst,
0055                              const mbedtls_ripemd160_context *src);
0056 
0057 /**
0058  * \brief          RIPEMD-160 context setup
0059  *
0060  * \param ctx      context to be initialized
0061  *
0062  * \return         0 if successful
0063  */
0064 int mbedtls_ripemd160_starts(mbedtls_ripemd160_context *ctx);
0065 
0066 /**
0067  * \brief          RIPEMD-160 process buffer
0068  *
0069  * \param ctx      RIPEMD-160 context
0070  * \param input    buffer holding the data
0071  * \param ilen     length of the input data
0072  *
0073  * \return         0 if successful
0074  */
0075 int mbedtls_ripemd160_update(mbedtls_ripemd160_context *ctx,
0076                              const unsigned char *input,
0077                              size_t ilen);
0078 
0079 /**
0080  * \brief          RIPEMD-160 final digest
0081  *
0082  * \param ctx      RIPEMD-160 context
0083  * \param output   RIPEMD-160 checksum result
0084  *
0085  * \return         0 if successful
0086  */
0087 int mbedtls_ripemd160_finish(mbedtls_ripemd160_context *ctx,
0088                              unsigned char output[20]);
0089 
0090 /**
0091  * \brief          Output = RIPEMD-160( input buffer )
0092  *
0093  * \param input    buffer holding the data
0094  * \param ilen     length of the input data
0095  * \param output   RIPEMD-160 checksum result
0096  *
0097  * \return         0 if successful
0098  */
0099 int mbedtls_ripemd160(const unsigned char *input,
0100                       size_t ilen,
0101                       unsigned char output[20]);
0102 
0103 #if defined(MBEDTLS_SELF_TEST)
0104 
0105 /**
0106  * \brief          Checkup routine
0107  *
0108  * \return         0 if successful, or 1 if the test failed
0109  */
0110 int mbedtls_ripemd160_self_test(int verbose);
0111 
0112 #endif /* MBEDTLS_SELF_TEST */
0113 
0114 #endif /* MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS */
0115 
0116 #ifdef __cplusplus
0117 }
0118 #endif
0119 
0120 #endif /* mbedtls_ripemd160.h */