TuyaOS
include
components
base_security
include
tuya_sha256.h
1
27
#ifndef POLARSSL_SHA2_H
28
#define POLARSSL_SHA2_H
29
30
#include <string.h>
31
#include "mbedtls/sha256.h"
32
#define POLARSSL_SHA2_C 1
33
//#define POLARSSL_SELF_TEST 1
34
#define POLARSSL_ERR_SHA2_FILE_IO_ERROR -0x0078
35
#define SHA256TYPE 0
36
#define SHA244TYPE 1
40
typedef
struct
{
41
mbedtls_sha256_context mbedtls;
42
unsigned
char
ipad[64];
43
unsigned
char
opad[64];
45
}
46
sha2_context
;
47
48
#ifdef __cplusplus
49
extern
"C"
{
50
#endif
51
58
void
sha2_starts(
sha2_context
*ctx,
int
is224);
59
67
void
sha2_update(
sha2_context
*ctx,
const
unsigned
char
*input,
size_t
ilen);
68
75
void
sha2_finish(
sha2_context
*ctx,
unsigned
char
output[32]);
76
85
void
sha2(
const
unsigned
char
*input,
size_t
ilen,
86
unsigned
char
output[32],
int
is224);
87
97
int
sha2_file(
const
char
*path,
unsigned
char
output[32],
int
is224);
98
107
void
sha2_hmac_starts(
sha2_context
*ctx,
const
unsigned
char
*key,
size_t
keylen,
108
int
is224);
109
117
void
sha2_hmac_update(
sha2_context
*ctx,
const
unsigned
char
*input,
size_t
ilen);
118
125
void
sha2_hmac_finish(
sha2_context
*ctx,
unsigned
char
output[32]);
126
132
void
sha2_hmac_reset(
sha2_context
*ctx);
133
144
void
sha2_hmac(
const
unsigned
char
*key,
size_t
keylen,
145
const
unsigned
char
*input,
size_t
ilen,
146
unsigned
char
output[32],
int
is224);
147
153
int
sha2_self_test(
int
verbose);
154
155
#ifdef __cplusplus
156
}
157
#endif
158
159
#endif
/* sha2.h */
sha2_context
SHA-256 context structure
Definition:
tuya_sha256.h:40
制作者
1.9.4