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_SHA256_H
00050 #define MBEDTLS_SHA256_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_SHA256_HW_ACCEL_FAILED -0x0037
00063 #if !defined(MBEDTLS_SHA256_ALT)
00064
00065
00066
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070
00078 typedef struct
00079 {
00080 uint32_t total[2];
00081 uint32_t state[8];
00082 unsigned char buffer[64];
00083 int is224;
00086 }
00087 mbedtls_sha256_context;
00088
00094 void mbedtls_sha256_init( mbedtls_sha256_context *ctx );
00095
00101 void mbedtls_sha256_free( mbedtls_sha256_context *ctx );
00102
00109 void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
00110 const mbedtls_sha256_context *src );
00111
00123 int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 );
00124
00135 int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
00136 const unsigned char *input,
00137 size_t ilen );
00138
00148 int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
00149 unsigned char output[32] );
00150
00161 int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
00162 const unsigned char data[64] );
00163
00164 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00165 #if defined(MBEDTLS_DEPRECATED_WARNING)
00166 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00167 #else
00168 #define MBEDTLS_DEPRECATED
00169 #endif
00170
00180 MBEDTLS_DEPRECATED void mbedtls_sha256_starts( mbedtls_sha256_context *ctx,
00181 int is224 );
00182
00193 MBEDTLS_DEPRECATED void mbedtls_sha256_update( mbedtls_sha256_context *ctx,
00194 const unsigned char *input,
00195 size_t ilen );
00196
00206 MBEDTLS_DEPRECATED void mbedtls_sha256_finish( mbedtls_sha256_context *ctx,
00207 unsigned char output[32] );
00208
00219 MBEDTLS_DEPRECATED void mbedtls_sha256_process( mbedtls_sha256_context *ctx,
00220 const unsigned char data[64] );
00221
00222 #undef MBEDTLS_DEPRECATED
00223 #endif
00224 #ifdef __cplusplus
00225 }
00226 #endif
00227
00228 #else
00229 #include "sha256_alt.h"
00230 #endif
00231
00232 #ifdef __cplusplus
00233 extern "C" {
00234 #endif
00235
00253 int mbedtls_sha256_ret( const unsigned char *input,
00254 size_t ilen,
00255 unsigned char output[32],
00256 int is224 );
00257
00258 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
00259 #if defined(MBEDTLS_DEPRECATED_WARNING)
00260 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
00261 #else
00262 #define MBEDTLS_DEPRECATED
00263 #endif
00264
00284 MBEDTLS_DEPRECATED void mbedtls_sha256( const unsigned char *input,
00285 size_t ilen,
00286 unsigned char output[32],
00287 int is224 );
00288
00289 #undef MBEDTLS_DEPRECATED
00290 #endif
00291
00297 int mbedtls_sha256_self_test( int verbose );
00298
00299 #ifdef __cplusplus
00300 }
00301 #endif
00302
00303 #endif