Mbed TLS v3.5.0
sha1.h
Go to the documentation of this file.
1
13/*
14 * Copyright The Mbed TLS Contributors
15 * SPDX-License-Identifier: Apache-2.0
16 *
17 * Licensed under the Apache License, Version 2.0 (the "License"); you may
18 * not use this file except in compliance with the License.
19 * You may obtain a copy of the License at
20 *
21 * http://www.apache.org/licenses/LICENSE-2.0
22 *
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
25 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
28 */
29#ifndef MBEDTLS_SHA1_H
30#define MBEDTLS_SHA1_H
32
33#include "mbedtls/build_info.h"
34
35#include <stddef.h>
36#include <stdint.h>
37
39#define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#if !defined(MBEDTLS_SHA1_ALT)
46// Regular implementation
47//
48
57typedef struct mbedtls_sha1_context {
58 uint32_t MBEDTLS_PRIVATE(total)[2];
59 uint32_t MBEDTLS_PRIVATE(state)[5];
60 unsigned char MBEDTLS_PRIVATE(buffer)[64];
61}
63
64#else /* MBEDTLS_SHA1_ALT */
65#include "sha1_alt.h"
66#endif /* MBEDTLS_SHA1_ALT */
67
80
95
108 const mbedtls_sha1_context *src);
109
124
143 const unsigned char *input,
144 size_t ilen);
145
163 unsigned char output[20]);
164
181 const unsigned char data[64]);
182
206int mbedtls_sha1(const unsigned char *input,
207 size_t ilen,
208 unsigned char output[20]);
209
210#if defined(MBEDTLS_SELF_TEST)
211
223int mbedtls_sha1_self_test(int verbose);
224
225#endif /* MBEDTLS_SELF_TEST */
226
227#ifdef __cplusplus
228}
229#endif
230
231#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:57