Mistake on this page?
Report an issue in GitHub or email us
TARGET_M480/sha/sha1_alt_sw.h
1 /**
2  * \file sha1.h
3  *
4  * \brief SHA-1 cryptographic hash function
5  *
6  * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
7  * SPDX-License-Identifier: Apache-2.0
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License"); you may
10  * not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * This file is part of mbed TLS (https://tls.mbed.org)
22  */
23 #ifndef MBEDTLS_SHA1_ALT_SW_H
24 #define MBEDTLS_SHA1_ALT_SW_H
25 
26 #if defined(MBEDTLS_SHA1_ALT)
27 
28 #include <stddef.h>
29 #include <stdint.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /**
36  * \brief SHA-1 context structure
37  */
38 typedef struct {
39  uint32_t total[2]; /*!< number of bytes processed */
40  uint32_t state[5]; /*!< intermediate digest state */
41  unsigned char buffer[64]; /*!< data block being processed */
42 }
43 mbedtls_sha1_sw_context;
44 
45 /**
46  * \brief Initialize SHA-1 context
47  *
48  * \param ctx SHA-1 context to be initialized
49  */
50 void mbedtls_sha1_sw_init( mbedtls_sha1_sw_context *ctx );
51 
52 /**
53  * \brief Clear SHA-1 context
54  *
55  * \param ctx SHA-1 context to be cleared
56  */
57 void mbedtls_sha1_sw_free( mbedtls_sha1_sw_context *ctx );
58 
59 /**
60  * \brief Clone (the state of) a SHA-1 context
61  *
62  * \param dst The destination context
63  * \param src The context to be cloned
64  */
65 void mbedtls_sha1_sw_clone( mbedtls_sha1_sw_context *dst,
66  const mbedtls_sha1_sw_context *src );
67 
68 /**
69  * \brief SHA-1 context setup
70  *
71  * \param ctx context to be initialized
72  */
73 void mbedtls_sha1_sw_starts( mbedtls_sha1_sw_context *ctx );
74 
75 /**
76  * \brief SHA-1 process buffer
77  *
78  * \param ctx SHA-1 context
79  * \param input buffer holding the data
80  * \param ilen length of the input data
81  */
82 void mbedtls_sha1_sw_update( mbedtls_sha1_sw_context *ctx, const unsigned char *input, size_t ilen );
83 
84 /**
85  * \brief SHA-1 final digest
86  *
87  * \param ctx SHA-1 context
88  * \param output SHA-1 checksum result
89  */
90 void mbedtls_sha1_sw_finish( mbedtls_sha1_sw_context *ctx, unsigned char output[20] );
91 
92 /* Internal use */
93 void mbedtls_sha1_sw_process( mbedtls_sha1_sw_context *ctx, const unsigned char data[64] );
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* MBEDTLS_SHA1_ALT */
100 
101 #endif /* sha1_alt_sw.h */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.