From b0782cb8f8ad6505e73e3f1b63e763850a0cdfa2 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 25 May 2021 14:55:22 -0700 Subject: [PATCH] Fix for improperly initialized `PKA_ECDSASignOutTypeDef` on STM32 PKA sign. --- wolfcrypt/src/asn.c | 2 +- wolfcrypt/src/ecc.c | 1 - wolfcrypt/src/port/st/stm32.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 2c892fc99..29c9c1e79 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -7706,7 +7706,7 @@ static int ConfirmSignature(SignatureCtx* sigCtx, } if ((ret = wc_DsaPublicKeyDecode(key, &idx, sigCtx->key.dsa, keySz)) != 0) { - WOLFSSL_MSG("ASN Key decode error RSA"); + WOLFSSL_MSG("ASN Key decode error DSA"); goto exit_cs; } if (sigSz != DSA_SIG_SIZE) { diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 9c40912fc..faad7d547 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -6797,7 +6797,6 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash, #endif /* !NO_ASN */ #if !defined(WOLFSSL_STM32_PKA) && !defined(WOLFSSL_PSOC6_CRYPTO) - static int wc_ecc_check_r_s_range(ecc_key* key, mp_int* r, mp_int* s) { int err; diff --git a/wolfcrypt/src/port/st/stm32.c b/wolfcrypt/src/port/st/stm32.c index c276a6f6f..a080b6ed8 100644 --- a/wolfcrypt/src/port/st/stm32.c +++ b/wolfcrypt/src/port/st/stm32.c @@ -825,7 +825,7 @@ int stm32_ecc_sign_hash_ex(const byte* hash, word32 hashlen, WC_RNG* rng, const uint8_t *prime, *coef, *gen_x, *gen_y, *order; const uint32_t *coef_sign; XMEMSET(&pka_ecc, 0x00, sizeof(PKA_ECDSASignInTypeDef)); - XMEMSET(&pka_ecc, 0x00, sizeof(PKA_ECDSASignOutTypeDef)); + XMEMSET(&pka_ecc_out, 0x00, sizeof(PKA_ECDSASignOutTypeDef)); if (r == NULL || s == NULL || hash == NULL || key == NULL) { return ECC_BAD_ARG_E;