Mbed TLS v3.6.2
Loading...
Searching...
No Matches
sha1.h
Go to the documentation of this file.
1
13/*
14 * Copyright The Mbed TLS Contributors
15 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
16 */
17#ifndef MBEDTLS_SHA1_H
18#define MBEDTLS_SHA1_H
20
21#include "mbedtls/build_info.h"
22
23#include <stddef.h>
24#include <stdint.h>
25
27#define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#if !defined(MBEDTLS_SHA1_ALT)
34// Regular implementation
35//
36
45typedef struct mbedtls_sha1_context {
46 uint32_t MBEDTLS_PRIVATE(total)[2];
47 uint32_t MBEDTLS_PRIVATE(state)[5];
48 unsigned char MBEDTLS_PRIVATE(buffer)[64];
49}
51
52#else /* MBEDTLS_SHA1_ALT */
53#include "sha1_alt.h"
54#endif /* MBEDTLS_SHA1_ALT */
55
68
83
96 const mbedtls_sha1_context *src);
97
112
131 const unsigned char *input,
132 size_t ilen);
133
151 unsigned char output[20]);
152
169 const unsigned char data[64]);
170
194int mbedtls_sha1(const unsigned char *input,
195 size_t ilen,
196 unsigned char output[20]);
197
198#if defined(MBEDTLS_SELF_TEST)
199
211int mbedtls_sha1_self_test(int verbose);
212
213#endif /* MBEDTLS_SELF_TEST */
214
215#ifdef __cplusplus
216}
217#endif
218
219#endif /* mbedtls_sha1.h */
Build-time configuration info.
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
void mbedtls_sha1_free(mbedtls_sha1_context *ctx)
This function clears a SHA-1 context.
void mbedtls_sha1_clone(mbedtls_sha1_context *dst, const mbedtls_sha1_context *src)
This function clones the state of a SHA-1 context.
int mbedtls_sha1_self_test(int verbose)
The SHA-1 checkup routine.
int mbedtls_internal_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
SHA-1 process data block (internal use only).
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.
int mbedtls_sha1(const unsigned char *input, size_t ilen, unsigned char output[20])
This function calculates the SHA-1 checksum of a buffer.
struct mbedtls_sha1_context mbedtls_sha1_context
The SHA-1 context structure.
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.
int mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
This function starts a SHA-1 checksum calculation.
void mbedtls_sha1_init(mbedtls_sha1_context *ctx)
This function initializes a SHA-1 context.
The SHA-1 context structure.
Definition sha1.h:45