Commit Graph

2061 Commits

Author SHA1 Message Date
Aaron Hill 0342de8e4d crypt32: Add missing 'break' to X509_ECC_SIGNATURE case.
This was accidentally removed as part of commit
5edf65616a

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51501
Signed-off-by: Aaron Hill <aa1ronham@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 19:42:25 +02:00
Zebediah Figura bdcddf024f crypt32: Copy the CRL_INFO structure instead of recalculating it.
Steam calls CertGetCertificateChain() on a certificate with a 20 MB CRL, which
can take over 400 ms to parse each time. Avoid parsing it more often than we
need to.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-21 22:02:23 +02:00
Zebediah Figura 1c501c6587 crypt32: Rename "crl" and "cloned" to "dst" and "src" in CRL_clone().
"cloned" is very ambiguous and can be interpreted as the destination rather than
the source.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-21 22:02:20 +02:00
Aaron Hill 5edf65616a crypt32: Implement CNG_RSA_PUBLIC_KEY_BLOB encoding/decoding.
Add support for the OID CNG_RSA_PUBLIC_KEY_BLOB to
CryptEncodeObjectEx and CryptDecodeObjectEx. This OID
decodes to / encodes from memory consisting of a
BCRYPT_RSAKEY_BLOB, followed in memory by the exponent and
modulus in big-endian format.

Signed-off-by: Aaron Hill <aa1ronham@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-19 12:17:41 +02:00
Rémi Bernon 8b8b43d5f3 crypt32: Grow item size buffer by more than 1 at a time.
When Steam starts and connects, it sometimes does some crypt32
processing and ends up spending a huge amount of time in ntdll memcpy,
reallocating buffers, effectively getting stuck while connecting to the
user account.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 16:49:09 +02:00
Piotr Caban 6ac02c0cac crypt32: Handle CERT_CHAIN_POLICY_IGNORE_NOT_TIME_VALID_FLAG when verifying chain policy.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 18:03:47 +02:00
Piotr Caban be3f6c87a0 crypt32/tests: Fix tests skipped on all test bot machines.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 18:03:42 +02:00
Piotr Caban a0dc2adf73 crypt32/tests: Fix tests on systems where google chain root is not trusted.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-15 18:03:37 +02:00
Dmitry Timoshkov 3038c0cd1a crypt32/tests: Remove Win9x checks.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 20:50:15 +02:00
Dmitry Timoshkov 67c8ffc847 crypt32/tests: Link to BCryptDestroyKey directly.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 20:50:13 +02:00
Dmitry Timoshkov 6bc7a65ef9 crypt32/tests: Link to CryptAcquireContext directly.
encode.c tests already do that.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 20:50:09 +02:00
Dmitry Timoshkov 8601953ebd crypt32/tests: Add a test to verify certificate signature.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-14 20:50:04 +02:00
Dmitry Timoshkov 9d1ae850df crypt32: Add support for importing RSA public keys with BCrypt.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50925
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-12 19:34:50 +02:00
Dmitry Timoshkov c2c7946680 crypt32: Implement CryptImportPublicKeyInfoEx2.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-12 19:34:43 +02:00
Piotr Caban c53d6a4a7c crypt32: Also import user/admin defined root certificates on macOS.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-25 21:04:10 +01:00
Francois Gouget 7cd5cc2ecb crypt32/tests: Fix a registerOIDInfo() failure when missing elevated privileges.
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-17 10:46:42 +01:00
Dmitry Timoshkov cd9a510bce crypt32/tests: Add some tests for CRYPT_KEY_PROV_INFO certificate property.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50024
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-04 21:23:27 +01:00
Dmitry Timoshkov 01d7953189 crypt32: Fix reading and writing CRYPT_KEY_PROV_INFO certificate property.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50024
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-04 21:23:27 +01:00
Dmitry Timoshkov d3a4477bad crypt32: Add support for CRYPT_STRING_HEX to CryptBinaryToStringW.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-03 20:18:38 +01:00
Paul Gofman 11d09da60f crypt32: Prevent gnutls from using system priority file.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 20:22:33 +01:00
Dmitry Timoshkov 4da1bca7c5 crypt32: Add support for CMSG_ENCODED_MESSAGE for a being decoded signed message.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 11:16:31 +01:00
Dmitry Timoshkov 4c9c6ca417 crypt32: Add support for CMSG_SIGNER_AUTH_ATTR_PARAM for a being decoded signed message.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 11:16:28 +01:00
Dmitry Timoshkov 1b87f222ed crypt32: Make helper for copying CMSG_CMS_SIGNER_INFO attributes more generic.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 11:16:22 +01:00
Dmitry Timoshkov 0c8ce3aab5 crypt32/tests: Fix test failures under newer Windows versions.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-10 20:30:34 +01:00
Paul Gofman 706e35f2a2 crypt32: Fix adding trusted roots to store.
Fixes Steam client errors on SSL connections
(regression from bd59aa6d66).

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-10 17:19:44 +01:00
Alexandre Julliard d202e02f79 crypt32: List allowed characters instead of relying on wctype properties.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 20:15:11 +01:00
Alexandre Julliard 4120fb994a crypt32: Use wide-character string literals.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 11:44:12 +01:00
Alexandre Julliard 03bf236961 crypt32: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 11:41:21 +01:00
Alexandre Julliard bd59aa6d66 crypt32: Move the root store initialization to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 11:40:55 +01:00
Alexandre Julliard a36ff69027 crypt32: Move the GnuTLS code to a new Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-09 11:29:15 +01:00
Dmitry Timoshkov 7f8f424f38 crypt32: Fix conversion of CRYPT_KEY_PROV_INFO between store and certificate property.
Store uses relative offsets while certificate property uses pointers.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-25 20:46:44 +02:00
Hans Leidekker 547508e374 crypt32: Add support for CRYPT_MACHINE_KEYSET in PFXImportCertStore.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49857
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-23 15:45:40 +02:00
Alexandre Julliard 6d7037c9ff crypt32: Move GnuTLS-specific helpers into the #ifdef.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-21 13:21:30 +02:00
Hans Leidekker 4e11e6e045 crypt32: Set key context if PKCS12_NO_PERSIST_KEY is passed, otherwise set key provider info.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-17 20:54:16 +02:00
Hans Leidekker 49165c25e8 crypt32: Store CERT_KEY_CONTEXT in a platform independent way.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49792
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-10 22:06:46 +02:00
Gijs Vermeulen a963947322 crypt32: Remove unused variable in test_CryptBinaryToString().
This was missed in eb00dbd913.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-03 17:21:44 +02:00
Serge Gautherie 3e8b07309c crypt32: Check CRYPT_ConstructBitBlob() return value in CRYPT_ExportKeyTrans().
Signed-off-by: Serge Gautherie <winehq-git_serge_180711@gautherie.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-15 20:06:38 +02:00
Dmitry Timoshkov fd1be205ba crypt32: Store CRYPT_KEY_PROV_INFO in a platform independent way.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-09 12:25:09 +02:00
Rémi Bernon 4e94e21060 crypt32/tests: Fix signed integral cast warning.
First cast to int, then to DWORD.

