00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef MBEDTLS_SHA1_H
00029 #define MBEDTLS_SHA1_H
00030
00031 #if !defined(MBEDTLS_CONFIG_FILE)
00032 #include "config.h"
00033 #else
00034 #include MBEDTLS_CONFIG_FILE
00035 #endif
00036
00037 #include <stddef.h>
00038 #include <stdint.h>
00039
00040 #define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035
00042 #if !defined(MBEDTLS_SHA1_ALT)
00043
00044
00045
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049
00058 typedef struct
00059 {
00060 uint32_t total[2];
00061 uint32_t state[5];
00062 unsigned char buffer[64];
00063 }
00064 mbedtls_sha1_context;
00065
00076 void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
00077
00088 void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
00089
00101 void mbedtls_sha1_clone( mbedtls_sha1_context *dst,
00102 const mbedtls_sha1_context *src );
00103
00116 int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx );
00117
00133 int mbedtls_sha1_update_ret( mbedtls_sha1_context *ctx,
00134 const unsigned char *input,
00135 size_t ilen );
00136
00151 int mbedtls_sha1_finish_ret( mbedtls_sha1_context *ctx,
00152 unsigned char output[20] );
00153
00167 int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx,
00168 const unsigned char data[64] );
00169
00170 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00171 #if defined(MBEDTLS_DEPRECATED_WARNING)
00172 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00173 #else
00174 #define MBEDTLS_DEPRECATED
00175 #endif
00176
00188 MBEDTLS_DEPRECATED void mbedtls_sha1_starts( mbedtls_sha1_context *ctx );
00189
00204 MBEDTLS_DEPRECATED void mbedtls_sha1_update( mbedtls_sha1_context *ctx,
00205 const unsigned char *input,
00206 size_t ilen );
00207
00221 MBEDTLS_DEPRECATED void mbedtls_sha1_finish( mbedtls_sha1_context *ctx,
00222 unsigned char output[20] );
00223
00237 MBEDTLS_DEPRECATED void mbedtls_sha1_process( mbedtls_sha1_context *ctx,
00238 const unsigned char data[64] );
00239
00240 #undef MBEDTLS_DEPRECATED
00241 #endif
00242
00243 #ifdef __cplusplus
00244 }
00245 #endif
00246
00247 #else
00248 #include "sha1_alt.h"
00249 #endif
00250
00251 #ifdef __cplusplus
00252 extern "C" {
00253 #endif
00254
00275 int mbedtls_sha1_ret( const unsigned char *input,
00276 size_t ilen,
00277 unsigned char output[20] );
00278
00279 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00280 #if defined(MBEDTLS_DEPRECATED_WARNING)
00281 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00282 #else
00283 #define MBEDTLS_DEPRECATED
00284 #endif
00285
00299 MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
00300 size_t ilen,
00301 unsigned char output[20] );
00302
00303 #undef MBEDTLS_DEPRECATED
00304 #endif
00305
00316 int mbedtls_sha1_self_test( int verbose );
00317
00318 #ifdef __cplusplus
00319 }
00320 #endif
00321
00322 #endif