Mbed TLS v2.28.9
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
19
20#if !defined(MBEDTLS_CONFIG_FILE)
21#include "mbedtls/config.h"
22#else
23#include MBEDTLS_CONFIG_FILE
24#endif
25
26#include <stddef.h>
27#include <stdint.h>
28
29/* MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED is deprecated and should not be used. */
31#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035
33#define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#if !defined(MBEDTLS_SHA1_ALT)
40// Regular implementation
41//
42
51typedef struct mbedtls_sha1_context {
52 uint32_t total[2];
53 uint32_t state[5];
54 unsigned char buffer[64];
55}
57
58#else /* MBEDTLS_SHA1_ALT */
59#include "sha1_alt.h"
60#endif /* MBEDTLS_SHA1_ALT */
61
74
89
102 const mbedtls_sha1_context *src);
103
118
137 const unsigned char *input,
138 size_t ilen);
139
157 unsigned char output[20]);
158
175 const unsigned char data[64]);
176
177#if !defined(MBEDTLS_DEPRECATED_REMOVED)
178#if defined(MBEDTLS_DEPRECATED_WARNING)
179#define MBEDTLS_DEPRECATED __attribute__((deprecated))
180#else
181#define MBEDTLS_DEPRECATED
182#endif
196
215 const unsigned char *input,
216 size_t ilen);
217
234 unsigned char output[20]);
235
251 const unsigned char data[64]);
252
253#undef MBEDTLS_DEPRECATED
254#endif /* !MBEDTLS_DEPRECATED_REMOVED */
255
279int mbedtls_sha1_ret(const unsigned char *input,
280 size_t ilen,
281 unsigned char output[20]);
282
283#if !defined(MBEDTLS_DEPRECATED_REMOVED)
284#if defined(MBEDTLS_DEPRECATED_WARNING)
285#define MBEDTLS_DEPRECATED __attribute__((deprecated))
286#else
287#define MBEDTLS_DEPRECATED
288#endif
311MBEDTLS_DEPRECATED void mbedtls_sha1(const unsigned char *input,
312 size_t ilen,
313 unsigned char output[20]);
314
315#undef MBEDTLS_DEPRECATED
316#endif /* !MBEDTLS_DEPRECATED_REMOVED */
317
318#if defined(MBEDTLS_SELF_TEST)
319
331int mbedtls_sha1_self_test(int verbose);
332
333#endif /* MBEDTLS_SELF_TEST */
334
335#ifdef __cplusplus
336}
337#endif
338
339#endif /* mbedtls_sha1.h */
Configuration options (set of defines)
MBEDTLS_DEPRECATED void 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.
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.
MBEDTLS_DEPRECATED void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
This function starts a SHA-1 checksum calculation.
MBEDTLS_DEPRECATED void mbedtls_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
SHA-1 process data block (internal use only).
int mbedtls_sha1_ret(const unsigned char *input, size_t ilen, unsigned char output[20])
This function calculates the SHA-1 checksum of a buffer.
int mbedtls_sha1_self_test(int verbose)
The SHA-1 checkup routine.
int mbedtls_sha1_update_ret(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_internal_sha1_process(mbedtls_sha1_context *ctx, const unsigned char data[64])
SHA-1 process data block (internal use only).
int mbedtls_sha1_starts_ret(mbedtls_sha1_context *ctx)
This function starts a SHA-1 checksum calculation.
MBEDTLS_DEPRECATED void 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.
#define MBEDTLS_DEPRECATED
Definition sha1.h:181
MBEDTLS_DEPRECATED void 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_ret(mbedtls_sha1_context *ctx, unsigned char output[20])
This function finishes the SHA-1 operation, and writes the result to the output buffer.
void mbedtls_sha1_init(mbedtls_sha1_context *ctx)
This function initializes a SHA-1 context.
The SHA-1 context structure.
Definition sha1.h:51
uint32_t total[2]
Definition sha1.h:52
unsigned char buffer[64]
Definition sha1.h:54
uint32_t state[5]
Definition sha1.h:53