Commit Graph

188 Commits

Author SHA1 Message Date
Alexandre Julliard dc3a240a2d bcrypt: Convert the Unix library to the __wine_unix_call() interface.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Alexandre Julliard 696255907c bcrypt: Move public key allocation to the PE side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Alexandre Julliard 52ca433e78 bcrypt: Add a helper macros to load GnuTLS optional functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Alexandre Julliard e4f716bc26 bcrypt: Remove some no longer needed Unix backend functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:39 +02:00
Gijs Vermeulen b3cd21c21c bcrypt: Remove macOS backend.
GnuTLS has been the default since wine-3.13.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-30 20:00:34 +02:00
Alexandre Julliard 088a787a2c makefiles: Make -mno-cygwin the default.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Zhiyi Zhang caa5f68e41 bcrypt: Fix a compiler warning on Mac.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 21:52:23 +02:00
Paul Gofman f638bd901e bcrypt/tests: Add test for key parallel usage.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-20 21:07:10 +02:00
Paul Gofman 9944a7c92b bcrypt: Synchronize symmetric key access for encrypt and decrypt.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-20 21:07:10 +02:00
Hans Leidekker ae194f6997 bcrypt: Pass output length as a separate parameter to key_asymmetric_decrypt.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-20 21:07:10 +02:00
Hans Leidekker 3deb961583 bcrypt: Decryption with asymmetric keys is supported.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-20 21:07:10 +02:00
Esme Povirk 3db37dc5ae bcrypt: Don't try to unload gnutls if loading failed.
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-05 15:07:01 +02:00
Paul Gofman 085f9fb198 bcrypt: Fix padding in format_gnutls_signature().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Paul Gofman 541356dac5 bcrypt: Pad exported datums in key_export_dsa_capi().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Paul Gofman 4bf5371011 bcrypt: Pad exported datums in key_export_ecc().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Paul Gofman 37c86663eb bcrypt: Pad exported datums in export_gnutls_pubkey_dsa_capi().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Paul Gofman 68171b1c3a bcrypt: Pad exported datums in export_gnutls_pubkey_dsa().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Paul Gofman c5c2b7da3e bcrypt: Pad exported datums in export_gnutls_pubkey_ecc().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Paul Gofman 88a1848ca4 bcrypt: Introduce export_gnutls_datum() helper and use it in export_gnutls_pubkey_rsa().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-18 22:46:37 +01:00
Nikolay Sivov 38d9020f29 bcrypt: Add initial support for asymmetric keys in BCryptDecrypt().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-04 16:36:32 +01:00
Nikolay Sivov 21839185d9 bcrypt: Implement RSA key pair importing.
Requires libgnutls 3.7.0, that contains fixes for optional arguments handling
in gnutls_privkey_import_rsa_raw() to support BCRYPT_RSAPRIVATE_BLOB.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-03 20:18:36 +01:00
Andrey Gusev 111540ebc7 bcrypt: BCryptCreateHash is no longer a stub.
Signed-off-by: Andrey Gusev <andrey.goosev@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 19:01:56 +01:00
Paul Gofman f15328b145 bcrypt: Prevent gnutls from using system priority file.
Fedora 33 disabled protocols below TLS 1.2 through crypto policy.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-12 20:22:33 +01:00
Rémi Bernon 6b569a451f bcrypt: Implement 3DES cipher support.
This is used by CoD: WWII multiplayer mode to login to its servers.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-10 17:19:44 +01:00
Hans Leidekker a6e589bc52 bcrypt: Use internal helpers to generate hashes.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-21 10:51:23 +02:00
Hans Leidekker 437d932809 bcrypt: Copy all fields in key_duplicate.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-19 14:56:29 +02:00
Hans Leidekker f1e11804a0 bcrypt/tests: Fix a key handle leak.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-19 14:56:29 +02:00
Hans Leidekker 6decf17305 bcrypt: Add support for duplicating asymmetric keys.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-14 20:31:16 +02:00
Michael Stefaniuc d541f5cffe bcrypt/tests: Use wide-char string literals.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-08 10:46:04 +02:00
Hans Leidekker f79ca651ae bcrypt: Add support for importing legacy DSA public keys.
This is not supported on native but it will be useful to implement public key
import in dssenh.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-06 21:47:56 +02:00
Hans Leidekker 2a91b0bead bcrypt: Add support for exporting legacy DSA public keys.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-06 21:47:56 +02:00
Hans Leidekker a729efb964 bcrypt: Convert legacy DSA key parameters to and from little-endian format.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-06 21:47:56 +02:00
Hans Leidekker 7d54f9a87f bcrypt: Fix buffer size query in BCryptExportKey.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-06 21:47:56 +02:00
Hans Leidekker ab0a7d2a1b bcrypt: Fix buffer size query in BCryptSignHash.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-10-06 21:47:56 +02:00
Alexandre Julliard c4383013aa bcrypt: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 15:46:32 +02:00
Alexandre Julliard a472ad191f bcrypt: Move the backend code to a new Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 15:37:29 +02:00
Alexandre Julliard 209b968efc bcrypt: Split the key structure into generic and backend-specific parts.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 15:28:49 +02:00
Alexandre Julliard f0e1384777 bcrypt: Add separate backend functions for destroying symmetric/asymmetric keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 14:23:40 +02:00
Alexandre Julliard 4590465613 bcrypt: Move the symmetric key initialization to the generic code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 14:12:19 +02:00
Alexandre Julliard b8ada902d1 bcrypt: Move setting a symmetric key vector to the generic code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 13:58:56 +02:00
Alexandre Julliard 54c1b0ac26 bcrypt: Move the public key initialization to the generic code.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 13:47:14 +02:00
Alexandre Julliard d70c8e464a bcrypt: Add a helper function to create an asymmetric key.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 13:35:22 +02:00
Rémi Bernon 4ee4fffafa bcrypt: Export ECDSA/ECDH blobs with the correct header magic.
This fixes Flight Simulator XAL authentication error message.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-02 12:57:47 +02:00
Rémi Bernon 4bc5b822f6 bcrypt: Return STATUS_INVALID_PARAMETER on ECC magic mismatch.
Flight Simulator XAL authentication hits this condition because of
buggy bcrypt private key export (see next patch).

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-02 12:57:35 +02:00
Hans Leidekker d17b118f03 bcrypt: Allow importing private ECDSA keys.
Based on a patch by Derek Lesho.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-29 21:26:35 +02:00
Brendan Shanks e6314baa5e bcrypt: Add tests for BCryptSecretAgreement/BCryptDestroySecret/BCryptDeriveKey.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 22:19:58 +02:00
Brendan Shanks e763821cf4 bcrypt: Improve BCryptSecretAgreement/BCryptDestroySecret/BCryptDeriveKey stubs.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-20 22:19:56 +02:00
Zebediah Figura 46eac8de74 bcrypt/tests: Fix some failures on Windows 7.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-22 16:43:12 +02:00
Hans Leidekker ec3ca4ee73 bcrypt: Handle different sized R/S signature components.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:54:35 +02:00
Huw Davies 8a43688b3d bcrypt: Add stubs for DSS private key functions on macOS.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-05 16:54:35 +02:00