Mistake on this page?
Report an issue in GitHub or email us
TARGET_STM/sha1_alt.h
1 /**
2  * \file sha1.h
3  *
4  * \brief This file contains SHA-1 definitions and functions.
5  *
6  * The Secure Hash Algorithm 1 (SHA-1) cryptographic hash function is defined in
7  * <em>FIPS 180-4: Secure Hash Standard (SHS)</em>.
8  *
9  * \warning SHA-1 is considered a weak message digest and its use constitutes
10  * a security risk. We recommend considering stronger message
11  * digests instead.
12  */
13 /*
14  * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
15  * Copyright (C) 2019-2020, STMicroelectronics, All Rights Reserved
16  * SPDX-License-Identifier: Apache-2.0
17  *
18  * Licensed under the Apache License, Version 2.0 (the "License"); you may
19  * not use this file except in compliance with the License.
20  * You may obtain a copy of the License at
21  *
22  * http://www.apache.org/licenses/LICENSE-2.0
23  *
24  * Unless required by applicable law or agreed to in writing, software
25  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
26  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27  * See the License for the specific language governing permissions and
28  * limitations under the License.
29  *
30  * This file implements STMicroelectronics SHA1 API with HW services based
31  * on mbed TLS API
32  */
33 
34 #ifndef MBEDTLS_SHA1_ALT_H
35 #define MBEDTLS_SHA1_ALT_H
36 
37 #if defined (MBEDTLS_SHA1_ALT)
38 /* Includes ------------------------------------------------------------------*/
39 #include "hash_stm32.h"
40 
41 #define ST_SHA1_BLOCK_SIZE ((size_t) 64) /*!< HW handles 512 bits, ie 64 bytes */
42 #define ST_SHA1_NB_HASH_REG ((uint32_t)57) /*!< Number of HASH HW context Registers:
43  CR + STR + IMR + CSR[54] */
44 
45 /**
46  * \brief SHA-1 context structure
47  */
48 typedef struct mbedtls_sha1_context {
49  HASH_HandleTypeDef hhash; /*!< Handle of HASH HAL */
50  uint8_t sbuf[ST_SHA1_BLOCK_SIZE]; /*!< Buffer to store input data until ST_SHA1_BLOCK_SIZE
51  is reached, or until last input data is reached */
52  uint8_t sbuf_len; /*!< Number of bytes stored in sbuf */
53  uint32_t ctx_save_regs[ST_SHA1_NB_HASH_REG];
54 }
55 mbedtls_sha1_context;
56 
57 
58 #endif /* MBEDTLS_SHA1_ALT */
59 
60 #endif /* MBEDTLS_SHA1_ALT_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.