From 0ed18cf1c50e6c6067e10eb7cdea0c2d008bb2db Mon Sep 17 00:00:00 2001 From: tb <> Date: Fri, 17 Jan 2025 15:39:19 +0000 Subject: rsa_pmeth: unify strcmp return checks ok jsing --- src/lib/libcrypto/rsa/rsa_pmeth.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index b4e0448ef2..453570cf74 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pmeth.c,v 1.42 2025/01/17 08:50:07 tb Exp $ */ +/* $OpenBSD: rsa_pmeth.c,v 1.43 2025/01/17 15:39:19 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -637,19 +637,17 @@ pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) RSAerror(RSA_R_VALUE_MISSING); return 0; } - if (!strcmp(type, "rsa_padding_mode")) { + if (strcmp(type, "rsa_padding_mode") == 0) { int pm; - if (!strcmp(value, "pkcs1")) + if (strcmp(value, "pkcs1") == 0) pm = RSA_PKCS1_PADDING; - else if (!strcmp(value, "none")) + else if (strcmp(value, "none") == 0) pm = RSA_NO_PADDING; - else if (!strcmp(value, "oeap")) + else if (strcmp(value, "oaep") == 0 || strcmp(value, "oeap") == 0) pm = RSA_PKCS1_OAEP_PADDING; - else if (!strcmp(value, "oaep")) - pm = RSA_PKCS1_OAEP_PADDING; - else if (!strcmp(value, "x931")) + else if (strcmp(value, "x931") == 0) pm = RSA_X931_PADDING; - else if (!strcmp(value, "pss")) + else if (strcmp(value, "pss") == 0) pm = RSA_PKCS1_PSS_PADDING; else { RSAerror(RSA_R_UNKNOWN_PADDING_TYPE); @@ -661,11 +659,11 @@ pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) if (strcmp(type, "rsa_pss_saltlen") == 0) { int saltlen; - if (!strcmp(value, "digest")) + if (strcmp(value, "digest") == 0) saltlen = RSA_PSS_SALTLEN_DIGEST; - else if (!strcmp(value, "max")) + else if (strcmp(value, "max") == 0) saltlen = RSA_PSS_SALTLEN_MAX; - else if (!strcmp(value, "auto")) + else if (strcmp(value, "auto") == 0) saltlen = RSA_PSS_SALTLEN_AUTO; else { /* -- cgit v1.2.3-55-g6feb