• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * \file sha512.h
3  * \brief This file contains SHA-384 and SHA-512 definitions and functions.
4  *
5  * The Secure Hash Algorithms 384 and 512 (SHA-384 and SHA-512) cryptographic
6  * hash functions are defined in <em>FIPS 180-4: Secure Hash Standard (SHS)</em>.
7  */
8 /*
9  *  Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
10  *  SPDX-License-Identifier: Apache-2.0
11  *
12  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
13  *  not use this file except in compliance with the License.
14  *  You may obtain a copy of the License at
15  *
16  *  http://www.apache.org/licenses/LICENSE-2.0
17  *
18  *  Unless required by applicable law or agreed to in writing, software
19  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
20  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  *  See the License for the specific language governing permissions and
22  *  limitations under the License.
23  *
24  *  This file is part of Mbed TLS (https://tls.mbed.org)
25  */
26 #ifndef MBEDTLS_SHA512_ALT_H
27 #define MBEDTLS_SHA512_ALT_H
28 
29 #if defined(MBEDTLS_SHA512_ALT)
30 /**
31  * \brief          The SHA-512 context structure.
32  *
33  *                 The structure is used both for SHA-384 and for SHA-512
34  *                 checksum calculations. The choice between these two is
35  *                 made in the call to mbedtls_sha512_starts_ret().
36  */
37 typedef struct mbedtls_sha512_context
38 {
39     uint64_t total[2];          /*!< The number of Bytes processed. */
40     uint64_t state[8];          /*!< The intermediate digest state. */
41     unsigned char buffer[128];  /*!< The data block being processed. */
42     int is384;                  /*!< Determines which function to use:
43                                      0: Use SHA-512, or 1: Use SHA-384. */
44 }
45 mbedtls_sha512_context;
46 
47 #endif /* MBEDTLS_SHA512_ALT */
48 
49 #endif /* mbedtls_sha512_alt.h */
50