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
00050
00051 #ifndef MBEDTLS_SHA256_H
00052 #define MBEDTLS_SHA256_H
00053
00054 #if !defined(MBEDTLS_CONFIG_FILE)
00055 #include "config.h"
00056 #else
00057 #include MBEDTLS_CONFIG_FILE
00058 #endif
00059
00060 #include <stddef.h>
00061 #include <stdint.h>
00062
00063 #define MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED -0x0037
00065 #if !defined(MBEDTLS_SHA256_ALT)
00066
00067
00068
00069 #ifdef __cplusplus
00070 extern "C" {
00071 #endif
00072
00080 typedef struct
00081 {
00082 uint32_t total[2];
00083 uint32_t state[8];
00084 unsigned char buffer[64];
00085 int is224;
00088 }
00089 mbedtls_sha256_context;
00090
00096 void mbedtls_sha256_init( mbedtls_sha256_context *ctx );
00097
00103 void mbedtls_sha256_free( mbedtls_sha256_context *ctx );
00104
00111 void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
00112 const mbedtls_sha256_context *src );
00113
00125 int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
00126
00137 int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
00138 const unsigned char *input,
00139 size_t ilen );
00140
00150 int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
00151 unsigned char output[32] );
00152
00163 int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
00164 const unsigned char data[64] );
00165
00166 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00167 #if defined(MBEDTLS_DEPRECATED_WARNING)
00168 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00169 #else
00170 #define MBEDTLS_DEPRECATED
00171 #endif
00172
00182 MBEDTLS_DEPRECATED void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
00183 int is224 );
00184
00195 MBEDTLS_DEPRECATED void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
00196 const unsigned char *input,
00197 size_t ilen );
00198
00208 MBEDTLS_DEPRECATED void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
00209 unsigned char output[32] );
00210
00221 MBEDTLS_DEPRECATED void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
00222 const unsigned char data[64] );
00223
00224 #undef MBEDTLS_DEPRECATED
00225 #endif
00226 #ifdef __cplusplus
00227 }
00228 #endif
00229
00230 #else
00231 #include "sha256_alt.h"
00232 #endif
00233
00234 #ifdef __cplusplus
00235 extern "C" {
00236 #endif
00237
00255 int mbedtls_sha256_ret( const unsigned char *input,
00256 size_t ilen,
00257 unsigned char output[32],
00258 int is224 );
00259
00260 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00261 #if defined(MBEDTLS_DEPRECATED_WARNING)
00262 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00263 #else
00264 #define MBEDTLS_DEPRECATED
00265 #endif
00266
00286 MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
00287 size_t ilen,
00288 unsigned char output[32],
00289 int is224 );
00290
00291 #undef MBEDTLS_DEPRECATED
00292 #endif
00293
00299 int mbedtls_sha256_self_test( int verbose );
00300
00301 #ifdef __cplusplus
00302 }
00303 #endif
00304
00305 #endif