summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2024-07-16 07:06:05 +0200
committerRichard Levitte <levitte@openssl.org>2024-08-21 08:21:06 +0200
commit8736de5e77fe1ccb52efd84e1d93372f57420495 (patch)
tree1acc6a42f3cadc0ef9338e64f16ef7365379c0ec
parentAdd new test types in test/evp_test.c, and a test for RSA sigalgs (diff)
downloadopenssl-8736de5e77fe1ccb52efd84e1d93372f57420495.tar.xz
openssl-8736de5e77fe1ccb52efd84e1d93372f57420495.zip
fix coding style
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23416)
-rw-r--r--providers/common/securitycheck.c50
-rw-r--r--providers/implementations/signature/rsa_sig.c42
2 files changed, 46 insertions, 46 deletions
diff --git a/providers/common/securitycheck.c b/providers/common/securitycheck.c
index ed7f0a8ab5..0831ef3204 100644
--- a/providers/common/securitycheck.c
+++ b/providers/common/securitycheck.c
@@ -26,32 +26,32 @@ int ossl_rsa_key_op_get_protect(const RSA *rsa, int operation, int *outprotect)
int protect = 0;
switch (operation) {
- case EVP_PKEY_OP_SIGN:
- case EVP_PKEY_OP_SIGNMSG:
- protect = 1;
- /* fallthrough */
- case EVP_PKEY_OP_VERIFY:
- case EVP_PKEY_OP_VERIFYMSG:
- break;
- case EVP_PKEY_OP_ENCAPSULATE:
- case EVP_PKEY_OP_ENCRYPT:
- protect = 1;
- /* fallthrough */
- case EVP_PKEY_OP_VERIFYRECOVER:
- case EVP_PKEY_OP_DECAPSULATE:
- case EVP_PKEY_OP_DECRYPT:
- if (RSA_test_flags(rsa,
- RSA_FLAG_TYPE_MASK) == RSA_FLAG_TYPE_RSASSAPSS) {
- ERR_raise_data(ERR_LIB_PROV,
- PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE,
- "operation: %d", operation);
- return 0;
- }
- break;
- default:
- ERR_raise_data(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR,
- "invalid operation: %d", operation);
+ case EVP_PKEY_OP_SIGN:
+ case EVP_PKEY_OP_SIGNMSG:
+ protect = 1;
+ /* fallthrough */
+ case EVP_PKEY_OP_VERIFY:
+ case EVP_PKEY_OP_VERIFYMSG:
+ break;
+ case EVP_PKEY_OP_ENCAPSULATE:
+ case EVP_PKEY_OP_ENCRYPT:
+ protect = 1;
+ /* fallthrough */
+ case EVP_PKEY_OP_VERIFYRECOVER:
+ case EVP_PKEY_OP_DECAPSULATE:
+ case EVP_PKEY_OP_DECRYPT:
+ if (RSA_test_flags(rsa,
+ RSA_FLAG_TYPE_MASK) == RSA_FLAG_TYPE_RSASSAPSS) {
+ ERR_raise_data(ERR_LIB_PROV,
+ PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE,
+ "operation: %d", operation);
return 0;
+ }
+ break;
+ default:
+ ERR_raise_data(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR,
+ "invalid operation: %d", operation);
+ return 0;
}
*outprotect = protect;
return 1;
diff --git a/providers/implementations/signature/rsa_sig.c b/providers/implementations/signature/rsa_sig.c
index be80d0f09a..b7f6a01185 100644
--- a/providers/implementations/signature/rsa_sig.c
+++ b/providers/implementations/signature/rsa_sig.c
@@ -170,29 +170,29 @@ static int rsa_check_padding(const PROV_RSA_CTX *prsactx,
int mdnid)
{
switch (prsactx->pad_mode) {
- case RSA_NO_PADDING:
- if (mdname != NULL || mdnid != NID_undef) {
- ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE);
- return 0;
- }
- break;
- case RSA_X931_PADDING:
- if (RSA_X931_hash_id(mdnid) == -1) {
- ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_X931_DIGEST);
+ case RSA_NO_PADDING:
+ if (mdname != NULL || mdnid != NID_undef) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE);
+ return 0;
+ }
+ break;
+ case RSA_X931_PADDING:
+ if (RSA_X931_hash_id(mdnid) == -1) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_X931_DIGEST);
+ return 0;
+ }
+ break;
+ case RSA_PKCS1_PSS_PADDING:
+ if (rsa_pss_restricted(prsactx))
+ if ((mdname != NULL && !EVP_MD_is_a(prsactx->md, mdname))
+ || (mgf1_mdname != NULL
+ && !EVP_MD_is_a(prsactx->mgf1_md, mgf1_mdname))) {
+ ERR_raise(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED);
return 0;
}
- break;
- case RSA_PKCS1_PSS_PADDING:
- if (rsa_pss_restricted(prsactx))
- if ((mdname != NULL && !EVP_MD_is_a(prsactx->md, mdname))
- || (mgf1_mdname != NULL
- && !EVP_MD_is_a(prsactx->mgf1_md, mgf1_mdname))) {
- ERR_raise(ERR_LIB_PROV, PROV_R_DIGEST_NOT_ALLOWED);
- return 0;
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
return 1;