00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifndef MBEDTLS_SHA1_H
00054 #define MBEDTLS_SHA1_H
00055
00056 #if !defined(MBEDTLS_CONFIG_FILE)
00057 #include "config.h"
00058 #else
00059 #include MBEDTLS_CONFIG_FILE
00060 #endif
00061
00062 #include <stddef.h>
00063 #include <stdint.h>
00064
00065 #define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035
00067 #if !defined(MBEDTLS_SHA1_ALT)
00068
00069
00070
00071 #ifdef __cplusplus
00072 extern "C" {
00073 #endif
00074
00083 typedef struct
00084 {
00085 uint32_t total[2];
00086 uint32_t state[5];
00087 unsigned char buffer[64];
00088 }
00089 mbedtls_sha1_context;
00090
00101 void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
00102
00113 void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
00114
00126 void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
00127 const mbedtls_sha1_context *src );
00128
00141 int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
00142
00158 int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
00159 const unsigned char *input,
00160 size_t ilen );
00161
00176 int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
00177 unsigned char output[20] );
00178
00192 int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
00193 const unsigned char data[64] );
00194
00195 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00196 #if defined(MBEDTLS_DEPRECATED_WARNING)
00197 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00198 #else
00199 #define MBEDTLS_DEPRECATED
00200 #endif
00201
00213 MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
00214
00229 MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
00230 const unsigned char *input,
00231 size_t ilen );
00232
00246 MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
00247 unsigned char output[20] );
00248
00262 MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
00263 const unsigned char data[64] );
00264
00265 #undef MBEDTLS_DEPRECATED
00266 #endif
00267
00268 #ifdef __cplusplus
00269 }
00270 #endif
00271
00272 #else
00273 #include "sha1_alt.h"
00274 #endif
00275
00276 #ifdef __cplusplus
00277 extern "C" {
00278 #endif
00279
00300 int mbedtls_sha1_ret( const unsigned char *input,
00301 size_t ilen,
00302 unsigned char output[20] );
00303
00304 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00305 #if defined(MBEDTLS_DEPRECATED_WARNING)
00306 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00307 #else
00308 #define MBEDTLS_DEPRECATED
00309 #endif
00310
00324 MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
00325 size_t ilen,
00326 unsigned char output[20] );
00327
00328 #undef MBEDTLS_DEPRECATED
00329 #endif
00330
00341 int mbedtls_sha1_self_test( int verbose );
00342
00343 #ifdef __cplusplus
00344 }
00345 #endif
00346
00347 #endif