GNU libmicrohttpd 1.0.2
Loading...
Searching...
No Matches
sha256_ext.h File Reference

Wrapper for SHA-256 calculation performed by TLS library. More...

#include "mhd_options.h"
#include <stdint.h>
Include dependency graph for sha256_ext.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Sha256CtxExt

Macros

#define SHA256_DIGEST_SIZE   (32)
#define MHD_SHA256_HAS_EXT_ERROR   1
#define MHD_SHA256_HAS_INIT_ONE_TIME   1
#define MHD_SHA256_HAS_FINISH_RESET   1
#define MHD_SHA256_HAS_DEINIT   1

Functions

void MHD_SHA256_init_one_time (struct Sha256CtxExt *ctx)
void MHD_SHA256_update (struct Sha256CtxExt *ctx, const uint8_t *data, size_t length)
void MHD_SHA256_finish_reset (struct Sha256CtxExt *ctx, uint8_t digest[SHA256_DIGEST_SIZE])
void MHD_SHA256_deinit (struct Sha256CtxExt *ctx)

Detailed Description

Wrapper for SHA-256 calculation performed by TLS library.

Wrapper declarations for SHA-256 calculation performed by TLS library.

Author
Karlson2k (Evgeny Grin)

Definition in file sha256_ext.h.

Macro Definition Documentation

◆ MHD_SHA256_HAS_DEINIT

#define MHD_SHA256_HAS_DEINIT   1

Indicates that MHD_SHA256_deinit() function is present

Definition at line 105 of file sha256_ext.h.

◆ MHD_SHA256_HAS_EXT_ERROR

#define MHD_SHA256_HAS_EXT_ERROR   1

Indicates that struct Sha256CtxExt has 'ext_error'

Definition at line 47 of file sha256_ext.h.

◆ MHD_SHA256_HAS_FINISH_RESET

#define MHD_SHA256_HAS_FINISH_RESET   1

Indicates that MHD_SHA256_finish_reset() function is available

Definition at line 90 of file sha256_ext.h.

◆ MHD_SHA256_HAS_INIT_ONE_TIME

#define MHD_SHA256_HAS_INIT_ONE_TIME   1

Indicates that MHD_SHA256_init_one_time() function is present.

Definition at line 61 of file sha256_ext.h.

◆ SHA256_DIGEST_SIZE

#define SHA256_DIGEST_SIZE   (32)

Size of SHA-256 resulting digest in bytes This is the final digest size, not intermediate hash.

Definition at line 39 of file sha256_ext.h.

Function Documentation

◆ MHD_SHA256_deinit()

void MHD_SHA256_deinit ( struct Sha256CtxExt * ctx)

Free allocated resources.

Parameters
ctxthe calculation context

Definition at line 97 of file sha256_ext.c.

References Sha256CtxExt::handle, and NULL.

◆ MHD_SHA256_finish_reset()

void MHD_SHA256_finish_reset ( struct Sha256CtxExt * ctx,
uint8_t digest[SHA256_DIGEST_SIZE] )

Finalise SHA-256 calculation, return digest, reset hash calculation.

Parameters
ctxthe calculation context
[out]digestset to the hash, must be SHA256_DIGEST_SIZE bytes

Definition at line 83 of file sha256_ext.c.

References Sha256CtxExt::ext_error, Sha256CtxExt::handle, and SHA256_DIGEST_SIZE.

◆ MHD_SHA256_init_one_time()

void MHD_SHA256_init_one_time ( struct Sha256CtxExt * ctx)

Initialise structure for SHA-256 calculation, allocate resources.

This function must not be called more than one time for ctx.

Parameters
ctxthe calculation context

Definition at line 39 of file sha256_ext.c.

References Sha256CtxExt::ext_error, Sha256CtxExt::handle, mhd_assert, and NULL.

◆ MHD_SHA256_update()

void MHD_SHA256_update ( struct Sha256CtxExt * ctx,
const uint8_t * data,
size_t length )

SHA-256 process portion of bytes.

Parameters
ctxthe calculation context
databytes to add to hash
lengthnumber of bytes in data

Process portion of bytes.

Parameters
ctxthe calculation context
databytes to add to hash
lengthnumber of bytes in data

Definition at line 67 of file sha256_ext.c.

References data, Sha256CtxExt::ext_error, and Sha256CtxExt::handle.