Reported by MinGW GCC 10 with -Woverflow.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 21:47:49 +02:00
Dmitry Timoshkov 0e30815636 crypt32: pwszContainerName or pwszProvName could be NULL in CRYPT_KEY_PROV_INFO.
Make behaviour of CRYPT_FixKeyProvInfoPointers match
CRYPT_CopyKeyProvInfo, and fix reading CRYPT_KEY_PROV_INFO certificate
property from the store.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 20:25:50 +02:00
Hans Leidekker 1f27719007 crypt32: Microsoft root policy does not include the base policy.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-15 17:33:37 +02:00
Hans Leidekker 403b83fdb1 crypt32: Recognize 'Microsoft Root Certificate Authority 2010' when verifying the Microsoft root policy.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-15 17:33:34 +02:00
Alexandre Julliard 12157fac9f crypt32: Use standard dlopen() instead of the libwine wrappers.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-04-06 21:21:41 +02:00
Hans Leidekker 583ca55613 crypt32/tests: Update *.winehq.org certificate.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-25 23:43:18 +01:00
Nikolay Sivov 3d69d71e9e crypt32: Fix CryptBinaryToStringW() to return required length properly.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-11 22:39:59 +01:00
Nikolay Sivov eb00dbd913 crypt32/tests: Detect missing HEXRAW support by output.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-11 22:39:59 +01:00
Daniel Lehman f92581ee82 crypt32: Implement CryptBinaryToStringW(HEXRAW).
Signed-off-by: Daniel Lehman <dlehman@esri.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-10 22:46:24 +01:00
Ilia Mirkin 8ca8fa87fa crypt32/tests: Additional test for skipping unknown CAs.
This is already tested by setting a flag in the ssl policy parameters,
but apparently the flag in base policy parameters also needs to be
respected. Tested on Win7.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-06 22:51:28 +01:00
Ilia Mirkin 5011815d62 crypt32: Also check CERT_CHAIN_POLICY_ALLOW_UNKNOWN_CA_FLAG.
It appears that the untrusted root check should be skipped if this flag
is set even if the ExtraPolicyPara one is not set.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48495
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-06 22:51:17 +01:00
Jacek Caban 275f6ca3df crypt32: Allow only ASCII digits in CRYPT_AsnEncodeNumericString.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-02-06 21:40:22 +01:00