[CRYPT32]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 27 Sep 2014 10:36:45 +0000 (10:36 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 27 Sep 2014 10:36:45 +0000 (10:36 +0000)
* Sync with Wine 1.7.27.
CORE-8540

svn path=/trunk/; revision=64329

reactos/dll/win32/crypt32/cert.c
reactos/dll/win32/crypt32/chain.c
reactos/dll/win32/crypt32/crypt32_private.h
reactos/dll/win32/crypt32/sip.c
reactos/dll/win32/crypt32/str.c
reactos/media/doc/README.WINE

index c1728d5..8df27f8 100644 (file)
@@ -1874,6 +1874,12 @@ PCCERT_CONTEXT WINAPI CertGetIssuerCertificateFromStore(HCERTSTORE hCertStore,
             CertFreeCertificateContext(ret);
             ret = NULL;
         }
             CertFreeCertificateContext(ret);
             ret = NULL;
         }
+        if (CRYPT_IsCertificateSelfSigned(pSubjectContext))
+        {
+            CertFreeCertificateContext(ret);
+            ret = NULL;
+            SetLastError(CRYPT_E_SELF_SIGNED);
+        }
     }
     TRACE("returning %p\n", ret);
     return ret;
     }
     TRACE("returning %p\n", ret);
     return ret;
index 0aa359f..fdaf2fb 100644 (file)
@@ -258,7 +258,7 @@ typedef struct _CertificateChain
     LONG ref;
 } CertificateChain;
 
     LONG ref;
 } CertificateChain;
 
-static BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
+BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert)
 {
     PCERT_EXTENSION ext;
     DWORD size;
 {
     PCERT_EXTENSION ext;
     DWORD size;
index aa20cc8..769a968 100644 (file)
@@ -366,6 +366,7 @@ WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv,
 WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv,
  DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN;
 WINECRYPT_CERTSTORE *CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) DECLSPEC_HIDDEN;
 WINECRYPT_CERTSTORE *CRYPT_FileNameOpenStoreW(HCRYPTPROV hCryptProv,
  DWORD dwFlags, const void *pvPara) DECLSPEC_HIDDEN;
 WINECRYPT_CERTSTORE *CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) DECLSPEC_HIDDEN;
+BOOL CRYPT_IsCertificateSelfSigned(PCCERT_CONTEXT cert) DECLSPEC_HIDDEN;
 
 /* Allocates and initializes a certificate chain engine, but without creating
  * the root store.  Instead, it uses root, and assumes the caller has done any
 
 /* Allocates and initializes a certificate chain engine, but without creating
  * the root store.  Instead, it uses root, and assumes the caller has done any
index f13daa1..9d195e0 100644 (file)
@@ -198,7 +198,7 @@ BOOL WINAPI CryptSIPAddProvider(SIP_ADD_NEWPROVIDER *psNewProv)
     TRACE("%p\n", psNewProv);
 
     if (!psNewProv ||
     TRACE("%p\n", psNewProv);
 
     if (!psNewProv ||
-        psNewProv->cbStruct != sizeof(SIP_ADD_NEWPROVIDER) ||
+        psNewProv->cbStruct < FIELD_OFFSET(SIP_ADD_NEWPROVIDER, pwszGetCapFuncName) ||
         !psNewProv->pwszGetFuncName ||
         !psNewProv->pwszPutFuncName ||
         !psNewProv->pwszCreateFuncName ||
         !psNewProv->pwszGetFuncName ||
         !psNewProv->pwszPutFuncName ||
         !psNewProv->pwszCreateFuncName ||
index f58927a..eff10ea 100644 (file)
@@ -831,13 +831,14 @@ static BOOL CRYPT_GetNextKeyW(LPCWSTR str, struct X500TokenW *token,
 
 /* Assumes separators are characters in the 0-255 range */
 static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators,
 
 /* Assumes separators are characters in the 0-255 range */
 static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators,
