00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MBEDTLS_SHA512_H
00025 #define MBEDTLS_SHA512_H
00026
00027 #if !defined(MBEDTLS_CONFIG_FILE)
00028 #include "config.h"
00029 #else
00030 #include MBEDTLS_CONFIG_FILE
00031 #endif
00032
00033 #include <stddef.h>
00034 #include <stdint.h>
00035
00036 #define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039
00038 #if !defined(MBEDTLS_SHA512_ALT)
00039
00040
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00053 typedef struct
00054 {
00055 uint64_t total[2];
00056 uint64_t state[8];
00057 unsigned char buffer[128];
00058 int is384;
00061 }
00062 mbedtls_sha512_context;
00063
00069 void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
00070
00076 void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
00077
00084 void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
00085 const mbedtls_sha512_context *src );
00086
00098 int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 );
00099
00110 int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx,
00111 const unsigned char *input,
00112 size_t ilen );
00113
00124 int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
00125 unsigned char output[64] );
00126
00136 int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
00137 const unsigned char data[128] );
00138 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00139 #if defined(MBEDTLS_DEPRECATED_WARNING)
00140 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00141 #else
00142 #define MBEDTLS_DEPRECATED
00143 #endif
00144
00155 MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
00156 int is384 );
00157
00168 MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
00169 const unsigned char *input,
00170 size_t ilen );
00171
00181 MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
00182 unsigned char output[64] );
00183
00194 MBEDTLS_DEPRECATED void mbedtls_sha512_process(
00195 mbedtls_sha512_context *ctx,
00196 const unsigned char data[128] );
00197
00198 #undef MBEDTLS_DEPRECATED
00199 #endif
00200
00201 #ifdef __cplusplus
00202 }
00203 #endif
00204
00205 #else
00206 #include "sha512_alt.h"
00207 #endif
00208
00209 #ifdef __cplusplus
00210 extern "C" {
00211 #endif
00212
00232 int mbedtls_sha512_ret( const unsigned char *input,
00233 size_t ilen,
00234 unsigned char output[64],
00235 int is384 );
00236
00237 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00238 #if defined(MBEDTLS_DEPRECATED_WARNING)
00239 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00240 #else
00241 #define MBEDTLS_DEPRECATED
00242 #endif
00243
00262 MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
00263 size_t ilen,
00264 unsigned char output[64],
00265 int is384 );
00266
00267 #undef MBEDTLS_DEPRECATED
00268 #endif
00269
00274 int mbedtls_sha512_self_test( int verbose );
00275
00276 #ifdef __cplusplus
00277 }
00278 #endif
00279
00280 #endif