mbed TLS v2.14.1
sha1.h
Go to the documentation of this file.
1 
13 /*
14  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
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  * This file is part of Mbed TLS (https://tls.mbed.org)
30  */
31 #ifndef MBEDTLS_SHA1_H
32 #define MBEDTLS_SHA1_H
33 
34 #if !defined(MBEDTLS_CONFIG_FILE)
35 #include "config.h"
36 #else
37 #include MBEDTLS_CONFIG_FILE
38 #endif
39 
40 #include <stddef.h>
41 #include <stdint.h>
42 
43 /* MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED is deprecated and should not be used. */
44 #define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 #if !defined(MBEDTLS_SHA1_ALT)
51 // Regular implementation
52 //
53 
62 typedef struct mbedtls_sha1_context
63 {
64  uint32_t total[2];
65  uint32_t state[5];
66  unsigned char buffer[64];
67 }
69 
70 #else /* MBEDTLS_SHA1_ALT */
71 #include "sha1_alt.h"
72 #endif /* MBEDTLS_SHA1_ALT */
73 
85 
97 
110  const mbedtls_sha1_context *src );
111 
125 
141  const unsigned char *input,
142  size_t ilen );
143 
158  unsigned char output[20] );
159 
174  const unsigned char data[64] );
175 
176 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
177 #if defined(MBEDTLS_DEPRECATED_WARNING)
178 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
179 #else
180 #define MBEDTLS_DEPRECATED
181 #endif
182 
195 
212  const unsigned char *input,
213  size_t ilen );
214 
230  unsigned char output[20] );
231 
246  const unsigned char data[64] );
247 
248 #undef MBEDTLS_DEPRECATED
249 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
250 
271 int mbedtls_sha1_ret( const unsigned char *input,
272  size_t ilen,
273  unsigned char output[20] );
274 
275 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
276 #if defined(MBEDTLS_DEPRECATED_WARNING)
277 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
278 #else
279 #define MBEDTLS_DEPRECATED
280 #endif
281 
301 MBEDTLS_DEPRECATED void mbedtls_sha1( const unsigned char *input,
302  size_t ilen,
303  unsigned char output[20] );
304 
305 #undef MBEDTLS_DEPRECATED
306 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
307 
319 int mbedtls_sha1_self_test( int verbose );
320 
321 #ifdef __cplusplus
322 }
323 #endif
324 
325 #endif /* mbedtls_sha1.h */
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.
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_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.
unsigned char buffer[64]
Definition: sha1.h:66
#define MBEDTLS_DEPRECATED
Definition: sha1.h:279
void mbedtls_sha1_init(mbedtls_sha1_context *ctx)
This function initializes a SHA-1 context.
Configuration options (set of defines)
uint32_t total[2]
Definition: sha1.h:64
MBEDTLS_DEPRECATED void mbedtls_sha1_starts(mbedtls_sha1_context *ctx)
This function starts a 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).
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.
uint32_t state[5]
Definition: sha1.h:65
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.
void mbedtls_sha1_free(mbedtls_sha1_context *ctx)
This function clears a SHA-1 context.
The SHA-1 context structure.
Definition: sha1.h:62
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.
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_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_starts_ret(mbedtls_sha1_context *ctx)
This function starts a SHA-1 checksum calculation.