Skip to content

Commit c7d8fbc

Browse files
committed
Cleanup to address review comments
1 parent 8060a2f commit c7d8fbc

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

src/wp_ecdsa_sig.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,10 @@ static int wp_ecdsa_signverify_init(wp_EcdsaSigCtx *ctx, wp_Ecc* ecc,
185185
{
186186
int ok = 1;
187187

188-
if (ecc == NULL && ctx->ecc == NULL) {
188+
if (ctx == NULL || (ecc == NULL && ctx->ecc == NULL)) {
189189
ok = 0;
190190
}
191-
192-
if (ok && ecc != NULL) {
191+
else if (ecc != NULL) {
193192
if (!wp_ecc_up_ref(ecc)) {
194193
ok = 0;
195194
}

src/wp_ecx_sig.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,10 @@ static int wp_ecx_digest_signverify_init(wp_EcxSigCtx *ctx,
188188
ok = 0;
189189
}
190190

191-
if (ctx->ecx == NULL && ecx == NULL) {
191+
if (ok && (ctx == NULL || (ctx->ecx == NULL && ecx == NULL))) {
192192
ok = 0;
193193
}
194-
195-
if (ok && (ecx != NULL)) {
194+
else if (ok && ecx != NULL) {
196195
if (!wp_ecx_up_ref(ecx)) {
197196
ok = 0;
198197
}

src/wp_rsa_sig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ static int wp_rsa_signverify_init(wp_RsaSigCtx* ctx, wp_Rsa* rsa,
458458
if ((ctx == NULL) || (ctx->rsa == NULL && rsa == NULL)) {
459459
ok = 0;
460460
}
461-
if (ok && (rsa != NULL)) {
461+
else if (rsa != NULL) {
462462
if (!wp_rsa_up_ref(rsa)) {
463463
ok = 0;
464464
}

test/test_ecc.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,20 +2007,16 @@ int test_ec_import(void* data)
20072007

20082008
static int test_ec_null_sign_init_ex(OSSL_LIB_CTX *libCtx)
20092009
{
2010+
#ifndef WP_HAVE_EC_P256
2011+
(void)libCtx;
2012+
PRINT_MSG("Skipping test - WP_HAVE_EC_P256 not defined");
2013+
return 0;
2014+
#else
20102015
int err = 0;
20112016
EVP_MD_CTX *ctx = NULL;
20122017
EVP_MD *md = NULL;
20132018
EVP_PKEY *pkey = NULL;
2014-
#ifdef WP_HAVE_EC_P256
20152019
const unsigned char *p = ecc_key_der_256;
2016-
#endif
2017-
2018-
#ifndef WP_HAVE_EC_P256
2019-
(void)libCtx;
2020-
(void)provider_name;
2021-
PRINT_MSG("Skipping test - WP_HAVE_EC_P256 not defined");
2022-
return 0;
2023-
#endif
20242020

20252021
err = (ctx = EVP_MD_CTX_new()) == NULL;
20262022
if (err == 0) {
@@ -2043,6 +2039,7 @@ static int test_ec_null_sign_init_ex(OSSL_LIB_CTX *libCtx)
20432039
EVP_MD_CTX_free(ctx);
20442040

20452041
return err;
2042+
#endif
20462043
}
20472044

20482045
int test_ec_null_init(void* data)

0 commit comments

Comments
 (0)