Mistake on this page?
Report an issue in GitHub or email us
TARGET_NUC472/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 #include "mbedtls/sha256.h"
27 
28 #if defined(MBEDTLS_SHA1_ALT)
29 
30 #include <stddef.h>
31 #include <stdint.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /**
38  * \brief SHA-1 context structure
39  */
40 typedef struct {
41  uint32_t total[2]; /*!< number of bytes processed */
42  uint32_t state[5]; /*!< intermediate digest state */
43  unsigned char buffer[64]; /*!< data block being processed */
44 }
45 mbedtls_sha1_sw_context;
46 
47 /**
48  * \brief Initialize SHA-1 context
49  *
50  * \param ctx SHA-1 context to be initialized
51  */
52 void mbedtls_sha1_sw_init( mbedtls_sha1_sw_context *ctx );
53 
54 /**
55  * \brief Clear SHA-1 context
56  *
57  * \param ctx SHA-1 context to be cleared
58  */
59 void mbedtls_sha1_sw_free( mbedtls_sha1_sw_context *ctx );
60 
61 /**
62  * \brief Clone (the state of) a SHA-1 context
63  *
64  * \param dst The destination context
65  * \param src The context to be cloned
66  */
67 void mbedtls_sha1_sw_clone( mbedtls_sha1_sw_context *dst,
68  const mbedtls_sha1_sw_context *src );
69 
70 /**
71  * \brief SHA-1 context setup
72  *
73  * \param ctx context to be initialized
74  */
75 void mbedtls_sha1_sw_starts( mbedtls_sha1_sw_context *ctx );
76 
77 /**
78  * \brief SHA-1 process buffer
79  *
80  * \param ctx SHA-1 context
81  * \param input buffer holding the data
82  * \param ilen length of the input data
83  */
84 void mbedtls_sha1_sw_update( mbedtls_sha1_sw_context *ctx, const unsigned char *input, size_t ilen );
85 
86 /**
87  * \brief SHA-1 final digest
88  *
89  * \param ctx SHA-1 context
90  * \param output SHA-1 checksum result
91  */
92 void mbedtls_sha1_sw_finish( mbedtls_sha1_sw_context *ctx, unsigned char output[20] );
93 
94 /* Internal use */
95 void mbedtls_sha1_sw_process( mbedtls_sha1_sw_context *ctx, const unsigned char data[64] );
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* MBEDTLS_SHA1_ALT */
102 
103 #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.