mbed TLS v2.16.1
sha512.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
10  * SPDX-License-Identifier: GPL-2.0
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * This file is part of Mbed TLS (https://tls.mbed.org)
27  */
28 #ifndef MBEDTLS_SHA512_H
29 #define MBEDTLS_SHA512_H
30 
31 #if !defined(MBEDTLS_CONFIG_FILE)
32 #include "config.h"
33 #else
34 #include MBEDTLS_CONFIG_FILE
35 #endif
36 
37 #include <stddef.h>
38 #include <stdint.h>
39 
40 /* MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED is deprecated and should not be used. */
41 #define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039
42 #define MBEDTLS_ERR_SHA512_BAD_INPUT_DATA -0x0075
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 #if !defined(MBEDTLS_SHA512_ALT)
49 // Regular implementation
50 //
51 
59 typedef struct mbedtls_sha512_context
60 {
61  uint64_t total[2];
62  uint64_t state[8];
63  unsigned char buffer[128];
64  int is384;
66 }
68 
69 #else /* MBEDTLS_SHA512_ALT */
70 #include "sha512_alt.h"
71 #endif /* MBEDTLS_SHA512_ALT */
72 
80 
90 
98  const mbedtls_sha512_context *src );
99 
112 
127  const unsigned char *input,
128  size_t ilen );
129 
144  unsigned char output[64] );
145 
158  const unsigned char data[128] );
159 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
160 #if defined(MBEDTLS_DEPRECATED_WARNING)
161 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
162 #else
163 #define MBEDTLS_DEPRECATED
164 #endif
165 
176  int is384 );
177 
191  const unsigned char *input,
192  size_t ilen );
193 
206  unsigned char output[64] );
207 
221  const unsigned char data[128] );
222 
223 #undef MBEDTLS_DEPRECATED
224 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
225 
247 int mbedtls_sha512_ret( const unsigned char *input,
248  size_t ilen,
249  unsigned char output[64],
250  int is384 );
251 
252 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
253 #if defined(MBEDTLS_DEPRECATED_WARNING)
254 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
255 #else
256 #define MBEDTLS_DEPRECATED
257 #endif
258 
279 MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
280  size_t ilen,
281  unsigned char output[64],
282  int is384 );
283 
284 #undef MBEDTLS_DEPRECATED
285 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
286 
287 #if defined(MBEDTLS_SELF_TEST)
288 
295 int mbedtls_sha512_self_test( int verbose );
296 #endif /* MBEDTLS_SELF_TEST */
297 
298 #ifdef __cplusplus
299 }
300 #endif
301 
302 #endif /* mbedtls_sha512.h */