00001
00006
00007
00008
00009
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 #ifndef MBEDTLS_SHA512_H
00050 #define MBEDTLS_SHA512_H
00051
00052 #if !defined(MBEDTLS_CONFIG_FILE)
00053 #include "config.h"
00054 #else
00055 #include MBEDTLS_CONFIG_FILE
00056 #endif
00057
00058 #include <stddef.h>
00059 #include <stdint.h>
00060
00061 #define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039
00063 #if !defined(MBEDTLS_SHA512_ALT)
00064
00065
00066
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070
00078 typedef struct
00079 {
00080 uint64_t total[2];
00081 uint64_t state[8];
00082 unsigned char buffer[128];
00083 int is384;
00086 }
00087 mbedtls_sha512_context;
00088
00094 void mbedtls_sha512_init( mbedtls_sha512_context *ctx );
00095
00101 void mbedtls_sha512_free( mbedtls_sha512_context *ctx );
00102
00109 void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
00110 const mbedtls_sha512_context *src );
00111
00123 int mbedtls_sha512_starts_ret( mbedtls_sha512_context *ctx, int is384 );
00124
00135 int mbedtls_sha512_update_ret( mbedtls_sha512_context *ctx,
00136 const unsigned char *input,
00137 size_t ilen );
00138
00149 int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
00150 unsigned char output[64] );
00151
00161 int mbedtls_internal_sha512_process( mbedtls_sha512_context *ctx,
00162 const unsigned char data[128] );
00163 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00164 #if defined(MBEDTLS_DEPRECATED_WARNING)
00165 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00166 #else
00167 #define MBEDTLS_DEPRECATED
00168 #endif
00169
00180 MBEDTLS_DEPRECATED void mbedtls_sha512_starts( mbedtls_sha512_context *ctx,
00181 int is384 );
00182
00193 MBEDTLS_DEPRECATED void mbedtls_sha512_update( mbedtls_sha512_context *ctx,
00194 const unsigned char *input,
00195 size_t ilen );
00196
00206 MBEDTLS_DEPRECATED void mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
00207 unsigned char output[64] );
00208
00219 MBEDTLS_DEPRECATED void mbedtls_sha512_process(
00220 mbedtls_sha512_context *ctx,
00221 const unsigned char data[128] );
00222
00223 #undef MBEDTLS_DEPRECATED
00224 #endif
00225
00226 #ifdef __cplusplus
00227 }
00228 #endif
00229
00230 #else
00231 #include "sha512_alt.h"
00232 #endif
00233
00234 #ifdef __cplusplus
00235 extern "C" {
00236 #endif
00237
00257 int mbedtls_sha512_ret( const unsigned char *input,
00258 size_t ilen,
00259 unsigned char output[64],
00260 int is384 );
00261
00262 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00263 #if defined(MBEDTLS_DEPRECATED_WARNING)
00264 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00265 #else
00266 #define MBEDTLS_DEPRECATED
00267 #endif
00268
00287 MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
00288 size_t ilen,
00289 unsigned char output[64],
00290 int is384 );
00291
00292 #undef MBEDTLS_DEPRECATED
00293 #endif
00294
00299 int mbedtls_sha512_self_test( int verbose );
00300
00301 #ifdef __cplusplus
00302 }
00303 #endif
00304
00305 #endif