00001 00023 #ifndef MBEDTLS_SHA1_H 00024 #define MBEDTLS_SHA1_H 00025 00026 #if !defined(MBEDTLS_CONFIG_FILE) 00027 #include "config.h" 00028 #else 00029 #include MBEDTLS_CONFIG_FILE 00030 #endif 00031 00032 #include <stddef.h> 00033 #include <stdint.h> 00034 00035 #if !defined(MBEDTLS_SHA1_ALT) 00036 // Regular implementation 00037 // 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00046 typedef struct 00047 { 00048 uint32_t total[2]; 00049 uint32_t state[5]; 00050 unsigned char buffer[64]; 00051 } 00052 mbedtls_sha1_context; 00053 00059 void mbedtls_sha1_init( mbedtls_sha1_context *ctx ); 00060 00066 void mbedtls_sha1_free( mbedtls_sha1_context *ctx ); 00067 00074 void mbedtls_sha1_clone( mbedtls_sha1_context *dst, 00075 const mbedtls_sha1_context *src ); 00076 00082 void mbedtls_sha1_starts( mbedtls_sha1_context *ctx ); 00083 00091 void mbedtls_sha1_update( mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen ); 00092 00099 void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] ); 00100 00101 /* Internal use */ 00102 void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[64] ); 00103 00104 #ifdef __cplusplus 00105 } 00106 #endif 00107 00108 #else /* MBEDTLS_SHA1_ALT */ 00109 #include "sha1_alt.h" 00110 #endif /* MBEDTLS_SHA1_ALT */ 00111 00112 #ifdef __cplusplus 00113 extern "C" { 00114 #endif 00115 00123 void mbedtls_sha1( const unsigned char *input, size_t ilen, unsigned char output[20] ); 00124 00130 int mbedtls_sha1_self_test( int verbose ); 00131 00132 #ifdef __cplusplus 00133 } 00134 #endif 00135 00136 #endif /* mbedtls_sha1.h */