Loading...
Searching...
No Matches
sha1.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_SHA1_H
#define MBEDTLS_SHA1_H
#include "mbedtls/private_access.h"
#include "mbedtls/build_info.h"
#include <stddef.h>
#include <stdint.h>
#define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(MBEDTLS_SHA1_ALT)
// Regular implementation
//
typedef struct mbedtls_sha1_context {
uint32_t MBEDTLS_PRIVATE(total)[2];
uint32_t MBEDTLS_PRIVATE(state)[5];
unsigned char MBEDTLS_PRIVATE(buffer)[64];
}
mbedtls_sha1_context;
#else /* MBEDTLS_SHA1_ALT */
#include "sha1_alt.h"
#endif /* MBEDTLS_SHA1_ALT */
void mbedtls_sha1_init(mbedtls_sha1_context *ctx);
void mbedtls_sha1_free(mbedtls_sha1_context *ctx);
void mbedtls_sha1_clone(mbedtls_sha1_context *dst,
const mbedtls_sha1_context *src);
int mbedtls_sha1_starts(mbedtls_sha1_context *ctx);
int mbedtls_sha1_update(mbedtls_sha1_context *ctx,
const unsigned char *input,
size_t ilen);
int mbedtls_sha1_finish(mbedtls_sha1_context *ctx,
unsigned char output[20]);
int mbedtls_internal_sha1_process(mbedtls_sha1_context *ctx,
const unsigned char data[64]);
int mbedtls_sha1(const unsigned char *input,
size_t ilen,
unsigned char output[20]);
#if defined(MBEDTLS_SELF_TEST)
int mbedtls_sha1_self_test(int verbose);
#endif /* MBEDTLS_SELF_TEST */
#ifdef __cplusplus
}
#endif
#endif /* mbedtls_sha1.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_sha1_free
void mbedtls_sha1_free(mbedtls_sha1_context *ctx)
This function clears a SHA-1 context.
mbedtls_sha1_clone
void mbedtls_sha1_clone(mbedtls_sha1_context *dst, const mbedtls_sha1_context *src)
This function clones the state of a SHA-1 context.
mbedtls_sha1_self_test
int mbedtls_sha1_self_test(int verbose)
The SHA-1 checkup routine.
mbedtls_internal_sha1_process
int mbedtls_internal_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
SHA-1 process data block (internal use only).
mbedtls_sha1_update
int mbedtls_sha1_update(mbedtls_sha1_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-1 checksum calculation.
mbedtls_sha1
int mbedtls_sha1(const unsigned char *input, size_t ilen, unsigned char output[20])
This function calculates the SHA-1 checksum of a buffer.
mbedtls_sha1_context
struct mbedtls_sha1_context mbedtls_sha1_context
The SHA-1 context structure.
mbedtls_sha1_finish
int mbedtls_sha1_finish(mbedtls_sha1_context *ctx, unsigned char output[20])
This function finishes the SHA-1 operation, and writes the result to the output buffer.
mbedtls_sha1_starts
int mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
This function starts a SHA-1 checksum calculation.
mbedtls_sha1_init
void mbedtls_sha1_init(mbedtls_sha1_context *ctx)
This function initializes a SHA-1 context.
sha1_alt.h
mbedtls_sha1_context
The SHA-1 context structure.
Definition sha1.h:45