00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef MBEDTLS_MD2_H
00030 #define MBEDTLS_MD2_H
00031
00032 #if !defined(MBEDTLS_CONFIG_FILE)
00033 #include "config.h"
00034 #else
00035 #include MBEDTLS_CONFIG_FILE
00036 #endif
00037
00038 #include <stddef.h>
00039
00040 #define MBEDTLS_ERR_MD2_HW_ACCEL_FAILED -0x002B
00042 #if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
00043 !defined(inline) && !defined(__cplusplus)
00044 #define inline __inline
00045 #endif
00046
00047 #if !defined(MBEDTLS_MD2_ALT)
00048
00049
00050
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054
00063 typedef struct
00064 {
00065 unsigned char cksum[16];
00066 unsigned char state[48];
00067 unsigned char buffer[16];
00068 size_t left;
00069 }
00070 mbedtls_md2_context;
00071
00082 void mbedtls_md2_init( mbedtls_md2_context *ctx );
00083
00094 void mbedtls_md2_free( mbedtls_md2_context *ctx );
00095
00107 void mbedtls_md2_clone( mbedtls_md2_context *dst,
00108 const mbedtls_md2_context *src );
00109
00122 int mbedtls_md2_starts_ret( mbedtls_md2_context *ctx );
00123
00138 int mbedtls_md2_update_ret( mbedtls_md2_context *ctx,
00139 const unsigned char *input,
00140 size_t ilen );
00141
00155 int mbedtls_md2_finish_ret( mbedtls_md2_context *ctx,
00156 unsigned char output[16] );
00157
00170 int mbedtls_internal_md2_process( mbedtls_md2_context *ctx );
00171
00172 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00173 #if defined(MBEDTLS_DEPRECATED_WARNING)
00174 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00175 #else
00176 #define MBEDTLS_DEPRECATED
00177 #endif
00178
00190 MBEDTLS_DEPRECATED static inline void mbedtls_md2_starts(
00191 mbedtls_md2_context *ctx )
00192 {
00193 mbedtls_md2_starts_ret( ctx );
00194 }
00195
00210 MBEDTLS_DEPRECATED static inline void mbedtls_md2_update(
00211 mbedtls_md2_context *ctx,
00212 const unsigned char *input,
00213 size_t ilen )
00214 {
00215 mbedtls_md2_update_ret( ctx, input, ilen );
00216 }
00217
00231 MBEDTLS_DEPRECATED static inline void mbedtls_md2_finish(
00232 mbedtls_md2_context *ctx,
00233 unsigned char output[16] )
00234 {
00235 mbedtls_md2_finish_ret( ctx, output );
00236 }
00237
00250 MBEDTLS_DEPRECATED static inline void mbedtls_md2_process(
00251 mbedtls_md2_context *ctx )
00252 {
00253 mbedtls_internal_md2_process( ctx );
00254 }
00255
00256 #undef MBEDTLS_DEPRECATED
00257 #endif
00258
00259 #ifdef __cplusplus
00260 }
00261 #endif
00262
00263 #else
00264 #include "md2_alt.h"
00265 #endif
00266
00267 #ifdef __cplusplus
00268 extern "C" {
00269 #endif
00270
00283 int mbedtls_md2_ret( const unsigned char *input,
00284 size_t ilen,
00285 unsigned char output[16] );
00286
00287 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00288 #if defined(MBEDTLS_DEPRECATED_WARNING)
00289 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00290 #else
00291 #define MBEDTLS_DEPRECATED
00292 #endif
00293
00307 MBEDTLS_DEPRECATED static inline void mbedtls_md2( const unsigned char *input,
00308 size_t ilen,
00309 unsigned char output[16] )
00310 {
00311 mbedtls_md2_ret( input, ilen, output );
00312 }
00313
00314 #undef MBEDTLS_DEPRECATED
00315 #endif
00316
00327 int mbedtls_md2_self_test( int verbose );
00328
00329 #ifdef __cplusplus
00330 }
00331 #endif
00332
00333 #endif