- struct X500TokenW *token, LPCWSTR *ppszError)
WCHAR *separator_used, struct X500TokenW *token, LPCWSTR *ppszError)
 {
     BOOL ret = TRUE;
 
     TRACE("(%s, %s, %p, %p)\n", debugstr_w(str), debugstr_w(separators), token,
      ppszError);
 
 {
     BOOL ret = TRUE;
 
     TRACE("(%s, %s, %p, %p)\n", debugstr_w(str), debugstr_w(separators), token,
      ppszError);
 
+    *separator_used = 0;
     while (*str && isspaceW(*str))
         str++;
     if (*str)
     while (*str && isspaceW(*str))
         str++;
     if (*str)
@@ -877,6 +878,7 @@ static BOOL CRYPT_GetNextValueW(LPCWSTR str, DWORD dwFlags, LPCWSTR separators,
             while (*str && (*str >= 0xff || !map[*str]))
                 str++;
             token->end = str;
             while (*str && (*str >= 0xff || !map[*str]))
                 str++;
             token->end = str;
+            if (map[*str]) *separator_used = *str;
         }
     }
     else
         }
     }
     else
@@ -1068,6 +1070,7 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
                     static const WCHAR allSepsWithoutPlus[] = { ',',';','\r','\n',0 };
                     static const WCHAR allSeps[] = { '+',',',';','\r','\n',0 };
                     LPCWSTR sep;
                     static const WCHAR allSepsWithoutPlus[] = { ',',';','\r','\n',0 };
                     static const WCHAR allSeps[] = { '+',',',';','\r','\n',0 };
                     LPCWSTR sep;
+                    WCHAR sep_used;
 
                     str++;
                     if (dwStrType & CERT_NAME_STR_COMMA_FLAG)
 
                     str++;
                     if (dwStrType & CERT_NAME_STR_COMMA_FLAG)
@@ -1080,11 +1083,14 @@ BOOL WINAPI CertStrToNameW(DWORD dwCertEncodingType, LPCWSTR pszX500,
                         sep = allSepsWithoutPlus;
                     else
                         sep = allSeps;
                         sep = allSepsWithoutPlus;
                     else
                         sep = allSeps;
-                    ret = CRYPT_GetNextValueW(str, dwStrType, sep, &token,
+                    ret = CRYPT_GetNextValueW(str, dwStrType, sep, &sep_used, &token,
                      ppszError);
                     if (ret)
                     {
                         str = token.end;
                      ppszError);
                     if (ret)
                     {
                         str = token.end;
+                        /* if token.end points to the separator, skip it */
+                        if (str && sep_used && *str == sep_used) str++;
+
                         ret = CRYPT_ValueToRDN(dwCertEncodingType, &info,
                          keyOID, &token, dwStrType, ppszError);
                     }
                         ret = CRYPT_ValueToRDN(dwCertEncodingType, &info,
                          keyOID, &token, dwStrType, ppszError);
                     }
index cceb096..bed7366 100644 (file)
@@ -64,7 +64,7 @@ reactos/dll/win32/comctl32            # Synced to Wine-1.7.27
 reactos/dll/win32/comdlg32            # Synced to Wine-1.7.27
 reactos/dll/win32/compstui            # Synced to Wine-1.7.17
 reactos/dll/win32/credui              # Synced to Wine-1.7.17
 reactos/dll/win32/comdlg32            # Synced to Wine-1.7.27
 reactos/dll/win32/compstui            # Synced to Wine-1.7.17
 reactos/dll/win32/credui              # Synced to Wine-1.7.17
-reactos/dll/win32/crypt32             # Synced to Wine-1.7.17
+reactos/dll/win32/crypt32             # Synced to Wine-1.7.27
 reactos/dll/win32/cryptdlg            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptdll            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptnet            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptdlg            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptdll            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptnet            # Synced to Wine-1.7.17