BA
/
BaBoRo1
Embed:
(wiki syntax)
Show/hide line numbers
hash_wrappers.c
00001 #include "mbedtls/md2.h" 00002 #include "mbedtls/md4.h" 00003 #include "mbedtls/md5.h" 00004 #include "mbedtls/sha1.h" 00005 #include "mbedtls/sha256.h" 00006 #include "mbedtls/sha512.h" 00007 00008 #if defined(MBEDTLS_MD2_ALT) && defined(MBEDTLS_MD2_C) 00009 00010 /** 00011 * \brief MD2 context setup 00012 * 00013 * \deprecated Superseded by mbedtls_md2_starts_ret() in 2.7.0 00014 * 00015 * \param ctx context to be initialized 00016 * 00017 * \warning MD2 is considered a weak message digest and its use 00018 * constitutes a security risk. We recommend considering 00019 * stronger message digests instead. 00020 * 00021 */ 00022 void mbedtls_md2_starts( mbedtls_md2_context *ctx ) 00023 { 00024 mbedtls_md2_starts_ret( ctx ); 00025 } 00026 00027 /** 00028 * \brief MD2 process buffer 00029 * 00030 * \deprecated Superseded by mbedtls_md2_update_ret() in 2.7.0 00031 * 00032 * \param ctx MD2 context 00033 * \param input buffer holding the data 00034 * \param ilen length of the input data 00035 * 00036 * \warning MD2 is considered a weak message digest and its use 00037 * constitutes a security risk. We recommend considering 00038 * stronger message digests instead. 00039 * 00040 */ 00041 void mbedtls_md2_update( mbedtls_md2_context *ctx, 00042 const unsigned char *input, 00043 size_t ilen ) 00044 { 00045 mbedtls_md2_update_ret( ctx, input, ilen ); 00046 } 00047 00048 /** 00049 * \brief MD2 final digest 00050 * 00051 * \deprecated Superseded by mbedtls_md2_finish_ret() in 2.7.0 00052 * 00053 * \param ctx MD2 context 00054 * \param output MD2 checksum result 00055 * 00056 * \warning MD2 is considered a weak message digest and its use 00057 * constitutes a security risk. We recommend considering 00058 * stronger message digests instead. 00059 * 00060 */ 00061 void mbedtls_md2_finish( mbedtls_md2_context *ctx, 00062 unsigned char output[16] ) 00063 { 00064 mbedtls_md2_finish_ret( ctx, output ); 00065 } 00066 00067 #endif /* defined(MBEDTLS_MD2_ALT) */ 00068 00069 #if defined(MBEDTLS_MD4_ALT) && defined(MBEDTLS_MD4_C) 00070 00071 /** 00072 * \brief MD4 context setup 00073 * 00074 * \deprecated Superseded by mbedtls_md4_starts_ret() in 2.7.0 00075 * 00076 * \param ctx context to be initialized 00077 * 00078 * \warning MD4 is considered a weak message digest and its use 00079 * constitutes a security risk. We recommend considering 00080 * stronger message digests instead. 00081 * 00082 */ 00083 void mbedtls_md4_starts( mbedtls_md4_context *ctx ) 00084 { 00085 mbedtls_md4_starts_ret( ctx ); 00086 } 00087 00088 /** 00089 * \brief MD4 process buffer 00090 * 00091 * \deprecated Superseded by mbedtls_md4_update_ret() in 2.7.0 00092 * 00093 * \param ctx MD4 context 00094 * \param input buffer holding the data 00095 * \param ilen length of the input data 00096 * 00097 * \warning MD4 is considered a weak message digest and its use 00098 * constitutes a security risk. We recommend considering 00099 * stronger message digests instead. 00100 * 00101 */ 00102 void mbedtls_md4_update( mbedtls_md4_context *ctx, 00103 const unsigned char *input, 00104 size_t ilen ) 00105 { 00106 mbedtls_md4_update_ret( ctx, input, ilen ); 00107 } 00108 00109 /** 00110 * \brief MD4 final digest 00111 * 00112 * \deprecated Superseded by mbedtls_md4_finish_ret() in 2.7.0 00113 * 00114 * \param ctx MD4 context 00115 * \param output MD4 checksum result 00116 * 00117 * \warning MD4 is considered a weak message digest and its use 00118 * constitutes a security risk. We recommend considering 00119 * stronger message digests instead. 00120 * 00121 */ 00122 void mbedtls_md4_finish( mbedtls_md4_context *ctx, 00123 unsigned char output[16] ) 00124 { 00125 mbedtls_md4_finish_ret( ctx, output ); 00126 } 00127 00128 #endif /* defined(MBEDTLS_MD4_ALT) */ 00129 00130 #if defined(MBEDTLS_MD5_ALT) && defined(MBEDTLS_MD5_C) 00131 00132 /** 00133 * \brief MD5 context setup 00134 * 00135 * \deprecated Superseded by mbedtls_md5_starts_ret() in 2.7.0 00136 * 00137 * \param ctx context to be initialized 00138 * 00139 * \warning MD5 is considered a weak message digest and its use 00140 * constitutes a security risk. We recommend considering 00141 * stronger message digests instead. 00142 * 00143 */ 00144 void mbedtls_md5_starts( mbedtls_md5_context *ctx ) 00145 { 00146 mbedtls_md5_starts_ret( ctx ); 00147 } 00148 00149 /** 00150 * \brief MD5 process buffer 00151 * 00152 * \deprecated Superseded by mbedtls_md5_update_ret() in 2.7.0 00153 * 00154 * \param ctx MD5 context 00155 * \param input buffer holding the data 00156 * \param ilen length of the input data 00157 * 00158 * \warning MD5 is considered a weak message digest and its use 00159 * constitutes a security risk. We recommend considering 00160 * stronger message digests instead. 00161 * 00162 */ 00163 void mbedtls_md5_update( mbedtls_md5_context *ctx, 00164 const unsigned char *input, 00165 size_t ilen ) 00166 { 00167 mbedtls_md5_update_ret( ctx, input, ilen ); 00168 } 00169 00170 /** 00171 * \brief MD5 final digest 00172 * 00173 * \deprecated Superseded by mbedtls_md5_finish_ret() in 2.7.0 00174 * 00175 * \param ctx MD5 context 00176 * \param output MD5 checksum result 00177 * 00178 * \warning MD5 is considered a weak message digest and its use 00179 * constitutes a security risk. We recommend considering 00180 * stronger message digests instead. 00181 * 00182 */ 00183 void mbedtls_md5_finish( mbedtls_md5_context *ctx, 00184 unsigned char output[16] ) 00185 { 00186 mbedtls_md5_finish_ret( ctx, output ); 00187 } 00188 00189 #endif /* defined(MBEDTLS_MD5_ALT) */ 00190 00191 #if defined(MBEDTLS_SHA1_ALT) && defined(MBEDTLS_SHA1_C) 00192 00193 /** 00194 * \brief SHA-1 context setup 00195 * 00196 * \deprecated Superseded by mbedtls_sha1_starts_ret() in 2.7.0 00197 * 00198 * \param ctx The SHA-1 context to be initialized. 00199 * 00200 * \warning SHA-1 is considered a weak message digest and its use 00201 * constitutes a security risk. We recommend considering 00202 * stronger message digests instead. 00203 * 00204 */ 00205 void mbedtls_sha1_starts( mbedtls_sha1_context *ctx ) 00206 { 00207 mbedtls_sha1_starts_ret( ctx ); 00208 } 00209 00210 /** 00211 * \brief SHA-1 process buffer 00212 * 00213 * \deprecated Superseded by mbedtls_sha1_update_ret() in 2.7.0 00214 * 00215 * \param ctx The SHA-1 context. 00216 * \param input The buffer holding the input data. 00217 * \param ilen The length of the input data. 00218 * 00219 * \warning SHA-1 is considered a weak message digest and its use 00220 * constitutes a security risk. We recommend considering 00221 * stronger message digests instead. 00222 * 00223 */ 00224 void mbedtls_sha1_update( mbedtls_sha1_context *ctx, 00225 const unsigned char *input, 00226 size_t ilen ) 00227 { 00228 mbedtls_sha1_update_ret( ctx, input, ilen ); 00229 } 00230 00231 /** 00232 * \brief SHA-1 final digest 00233 * 00234 * \deprecated Superseded by mbedtls_sha1_finish_ret() in 2.7.0 00235 * 00236 * \param ctx The SHA-1 context. 00237 * \param output The SHA-1 checksum result. 00238 * 00239 * \warning SHA-1 is considered a weak message digest and its use 00240 * constitutes a security risk. We recommend considering 00241 * stronger message digests instead. 00242 * 00243 */ 00244 void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, 00245 unsigned char output[20] ) 00246 { 00247 mbedtls_sha1_finish_ret( ctx, output ); 00248 } 00249 00250 #endif /* defined(MBEDTLS_SHA1_ALT) */ 00251 00252 #if defined(MBEDTLS_SHA256_ALT) && defined(MBEDTLS_SHA256_C) 00253 00254 /** 00255 * \brief This function starts a SHA-256 checksum calculation. 00256 * 00257 * \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0. 00258 * 00259 * \param ctx The SHA-256 context to initialize. 00260 * \param is224 Determines which function to use. 00261 * <ul><li>0: Use SHA-256.</li> 00262 * <li>1: Use SHA-224.</li></ul> 00263 */ 00264 void mbedtls_sha256_starts( mbedtls_sha256_context *ctx, 00265 int is224 ) 00266 { 00267 mbedtls_sha256_starts_ret( ctx, is224 ); 00268 } 00269 00270 /** 00271 * \brief This function feeds an input buffer into an ongoing 00272 * SHA-256 checksum calculation. 00273 * 00274 * \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0. 00275 * 00276 * \param ctx The SHA-256 context to initialize. 00277 * \param input The buffer holding the data. 00278 * \param ilen The length of the input data. 00279 */ 00280 void mbedtls_sha256_update( mbedtls_sha256_context *ctx, 00281 const unsigned char *input, 00282 size_t ilen ) 00283 { 00284 mbedtls_sha256_update_ret( ctx, input, ilen ); 00285 } 00286 00287 /** 00288 * \brief This function finishes the SHA-256 operation, and writes 00289 * the result to the output buffer. 00290 * 00291 * \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0. 00292 * 00293 * \param ctx The SHA-256 context. 00294 * \param output The SHA-224or SHA-256 checksum result. 00295 */ 00296 void mbedtls_sha256_finish( mbedtls_sha256_context *ctx, 00297 unsigned char output[32] ) 00298 { 00299 mbedtls_sha256_finish_ret( ctx, output ); 00300 } 00301 00302 #endif /* defined(MBEDTLS_SHA256_ALT) */ 00303 00304 #if defined(MBEDTLS_SHA512_ALT) && defined(MBEDTLS_SHA512_C) 00305 00306 /** 00307 * \brief This function starts a SHA-384 or SHA-512 checksum 00308 * calculation. 00309 * 00310 * \deprecated Superseded by mbedtls_sha512_starts_ret() in 2.7.0 00311 * 00312 * \param ctx The SHA-512 context to initialize. 00313 * \param is384 Determines which function to use. 00314 * <ul><li>0: Use SHA-512.</li> 00315 * <li>1: Use SHA-384.</li></ul> 00316 */ 00317 void mbedtls_sha512_starts( mbedtls_sha512_context *ctx, 00318 int is384 ) 00319 { 00320 mbedtls_sha512_starts_ret( ctx, is384 ); 00321 } 00322 00323 /** 00324 * \brief This function feeds an input buffer into an ongoing 00325 * SHA-512 checksum calculation. 00326 * 00327 * \deprecated Superseded by mbedtls_sha512_update_ret() in 2.7.0 00328 * 00329 * \param ctx The SHA-512 context. 00330 * \param input The buffer holding the data. 00331 * \param ilen The length of the input data. 00332 */ 00333 void mbedtls_sha512_update( mbedtls_sha512_context *ctx, 00334 const unsigned char *input, 00335 size_t ilen ) 00336 { 00337 mbedtls_sha512_update_ret( ctx, input, ilen ); 00338 } 00339 00340 /** 00341 * \brief This function finishes the SHA-512 operation, and writes 00342 * the result to the output buffer. 00343 * 00344 * \deprecated Superseded by mbedtls_sha512_finish_ret() in 2.7.0 00345 * 00346 * \param ctx The SHA-512 context. 00347 * \param output The SHA-384 or SHA-512 checksum result. 00348 */ 00349 void mbedtls_sha512_finish( mbedtls_sha512_context *ctx, 00350 unsigned char output[64] ) 00351 { 00352 mbedtls_sha512_finish_ret( ctx, output ); 00353 } 00354 00355 #endif /* defined(MBEDTLS_SHA512_ALT) */ 00356
Generated on Tue Jul 12 2022 12:21:55 by
