mbed TLS v3.3.0
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
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
58{
59 uint32_t MBEDTLS_PRIVATE(total)[2];
60 uint32_t MBEDTLS_PRIVATE(state)[5];
61 unsigned char MBEDTLS_PRIVATE(buffer)[64];
62}
64
65#else /* MBEDTLS_SHA1_ALT */
66#include "sha1_alt.h"
67#endif /* MBEDTLS_SHA1_ALT */
68
81
96
109 const mbedtls_sha1_context *src );
110
125
144 const unsigned char *input,
145 size_t ilen );
146
164 unsigned char output[20] );
165
182 const unsigned char data[64] );
183
207int mbedtls_sha1( const unsigned char *input,
208 size_t ilen,
209 unsigned char output[20] );
210
211#if defined(MBEDTLS_SELF_TEST)
212
224int mbedtls_sha1_self_test( int verbose );
225
226#endif /* MBEDTLS_SELF_TEST */
227
228#ifdef __cplusplus
229}
230#endif
231
232#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.
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:58