Mbed TLS v3.6.7
Toggle main menu visibility
Loading...
Searching...
No Matches
sha256.h
Go to the documentation of this file.
1
9
/*
10
* Copyright The Mbed TLS Contributors
11
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12
*/
13
#ifndef MBEDTLS_SHA256_H
14
#define MBEDTLS_SHA256_H
15
#include "
mbedtls/private_access.h
"
16
17
#include "
mbedtls/build_info.h
"
18
19
#include <stddef.h>
20
#include <stdint.h>
21
23
#define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
#if !defined(MBEDTLS_SHA256_ALT)
30
// Regular implementation
31
//
32
40
typedef
struct
mbedtls_sha256_context
{
41
unsigned
char
MBEDTLS_PRIVATE
(buffer)[64];
42
uint32_t
MBEDTLS_PRIVATE
(total)[2];
43
uint32_t
MBEDTLS_PRIVATE
(state)[8];
44
#if defined(MBEDTLS_SHA224_C)
45
int
MBEDTLS_PRIVATE
(is224);
47
#endif
48
}
49
mbedtls_sha256_context
;
50
51
#else
/* MBEDTLS_SHA256_ALT */
52
#include "
sha256_alt.h
"
53
#endif
/* MBEDTLS_SHA256_ALT */
54
60
void
mbedtls_sha256_init
(
mbedtls_sha256_context
*ctx);
61
69
void
mbedtls_sha256_free
(
mbedtls_sha256_context
*ctx);
70
77
void
mbedtls_sha256_clone
(
mbedtls_sha256_context
*dst,
78
const
mbedtls_sha256_context
*src);
79
95
int
mbedtls_sha256_starts
(
mbedtls_sha256_context
*ctx,
int
is224);
96
110
int
mbedtls_sha256_update
(
mbedtls_sha256_context
*ctx,
111
const
unsigned
char
*input,
112
size_t
ilen);
113
127
int
mbedtls_sha256_finish
(
mbedtls_sha256_context
*ctx,
128
unsigned
char
*output);
129
142
int
mbedtls_internal_sha256_process
(
mbedtls_sha256_context
*ctx,
143
const
unsigned
char
data[64]);
144
167
int
mbedtls_sha256
(
const
unsigned
char
*input,
168
size_t
ilen,
169
unsigned
char
*output,
170
int
is224);
171
172
#if defined(MBEDTLS_SELF_TEST)
173
174
#if defined(MBEDTLS_SHA224_C)
181
int
mbedtls_sha224_self_test
(
int
verbose);
182
#endif
/* MBEDTLS_SHA224_C */
183
184
#if defined(MBEDTLS_SHA256_C)
191
int
mbedtls_sha256_self_test
(
int
verbose);
192
#endif
/* MBEDTLS_SHA256_C */
193
194
#endif
/* MBEDTLS_SELF_TEST */
195
196
#ifdef __cplusplus
197
}
198
#endif
199
200
#endif
/* mbedtls_sha256.h */
build_info.h
Build-time configuration info.
private_access.h
Macro wrapper for struct's members.
MBEDTLS_PRIVATE
#define MBEDTLS_PRIVATE(member)
Definition
private_access.h:15
mbedtls_sha256_starts
int mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
This function starts a SHA-224 or SHA-256 checksum calculation.
mbedtls_sha224_self_test
int mbedtls_sha224_self_test(int verbose)
The SHA-224 checkup routine.
mbedtls_sha256_free
void mbedtls_sha256_free(mbedtls_sha256_context *ctx)
This function clears a SHA-256 context.
mbedtls_sha256_init
void mbedtls_sha256_init(mbedtls_sha256_context *ctx)
This function initializes a SHA-256 context.
mbedtls_internal_sha256_process
int mbedtls_internal_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
This function processes a single data block within the ongoing SHA-256 computation....
mbedtls_sha256_clone
void mbedtls_sha256_clone(mbedtls_sha256_context *dst, const mbedtls_sha256_context *src)
This function clones the state of a SHA-256 context.
mbedtls_sha256_finish
int mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char *output)
This function finishes the SHA-256 operation, and writes the result to the output buffer.
mbedtls_sha256_update
int mbedtls_sha256_update(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-256 checksum calculation.
mbedtls_sha256_self_test
int mbedtls_sha256_self_test(int verbose)
The SHA-256 checkup routine.
mbedtls_sha256
int mbedtls_sha256(const unsigned char *input, size_t ilen, unsigned char *output, int is224)
This function calculates the SHA-224 or SHA-256 checksum of a buffer.
sha256_alt.h
mbedtls_sha256_context
The SHA-256 context structure.
Definition
sha256.h:40
include
mbedtls
sha256.h
Generated on
for Mbed TLS v3.6.7 by
1.17.0