opensc/src
Doug Engert 1b4e9f1d4a C_Initialize may be called by multiple threads
While trying to setup an OpenSC context, the global_locking
and detect cards, it is possible that multiple threads may
call C_Initialize. The current code tries to prevent this using
"if (context == NULL)"  but this is not a mutex, and
multiple threads may endup overwrite contexts and global locking and
cause additional problems, with pcsc and segfault.

FireFox appears to do this see #2032

The PR adds a mutex or Critical section to make sure only one
thread creates the context sets the global_locking  and does
the initial detect cards, etc.

This allows the global_lock (if requested) to be setup
which is then used for other calls.

All but the first call to C_Initialize will return with CKR_OK,
others will return CKR_CRYPTOKI_ALREADY_INITIALIZED.

 Date:      Mon Jan 11 12:47:12 2021 -0600
 Changes to be committed:
	modified:   src/pkcs11/pkcs11-global.c
2021-01-26 12:50:39 +01:00
..
common common, pkcs11-tool: Use new PKCS #11 API with fallback to old one 2021-01-11 14:49:22 +01:00
libopensc idprime: Create algorithme reference based on the MGF1 flags as the HASH flags are no longer present for RSA-PSS mechanism 2021-01-26 10:53:30 +01:00
minidriver Update upper length for ATR and the comments. 2020-11-04 11:02:56 +01:00
pkcs11 C_Initialize may be called by multiple threads 2021-01-26 12:50:39 +01:00
pkcs15init Use fresh data from FCI instead of FCP for sc_pkcs15init_authenticate() 2021-01-22 18:59:22 +01:00
scconf fixed missing includes 2020-05-11 18:58:12 +02:00
sm Initial support for Polish eID card (e-dowód, eDO) (#2023) 2020-05-19 14:05:13 +02:00
smm fixed 127766 Out-of-bounds read 2019-11-05 21:49:30 +01:00
tests p11test: Explicitly return in case of SKIP macro is used 2021-01-22 19:07:05 +01:00
tools pkcs11-tool support key-gen for GENERIC secret key 2021-01-26 12:34:15 +01:00
ui pcsc: immediately exit on hotplug events 2020-06-09 12:07:04 +02:00
Makefile.am added fuzzing with libFuzzer and OSS-Fuzz 2019-07-26 15:23:02 +02:00
Makefile.mak use compat_getopt_long if getopt_long is not available 2019-03-25 14:30:09 +01:00