From b4e0137d373c99088493e831b16d87d1d4d7db99 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Fri, 7 Oct 2022 14:49:05 -0500 Subject: [PATCH] Fix coverity issues --- wolfcrypt/src/asn.c | 2 +- wolfcrypt/src/ecc.c | 2 +- wolfcrypt/src/wc_port.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 169510a9f..6d8bf6e4f 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -12064,7 +12064,7 @@ static int GetHashId(const byte* id, int length, byte* hash) /* Id for jurisdiction country. */ #define ASN_JURIS_C 0x203 /* Id for jurisdiction state. */ -#define ASN_JURIS_ST 0x203 +#define ASN_JURIS_ST 0x202 /* Set the string for a name component into the subject name. */ #define SetCertNameSubject(cert, id, val) \ diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index a92190bf3..51a1d8651 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -10586,7 +10586,7 @@ static int wc_ecc_import_raw_private(ecc_key* key, const char* qx, WOLFSSL_MSG("Invalid Qx"); err = BAD_FUNC_ARG; } - if (mp_unsigned_bin_size(key->pubkey.y) > key->dp->size) { + if (mp_unsigned_bin_size(key->pubkey.x) > key->dp->size) { err = BAD_FUNC_ARG; } } diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index e3b10afbb..86669a399 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -2668,6 +2668,8 @@ time_t stm32_hal_time(time_t *t1) RTC_TimeTypeDef time; RTC_DateTypeDef date; + XMEMSET(tm_time, 0, sizeof(struct tm)); + /* order of GetTime followed by GetDate required here due to STM32 HW * requirement */ HAL_RTC_GetTime(&hrtc, &time, FORMAT_BIN);