summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2021-04-18 13:37:53 +0300
committerVasily Melenchuk <vasily.melenchuk@cib.de>2021-04-18 13:37:53 +0300
commit0046cfb7a990280c44763230c9c353da5560d515 (patch)
tree4bd041c8a615e4c38cf44e19d751a0638f9eae0b
parentb79a633ee18dfc2a9eeb7c3cf7b1c0bfd7efba2d (diff)
xmlsecurity: keep error code (if any) to support older WinSDK < 10
Change-Id: I42a102a3532f3de98fecba8a7d96e93caac4b95b
-rw-r--r--svl/source/crypto/cryptosign.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index fb5fd7038033..479aa07af07d 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -1427,7 +1427,10 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer)
&bFreeNeeded))
{
SAL_WARN("svl.crypto", "CryptAcquireCertificatePrivateKey failed: " << WindowsErrorString(GetLastError()));
+ // Keep last error value for later checks. WinSDK < 10 during CertFreeCertificateContext() can modify it
+ DWORD dwErr = GetLastError();
CertFreeCertificateContext(pCertContext);
+ SetLastError(dwErr);
return false;
}
assert(!bFreeNeeded);