mbed TLS v2.7.6
sha512.h
Go to the documentation of this file.
1 
6 /*
7  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
8  * SPDX-License-Identifier: Apache-2.0
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
11  * not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  * This file is part of Mbed TLS (https://tls.mbed.org)
23  */
24 #ifndef MBEDTLS_SHA512_H
25 #define MBEDTLS_SHA512_H
26 
27 #if !defined(MBEDTLS_CONFIG_FILE)
28 #include "config.h"
29 #else
30 #include MBEDTLS_CONFIG_FILE
31 #endif
32 
33 #include <stddef.h>
34 #include <stdint.h>
35 
36 #define MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED -0x0039
38 #if !defined(MBEDTLS_SHA512_ALT)
39 // Regular implementation
40 //
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
53 typedef struct
54 {
55  uint64_t total[2];
56  uint64_t state[8];
57  unsigned char buffer[128];
58  int is384;
61 }
63 
70 
77 
85  const mbedtls_sha512_context *src );
86 
99 
111  const unsigned char *input,
112  size_t ilen );
113 
125  unsigned char output[64] );
126 
137  const unsigned char data[128] );
138 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
139 #if defined(MBEDTLS_DEPRECATED_WARNING)
140 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
141 #else
142 #define MBEDTLS_DEPRECATED
143 #endif
144 
156  int is384 );
157 
169  const unsigned char *input,
170  size_t ilen );
171 
182  unsigned char output[64] );
183 
196  const unsigned char data[128] );
197 
198 #undef MBEDTLS_DEPRECATED
199 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
200 
201 #ifdef __cplusplus
202 }
203 #endif
204 
205 #else /* MBEDTLS_SHA512_ALT */
206 #include "sha512_alt.h"
207 #endif /* MBEDTLS_SHA512_ALT */
208 
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212 
232 int mbedtls_sha512_ret( const unsigned char *input,
233  size_t ilen,
234  unsigned char output[64],
235  int is384 );
236 
237 #if !defined(MBEDTLS_DEPRECATED_REMOVED)
238 #if defined(MBEDTLS_DEPRECATED_WARNING)
239 #define MBEDTLS_DEPRECATED __attribute__((deprecated))
240 #else
241 #define MBEDTLS_DEPRECATED
242 #endif
243 
262 MBEDTLS_DEPRECATED void mbedtls_sha512( const unsigned char *input,
263  size_t ilen,
264  unsigned char output[64],
265  int is384 );
266 
267 #undef MBEDTLS_DEPRECATED
268 #endif /* !MBEDTLS_DEPRECATED_REMOVED */
269 
274 int mbedtls_sha512_self_test( int verbose );
275 
276 #ifdef __cplusplus
277 }
278 #endif
279 
280 #endif /* mbedtls_sha512.h */
#define MBEDTLS_DEPRECATED
Definition: sha512.h:241
void mbedtls_sha512_clone(mbedtls_sha512_context *dst, const mbedtls_sha512_context *src)
This function clones the state of a SHA-512 context.
void mbedtls_sha512_init(mbedtls_sha512_context *ctx)
This function initializes a SHA-512 context.
int mbedtls_sha512_finish_ret(mbedtls_sha512_context *ctx, unsigned char output[64])
This function finishes the SHA-512 operation, and writes the result to the output buffer...
MBEDTLS_DEPRECATED void mbedtls_sha512_update(mbedtls_sha512_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-512 checksum calculation. ...
MBEDTLS_DEPRECATED void mbedtls_sha512(const unsigned char *input, size_t ilen, unsigned char output[64], int is384)
This function calculates the SHA-512 or SHA-384 checksum of a buffer.
Configuration options (set of defines)
The SHA-512 context structure.
Definition: sha512.h:53
int mbedtls_sha512_starts_ret(mbedtls_sha512_context *ctx, int is384)
This function starts a SHA-384 or SHA-512 checksum calculation.
int mbedtls_sha512_self_test(int verbose)
The SHA-384 or SHA-512 checkup routine.
MBEDTLS_DEPRECATED void mbedtls_sha512_finish(mbedtls_sha512_context *ctx, unsigned char output[64])
This function finishes the SHA-512 operation, and writes the result to the output buffer...
int mbedtls_internal_sha512_process(mbedtls_sha512_context *ctx, const unsigned char data[128])
This function processes a single data block within the ongoing SHA-512 computation.
void mbedtls_sha512_free(mbedtls_sha512_context *ctx)
This function clears a SHA-512 context.
int mbedtls_sha512_ret(const unsigned char *input, size_t ilen, unsigned char output[64], int is384)
This function calculates the SHA-512 or SHA-384 checksum of a buffer.
MBEDTLS_DEPRECATED void mbedtls_sha512_starts(mbedtls_sha512_context *ctx, int is384)
This function starts a SHA-384 or SHA-512 checksum calculation.
int mbedtls_sha512_update_ret(mbedtls_sha512_context *ctx, const unsigned char *input, size_t ilen)
This function feeds an input buffer into an ongoing SHA-512 checksum calculation. ...
MBEDTLS_DEPRECATED void mbedtls_sha512_process(mbedtls_sha512_context *ctx, const unsigned char data[128])
This function processes a single data block within the ongoing SHA-512 computation. This function is for internal use only.