Loading...
Searching...
No Matches
sha256.h
Go to the documentation of this file.
/*
* Copyright The Mbed TLS Contributors
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SHA256_H
#define MBEDTLS_SHA256_H
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include <stddef.h>
#include <stdint.h>
#define MBEDTLS_ERR_SHA256_BAD_INPUT_DATA -0x0074
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(MBEDTLS_SHA256_ALT)
// Regular implementation
//
typedef struct mbedtls_sha256_context {
unsigned char MBEDTLS_PRIVATE(buffer)[64];
uint32_t MBEDTLS_PRIVATE(total)[2];
uint32_t MBEDTLS_PRIVATE(state)[8];
#if defined(MBEDTLS_SHA224_C)
int MBEDTLS_PRIVATE(is224);
#endif
}
mbedtls_sha256_context;
#else /* MBEDTLS_SHA256_ALT */
#include "sha256_alt.h"
#endif /* MBEDTLS_SHA256_ALT */
void mbedtls_sha256_init(mbedtls_sha256_context *ctx);
void mbedtls_sha256_free(mbedtls_sha256_context *ctx);
void mbedtls_sha256_clone(mbedtls_sha256_context *dst,
const mbedtls_sha256_context *src);
int mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224);
int mbedtls_sha256_update(mbedtls_sha256_context *ctx,
const unsigned char *input,
size_t ilen);
int mbedtls_sha256_finish(mbedtls_sha256_context *ctx,
unsigned char *output);
int mbedtls_internal_sha256_process(mbedtls_sha256_context *ctx,
const unsigned char data[64]);
int mbedtls_sha256(const unsigned char *input,
size_t ilen,
unsigned char *output,
int is224);
#if defined(MBEDTLS_SELF_TEST)
#if defined(MBEDTLS_SHA224_C)
int mbedtls_sha224_self_test(int verbose);
#endif /* MBEDTLS_SHA224_C */
#if defined(MBEDTLS_SHA256_C)
int mbedtls_sha256_self_test(int verbose);
#endif /* MBEDTLS_SHA256_C */
#endif /* MBEDTLS_SELF_TEST */
#ifdef __cplusplus
}
#endif
#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_context
struct mbedtls_sha256_context mbedtls_sha256_context
The SHA-256 context structure.
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