]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
crypto: stm32_hash: fix issue when restarting computation
authorLionel Debieve <lionel.debieve@st.com>
Fri, 31 Jan 2020 15:17:37 +0000 (16:17 +0100)
committerYann Gautier <yann.gautier@st.com>
Thu, 24 Sep 2020 07:30:44 +0000 (09:30 +0200)
While restarting a new hash computation, STR register
is not cleared. It needs to be written before each
computation.

Change-Id: If65902dd21f9c139ec5da3ca87721232f73710db
Signed-off-by: Lionel Debieve <lionel.debieve@st.com>
Signed-off-by: Yann Gautier <yann.gautier@st.com>
drivers/st/crypto/stm32_hash.c

index 515947c103e05180b469afec7208fcc5d8cf7a78..317fd9eb88ff4babe8afcecf3d08fa7eb448917b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019, STMicroelectronics - All Rights Reserved
+ * Copyright (c) 2019-2020, STMicroelectronics - All Rights Reserved
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -252,6 +252,8 @@ int stm32_hash_final(uint8_t *digest)
                mmio_clrsetbits_32(hash_base() + HASH_STR, HASH_STR_NBLW_MASK,
                                   8U * stm32_remain.length);
                zeromem(&stm32_remain, sizeof(stm32_remain));
+       } else {
+               mmio_clrbits_32(hash_base() + HASH_STR, HASH_STR_NBLW_MASK);
        }
 
        mmio_setbits_32(hash_base() + HASH_STR, HASH_STR_DCAL);