Dmitry Timoshkov : crypt32: Simplify the CertComparePublicKeyInfo implementation.
Alexandre Julliard
julliard at winehq.org
Thu Oct 25 15:24:35 CDT 2018
Module: wine
Branch: master
Commit: b81c0c3e47a163c3b693099565257b6a91a67647
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b81c0c3e47a163c3b693099565257b6a91a67647
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Thu Oct 25 14:50:35 2018 +0300
crypt32: Simplify the CertComparePublicKeyInfo implementation.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/crypt32/cert.c | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index 4a7a1fe..9157814 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -1267,32 +1267,21 @@ BOOL WINAPI CertComparePublicKeyInfo(DWORD dwCertEncodingType,
ret = FALSE;
if (CryptDecodeObject(dwCertEncodingType, RSA_CSP_PUBLICKEYBLOB,
pPublicKey1->PublicKey.pbData, pPublicKey1->PublicKey.cbData,
- 0, NULL, &length))
+ CRYPT_DECODE_ALLOC_FLAG, &pblob1, &length))
{
- pblob1 = CryptMemAlloc(length);
if (CryptDecodeObject(dwCertEncodingType, RSA_CSP_PUBLICKEYBLOB,
- pPublicKey1->PublicKey.pbData, pPublicKey1->PublicKey.cbData,
- 0, pblob1, &length))
+ pPublicKey2->PublicKey.pbData, pPublicKey2->PublicKey.cbData,
+ CRYPT_DECODE_ALLOC_FLAG, &pblob2, &length))
{
- if (CryptDecodeObject(dwCertEncodingType, RSA_CSP_PUBLICKEYBLOB,
- pPublicKey2->PublicKey.pbData, pPublicKey2->PublicKey.cbData,
- 0, NULL, &length))
- {
- pblob2 = CryptMemAlloc(length);
- if (CryptDecodeObject(dwCertEncodingType, RSA_CSP_PUBLICKEYBLOB,
- pPublicKey2->PublicKey.pbData, pPublicKey2->PublicKey.cbData,
- 0, pblob2, &length))
- {
- /* The RSAPUBKEY structure directly follows the BLOBHEADER */
- RSAPUBKEY *pk1 = (LPVOID)(pblob1 + 1),
- *pk2 = (LPVOID)(pblob2 + 1);
- ret = (pk1->bitlen == pk2->bitlen) && (pk1->pubexp == pk2->pubexp)
- && !memcmp(pk1 + 1, pk2 + 1, pk1->bitlen/8);
- }
- CryptMemFree(pblob2);
- }
+ /* The RSAPUBKEY structure directly follows the BLOBHEADER */
+ RSAPUBKEY *pk1 = (LPVOID)(pblob1 + 1),
+ *pk2 = (LPVOID)(pblob2 + 1);
+ ret = (pk1->bitlen == pk2->bitlen) && (pk1->pubexp == pk2->pubexp)
+ && !memcmp(pk1 + 1, pk2 + 1, pk1->bitlen/8);
+
+ LocalFree(pblob2);
}
- CryptMemFree(pblob1);
+ LocalFree(pblob1);
}
break;
More information about the wine-cvs
mailing list