Mistake on this page?
Report an issue in GitHub or email us
sha512_alt_sw.h
1 /**
2  * \file sha512.h
3  *
4  * \brief SHA-384 and SHA-512 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_SHA512_ALT_SW_H
24 #define MBEDTLS_SHA512_ALT_SW_H
25 
26 #if defined(MBEDTLS_SHA512_ALT)
27 
28 #include <stddef.h>
29 #include <stdint.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /**
36  * \brief SHA-512 context structure
37  */
38 typedef struct {
39  uint64_t total[2]; /*!< number of bytes processed */
40  uint64_t state[8]; /*!< intermediate digest state */
41  unsigned char buffer[128]; /*!< data block being processed */
42  int is384; /*!< 0 => SHA-512, else SHA-384 */
43 }
44 mbedtls_sha512_sw_context;
45 
46 /**
47  * \brief Initialize SHA-512 context
48  *
49  * \param ctx SHA-512 context to be initialized
50  */
51 void mbedtls_sha512_sw_init( mbedtls_sha512_sw_context *ctx );
52 
53 /**
54  * \brief Clear SHA-512 context
55  *
56  * \param ctx SHA-512 context to be cleared
57  */
58 void mbedtls_sha512_sw_free( mbedtls_sha512_sw_context *ctx );
59 
60 /**
61  * \brief Clone (the state of) a SHA-512 context
62  *
63  * \param dst The destination context
64  * \param src The context to be cloned
65  */
66 void mbedtls_sha512_sw_clone( mbedtls_sha512_sw_context *dst,
67  const mbedtls_sha512_sw_context *src );
68 
69 /**
70  * \brief SHA-512 context setup
71  *
72  * \param ctx context to be initialized
73  * \param is384 0 = use SHA512, 1 = use SHA384
74  */
75 void mbedtls_sha512_sw_starts( mbedtls_sha512_sw_context *ctx, int is384 );
76 
77 /**
78  * \brief SHA-512 process buffer
79  *
80  * \param ctx SHA-512 context
81  * \param input buffer holding the data
82  * \param ilen length of the input data
83  */
84 void mbedtls_sha512_sw_update( mbedtls_sha512_sw_context *ctx, const unsigned char *input,
85  size_t ilen );
86 
87 /**
88  * \brief SHA-512 final digest
89  *
90  * \param ctx SHA-512 context
91  * \param output SHA-384/512 checksum result
92  */
93 void mbedtls_sha512_sw_finish( mbedtls_sha512_sw_context *ctx, unsigned char output[64] );
94 
95 /* Internal use */
96 void mbedtls_sha512_sw_process( mbedtls_sha512_sw_context *ctx, const unsigned char data[128] );
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* MBEDTLS_SHA512_ALT */
103 
104 #endif /* sha512_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.