00001 00023 #ifndef MBEDTLS_SHA512_H 00024 #define MBEDTLS_SHA512_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_SHA512_ALT) 00036 // Regular implementation 00037 // 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00046 typedef struct 00047 { 00048 uint64_t total[2]; 00049 uint64_t state[8]; 00050 unsigned char buffer[128]; 00051 int is384; 00052 } 00053 mbedtls_sha512_context; 00054 00060 void mbedtls_sha512_init( mbedtls_sha512_context *ctx ); 00061 00067 void mbedtls_sha512_free( mbedtls_sha512_context *ctx ); 00068 00075 void mbedtls_sha512_clone( mbedtls_sha512_context *dst, 00076 const mbedtls_sha512_context *src ); 00077 00084 void mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 ); 00085 00093 void mbedtls_sha512_update( mbedtls_sha512_context *ctx, const unsigned char *input, 00094 size_t ilen ); 00095 00102 void mbedtls_sha512_finish( mbedtls_sha512_context *ctx, unsigned char output[64] ); 00103 00104 #ifdef __cplusplus 00105 } 00106 #endif 00107 00108 #else /* MBEDTLS_SHA512_ALT */ 00109 #include "sha512_alt.h" 00110 #endif /* MBEDTLS_SHA512_ALT */ 00111 00112 #ifdef __cplusplus 00113 extern "C" { 00114 #endif 00115 00124 void mbedtls_sha512( const unsigned char *input, size_t ilen, 00125 unsigned char output[64], int is384 ); 00126 00132 int mbedtls_sha512_self_test( int verbose ); 00133 00134 /* Internal use */ 00135 void mbedtls_sha512_process( mbedtls_sha512_context *ctx, const unsigned char data[128] ); 00136 00137 #ifdef __cplusplus 00138 } 00139 #endif 00140 00141 #endif /* mbedtls_sha512.h */