Juan Lang : crypt32: Reduce excessive indenting.

Alexandre Julliard julliard at winehq.org
Thu Aug 21 10:02:14 CDT 2008


Module: wine
Branch: master
Commit: a203640b5a44aad7b8fbf35db32d6e738faddd72
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a203640b5a44aad7b8fbf35db32d6e738faddd72

Author: Juan Lang <juan.lang at gmail.com>
Date:   Wed Aug 20 12:10:27 2008 -0700

crypt32: Reduce excessive indenting.

---

 dlls/crypt32/message.c |   87 ++++++++++++++++++++++-------------------------
 1 files changed, 41 insertions(+), 46 deletions(-)

diff --git a/dlls/crypt32/message.c b/dlls/crypt32/message.c
index fe4d4ec..2aeb3cf 100644
--- a/dlls/crypt32/message.c
+++ b/dlls/crypt32/message.c
@@ -131,6 +131,7 @@ BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
     BOOL ret = FALSE;
     DWORD size;
     CRYPT_CONTENT_INFO *contentInfo;
+    HCRYPTMSG msg;
 
     TRACE("(%p, %d, %p, %d, %p, %p, %p)\n",
      pVerifyPara, dwSignerIndex, pbSignedBlob, cbSignedBlob,
@@ -149,66 +150,60 @@ BOOL WINAPI CryptVerifyMessageSignature(PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
         return FALSE;
     }
 
-    ret = CryptDecodeObjectEx(pVerifyPara->dwMsgAndCertEncodingType,
+    if (!CryptDecodeObjectEx(pVerifyPara->dwMsgAndCertEncodingType,
      PKCS_CONTENT_INFO, pbSignedBlob, cbSignedBlob,
      CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,
-     (LPBYTE)&contentInfo, &size);
-    if (ret)
+     (LPBYTE)&contentInfo, &size))
+        return FALSE;
+    if (strcmp(contentInfo->pszObjId, szOID_RSA_signedData))
     {
-        if (strcmp(contentInfo->pszObjId, szOID_RSA_signedData))
-        {
-            SetLastError(CRYPT_E_UNEXPECTED_MSG_TYPE);
-            ret = FALSE;
-        }
-        else
+        LocalFree(contentInfo);
+        SetLastError(CRYPT_E_UNEXPECTED_MSG_TYPE);
+        return FALSE;
+    }
+    msg = CryptMsgOpenToDecode(pVerifyPara->dwMsgAndCertEncodingType, 0,
+     CMSG_SIGNED, pVerifyPara->hCryptProv, NULL, NULL);
+    if (msg)
+    {
+        ret = CryptMsgUpdate(msg, contentInfo->Content.pbData,
+         contentInfo->Content.cbData, TRUE);
+        if (ret && pcbDecoded)
+            ret = CRYPT_CopyParam(pbDecoded, pcbDecoded,
+             contentInfo->Content.pbData, contentInfo->Content.cbData);
+        if (ret)
         {
-            HCRYPTMSG msg = CryptMsgOpenToDecode(
-             pVerifyPara->dwMsgAndCertEncodingType, 0, CMSG_SIGNED,
-             pVerifyPara->hCryptProv, NULL, NULL);
+            CERT_INFO *certInfo = CRYPT_GetSignerCertInfoFromMsg(msg,
+             dwSignerIndex);
 
-            if (msg)
+            ret = FALSE;
+            if (certInfo)
             {
-                ret = CryptMsgUpdate(msg, contentInfo->Content.pbData,
-                 contentInfo->Content.cbData, TRUE);
-                if (ret && pcbDecoded)
-                    ret = CRYPT_CopyParam(pbDecoded, pcbDecoded,
-                     contentInfo->Content.pbData, contentInfo->Content.cbData);
-                if (ret)
+                HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MSG,
+                 pVerifyPara->dwMsgAndCertEncodingType,
+                 pVerifyPara->hCryptProv, 0, msg);
+
+                if (store)
                 {
-                    CERT_INFO *certInfo = CRYPT_GetSignerCertInfoFromMsg(msg,
-                     dwSignerIndex);
+                    PCCERT_CONTEXT cert = CRYPT_GetSignerCertificate(
+                     msg, pVerifyPara, certInfo, store);
 
-                    ret = FALSE;
-                    if (certInfo)
+                    if (cert)
                     {
-                        HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MSG,
-                         pVerifyPara->dwMsgAndCertEncodingType,
-                         pVerifyPara->hCryptProv, 0, msg);
-
-                        if (store)
-                        {
-                            PCCERT_CONTEXT cert = CRYPT_GetSignerCertificate(
-                             msg, pVerifyPara, certInfo, store);
-
-                            if (cert)
-                            {
-                                ret = CryptMsgControl(msg, 0,
-                                 CMSG_CTRL_VERIFY_SIGNATURE, cert->pCertInfo);
-                                if (ret && ppSignerCert)
-                                    *ppSignerCert = cert;
-                                else
-                                    CertFreeCertificateContext(cert);
-                            }
-                            CertCloseStore(store, 0);
-                        }
+                        ret = CryptMsgControl(msg, 0,
+                         CMSG_CTRL_VERIFY_SIGNATURE, cert->pCertInfo);
+                        if (ret && ppSignerCert)
+                            *ppSignerCert = cert;
+                        else
+                            CertFreeCertificateContext(cert);
                     }
-                    CryptMemFree(certInfo);
+                    CertCloseStore(store, 0);
                 }
-                CryptMsgClose(msg);
             }
+            CryptMemFree(certInfo);
         }
-        LocalFree(contentInfo);
+        CryptMsgClose(msg);
     }
+    LocalFree(contentInfo);
     TRACE("returning %d\n", ret);
     return ret;
 }




More information about the wine-cvs mailing list