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
00054
00055 #ifndef MBEDTLS_SHA1_H
00056 #define MBEDTLS_SHA1_H
00057
00058 #if !defined(MBEDTLS_CONFIG_FILE)
00059 #include "config.h"
00060 #else
00061 #include MBEDTLS_CONFIG_FILE
00062 #endif
00063
00064 #include <stddef.h>
00065 #include <stdint.h>
00066
00067 #define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035
00069 #if !defined(MBEDTLS_SHA1_ALT)
00070
00071
00072
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00076
00085 typedef struct
00086 {
00087 uint32_t total[2];
00088 uint32_t state[5];
00089 unsigned char buffer[64];
00090 }
00091 mbedtls_sha1_context;
00092
00103 void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
00104
00115 void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
00116
00128 void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
00129 const mbedtls_sha1_context *src );
00130
00143 int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
00144
00160 int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
00161 const unsigned char *input,
00162 size_t ilen );
00163
00178 int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
00179 unsigned char output[20] );
00180
00194 int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
00195 const unsigned char data[64] );
00196
00197 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00198 #if defined(MBEDTLS_DEPRECATED_WARNING)
00199 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00200 #else
00201 #define MBEDTLS_DEPRECATED
00202 #endif
00203
00215 MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
00216
00231 MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
00232 const unsigned char *input,
00233 size_t ilen );
00234
00248 MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
00249 unsigned char output[20] );
00250
00264 MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
00265 const unsigned char data[64] );
00266
00267 #undef MBEDTLS_DEPRECATED
00268 #endif
00269
00270 #ifdef __cplusplus
00271 }
00272 #endif
00273
00274 #else
00275 #include "sha1_alt.h"
00276 #endif
00277
00278 #ifdef __cplusplus
00279 extern "C" {
00280 #endif
00281
00302 int mbedtls_sha1_ret( const unsigned char *input,
00303 size_t ilen,
00304 unsigned char output[20] );
00305
00306 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00307 #if defined(MBEDTLS_DEPRECATED_WARNING)
00308 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00309 #else
00310 #define MBEDTLS_DEPRECATED
00311 #endif
00312
00326 MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
00327 size_t ilen,
00328 unsigned char output[20] );
00329
00330 #undef MBEDTLS_DEPRECATED
00331 #endif
00332
00343 int mbedtls_sha1_self_test( int verbose );
00344
00345 #ifdef __cplusplus
00346 }
00347 #endif
00348
00349 #endif