Skip to content

Commit 1bdac65

Browse files
author
Andras Fekete
committed
Defensive coding: use the value that is stored in the structure
1 parent 695bcab commit 1bdac65

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/wp_rsa_sig.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ static int wp_rsa_signverify_init(wp_RsaSigCtx* ctx, wp_Rsa* rsa,
436436
if (ok) {
437437
ctx->saltLen = RSA_PSS_SALTLEN_AUTO;
438438

439-
if (wp_rsa_get_type(rsa) == RSA_FLAG_TYPE_RSA) {
439+
if (wp_rsa_get_type(ctx->rsa) == RSA_FLAG_TYPE_RSA) {
440440
ctx->padMode = RSA_PKCS1_PADDING;
441441
}
442442
else {
443443
char* mdName;
444444
char* mgfMdName;
445445
ctx->padMode = RSA_PKCS1_PSS_PADDING;
446-
wp_rsa_get_pss_mds(rsa, &mdName, &mgfMdName);
446+
wp_rsa_get_pss_mds(ctx->rsa, &mdName, &mgfMdName);
447447
if ((mdName == NULL) || (mdName[0] == '\0')) {
448448
mdName = (char*)WP_RSA_DEFAULT_MD;
449449
}
@@ -457,7 +457,7 @@ static int wp_rsa_signverify_init(wp_RsaSigCtx* ctx, wp_Rsa* rsa,
457457
ok = 0;
458458
}
459459
if (ok) {
460-
ctx->minSaltLen = wp_rsa_get_pss_salt_len(rsa);
460+
ctx->minSaltLen = wp_rsa_get_pss_salt_len(ctx->rsa);
461461
if (ok && !wp_rsa_check_pss_salt_len(ctx)) {
462462
ok = 0;
463463
}

0 commit comments

Comments
 (0)