|
|
|||
File indexing completed on 2026-05-10 08:44:50
0001 /** 0002 * \file md5.h 0003 * 0004 * \brief MD5 message digest algorithm (hash function) 0005 * 0006 * \warning MD5 is considered a weak message digest and its use constitutes a 0007 * security risk. We recommend considering stronger message 0008 * digests instead. 0009 */ 0010 /* 0011 * Copyright The Mbed TLS Contributors 0012 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 0013 */ 0014 #ifndef MBEDTLS_MD5_H 0015 #define MBEDTLS_MD5_H 0016 #include "mbedtls/private_access.h" 0017 0018 #include "tf-psa-crypto/build_info.h" 0019 0020 #include <stddef.h> 0021 #include <stdint.h> 0022 0023 #ifdef __cplusplus 0024 extern "C" { 0025 #endif 0026 0027 /** 0028 * \brief MD5 context structure 0029 * 0030 * \warning MD5 is considered a weak message digest and its use 0031 * constitutes a security risk. We recommend considering 0032 * stronger message digests instead. 0033 * 0034 */ 0035 typedef struct mbedtls_md5_context { 0036 uint32_t MBEDTLS_PRIVATE(total)[2]; /*!< number of bytes processed */ 0037 uint32_t MBEDTLS_PRIVATE(state)[4]; /*!< intermediate digest state */ 0038 unsigned char MBEDTLS_PRIVATE(buffer)[64]; /*!< data block being processed */ 0039 } 0040 mbedtls_md5_context; 0041 0042 #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS) 0043 /** 0044 * \brief Initialize MD5 context 0045 * 0046 * \param ctx MD5 context to be initialized 0047 * 0048 * \warning MD5 is considered a weak message digest and its use 0049 * constitutes a security risk. We recommend considering 0050 * stronger message digests instead. 0051 * 0052 */ 0053 void mbedtls_md5_init(mbedtls_md5_context *ctx); 0054 0055 /** 0056 * \brief Clear MD5 context 0057 * 0058 * \param ctx MD5 context to be cleared 0059 * 0060 * \warning MD5 is considered a weak message digest and its use 0061 * constitutes a security risk. We recommend considering 0062 * stronger message digests instead. 0063 * 0064 */ 0065 void mbedtls_md5_free(mbedtls_md5_context *ctx); 0066 0067 /** 0068 * \brief Clone (the state of) an MD5 context 0069 * 0070 * \param dst The destination context 0071 * \param src The context to be cloned 0072 * 0073 * \warning MD5 is considered a weak message digest and its use 0074 * constitutes a security risk. We recommend considering 0075 * stronger message digests instead. 0076 * 0077 */ 0078 void mbedtls_md5_clone(mbedtls_md5_context *dst, 0079 const mbedtls_md5_context *src); 0080 0081 /** 0082 * \brief MD5 context setup 0083 * 0084 * \param ctx context to be initialized 0085 * 0086 * \return 0 if successful 0087 * 0088 * \warning MD5 is considered a weak message digest and its use 0089 * constitutes a security risk. We recommend considering 0090 * stronger message digests instead. 0091 * 0092 */ 0093 int mbedtls_md5_starts(mbedtls_md5_context *ctx); 0094 0095 /** 0096 * \brief MD5 process buffer 0097 * 0098 * \param ctx MD5 context 0099 * \param input buffer holding the data 0100 * \param ilen length of the input data 0101 * 0102 * \return 0 if successful 0103 * 0104 * \warning MD5 is considered a weak message digest and its use 0105 * constitutes a security risk. We recommend considering 0106 * stronger message digests instead. 0107 * 0108 */ 0109 int mbedtls_md5_update(mbedtls_md5_context *ctx, 0110 const unsigned char *input, 0111 size_t ilen); 0112 0113 /** 0114 * \brief MD5 final digest 0115 * 0116 * \param ctx MD5 context 0117 * \param output MD5 checksum result 0118 * 0119 * \return 0 if successful 0120 * 0121 * \warning MD5 is considered a weak message digest and its use 0122 * constitutes a security risk. We recommend considering 0123 * stronger message digests instead. 0124 * 0125 */ 0126 int mbedtls_md5_finish(mbedtls_md5_context *ctx, 0127 unsigned char output[16]); 0128 0129 /** 0130 * \brief Output = MD5( input buffer ) 0131 * 0132 * \param input buffer holding the data 0133 * \param ilen length of the input data 0134 * \param output MD5 checksum result 0135 * 0136 * \return 0 if successful 0137 * 0138 * \warning MD5 is considered a weak message digest and its use 0139 * constitutes a security risk. We recommend considering 0140 * stronger message digests instead. 0141 * 0142 */ 0143 int mbedtls_md5(const unsigned char *input, 0144 size_t ilen, 0145 unsigned char output[16]); 0146 0147 #if defined(MBEDTLS_SELF_TEST) 0148 0149 /** 0150 * \brief Checkup routine 0151 * 0152 * \return 0 if successful, or 1 if the test failed 0153 * 0154 * \warning MD5 is considered a weak message digest and its use 0155 * constitutes a security risk. We recommend considering 0156 * stronger message digests instead. 0157 * 0158 */ 0159 int mbedtls_md5_self_test(int verbose); 0160 0161 #endif /* MBEDTLS_SELF_TEST */ 0162 0163 #endif /* MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS */ 0164 0165 #ifdef __cplusplus 0166 } 0167 #endif 0168 0169 #endif /* mbedtls_md5.h */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|