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)
This commit is contained in:
Richard Levitte 2024-07-16 07:06:05 +02:00
parent b02cf2fc8f
commit 8736de5e77
2 changed files with 46 additions and 46 deletions

View File

@ -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;

View File

@ -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);
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_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;
default:
break;
break;
default:
break;
}
return 1;