]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
fix coding style
authorRichard Levitte <levitte@openssl.org>
Tue, 16 Jul 2024 05:06:05 +0000 (07:06 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 21 Aug 2024 06:21:06 +0000 (08:21 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23416)

providers/common/securitycheck.c
providers/implementations/signature/rsa_sig.c

index ed7f0a8ab516630048de91e5a872371d70dae138..0831ef32043545b394ac6d795441ad72a8953bcf 100644 (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;
index be80d0f09af0f823bfb9aba42c51b83ecea49b10..b7f6a011857e8b1f84d28a32bbce71d6f2280734 100644 (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);
-                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;