Skip to content

Commit 0243435

Browse files
ccli8adbridge
authored andcommitted
Remove duplicate configuration of CRPT->SHA_CTL/CRPT->HMAC_CTL in SHA alter.
1 parent 1fea286 commit 0243435

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

features/mbedtls/targets/TARGET_NUVOTON/TARGET_M480/sha/sha_alt_hw.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void mbedtls_sha256_hw_starts( crypto_sha_context *ctx, int is224)
156156

157157
SHA_Open(is224 ? SHA_MODE_SHA224 : SHA_MODE_SHA256, SHA_NO_SWAP, 0);
158158

159-
// Ensure we have correct initial inernal states in SHA_DGST registers even though SHA H/W is not actually started.
159+
// Ensure we have correct initial internal states in SHA_DGST registers even though SHA H/W is not actually started.
160160
CRPT->HMAC_CTL |= CRPT_HMAC_CTL_START_Msk;
161161

162162
return;
@@ -237,7 +237,7 @@ void mbedtls_sha512_hw_starts( crypto_sha_context *ctx, int is384)
237237

238238
SHA_Open(is384 ? SHA_MODE_SHA384 : SHA_MODE_SHA512, SHA_NO_SWAP, 0);
239239

240-
// Ensure we have correct initial inernal states in SHA_DGST registers even though SHA H/W is not actually started.
240+
// Ensure we have correct initial internal states in SHA_DGST registers even though SHA H/W is not actually started.
241241
CRPT->HMAC_CTL |= CRPT_HMAC_CTL_START_Msk;
242242

243243
return;
@@ -325,8 +325,6 @@ void crypto_sha_update_nobuf(crypto_sha_context *ctx, const unsigned char *input
325325
uint32_t DGSTs[16] = { 0 };
326326

327327
while (rmn > 0) {
328-
CRPT->HMAC_CTL = sha_ctl_start;
329-
330328
uint32_t data = nu_get32_be(in_pos);
331329
if (rmn <= 4) { // Last word of a (in)complete block
332330
if (islast) {

features/mbedtls/targets/TARGET_NUVOTON/TARGET_NUC472/sha/sha_alt_hw.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void mbedtls_sha1_hw_starts(crypto_sha_context *ctx)
7676

7777
SHA_Open(SHA_MODE_SHA1, SHA_NO_SWAP);
7878

79-
// Ensure we have correct initial inernal states in SHA_DGST registers even though SHA H/W is not actually started.
79+
// Ensure we have correct initial internal states in SHA_DGST registers even though SHA H/W is not actually started.
8080
CRPT->SHA_CTL |= CRPT_SHA_CTL_START_Msk;
8181

8282
return;
@@ -156,7 +156,7 @@ void mbedtls_sha256_hw_starts( crypto_sha_context *ctx, int is224)
156156

157157
SHA_Open(is224 ? SHA_MODE_SHA224 : SHA_MODE_SHA256, SHA_NO_SWAP);
158158

159-
// Ensure we have correct initial inernal states in SHA_DGST registers even though SHA H/W is not actually started.
159+
// Ensure we have correct initial internal states in SHA_DGST registers even though SHA H/W is not actually started.
160160
CRPT->SHA_CTL |= CRPT_SHA_CTL_START_Msk;
161161

162162
return;
@@ -244,8 +244,6 @@ void crypto_sha_update_nobuf(crypto_sha_context *ctx, const unsigned char *input
244244
uint32_t DGSTs[8] = { 0 };
245245

246246
while (rmn > 0) {
247-
CRPT->SHA_CTL = sha_ctl_start;
248-
249247
uint32_t data = nu_get32_be(in_pos);
250248
if (rmn <= 4) { // Last word of a (in)complete block
251249
if (islast) {

0 commit comments

Comments
 (0)