Mbed TLS v3.5.2
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
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
26extern "C" {
27#endif
28
29#if !defined(MBEDTLS_SHA256_ALT)
30// Regular implementation
31//
32
40typedef 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 int MBEDTLS_PRIVATE(is224);
46}
48
49#else /* MBEDTLS_SHA256_ALT */
50#include "sha256_alt.h"
51#endif /* MBEDTLS_SHA256_ALT */
52
59
68
76 const mbedtls_sha256_context *src);
77
94
109 const unsigned char *input,
110 size_t ilen);
111
126 unsigned char *output);
127
141 const unsigned char data[64]);
142
165int mbedtls_sha256(const unsigned char *input,
166 size_t ilen,
167 unsigned char *output,
168 int is224);
169
170#if defined(MBEDTLS_SELF_TEST)
171
172#if defined(MBEDTLS_SHA224_C)
180#endif /* MBEDTLS_SHA224_C */
181
182#if defined(MBEDTLS_SHA256_C)
190#endif /* MBEDTLS_SHA256_C */
191
192#endif /* MBEDTLS_SELF_TEST */
193
194#ifdef __cplusplus
195}
196#endif
197
198#endif /* mbedtls_sha256.h */
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
int mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
This function starts a SHA-224 or SHA-256 checksum calculation.
int mbedtls_sha224_self_test(int verbose)
The SHA-224 checkup routine.
void mbedtls_sha256_free(mbedtls_sha256_context *ctx)
This function clears a SHA-256 context.
void mbedtls_sha256_init(mbedtls_sha256_context *ctx)
This function initializes a SHA-256 context.
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....
void mbedtls_sha256_clone(mbedtls_sha256_context *dst, const mbedtls_sha256_context *src)
This function clones the state of a SHA-256 context.
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.
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.
int mbedtls_sha256_self_test(int verbose)
The SHA-256 checkup routine.
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.
The SHA-256 context structure.
Definition sha256.h:40