summaryrefslogtreecommitdiffstats
path: root/libfreerdp/emu
diff options
context:
space:
mode:
Diffstat (limited to 'libfreerdp/emu')
-rw-r--r--libfreerdp/emu/scard/smartcard_emulate.c19
-rw-r--r--libfreerdp/emu/scard/smartcard_virtual_gids.c6
2 files changed, 23 insertions, 2 deletions
diff --git a/libfreerdp/emu/scard/smartcard_emulate.c b/libfreerdp/emu/scard/smartcard_emulate.c
index b2809c3..d517bd6 100644
--- a/libfreerdp/emu/scard/smartcard_emulate.c
+++ b/libfreerdp/emu/scard/smartcard_emulate.c
@@ -19,6 +19,7 @@
*/
#include <freerdp/config.h>
+#include <freerdp/freerdp.h>
#include <winpr/crt.h>
#include <winpr/wlog.h>
@@ -1362,6 +1363,10 @@ LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
WINPR_ASSERT(value); /* Must be valid after Emulate_SCardIsValidContext */
+ freerdp* inst =
+ freerdp_settings_get_pointer_writable(smartcard->settings, FreeRDP_instance);
+ WINPR_ASSERT(inst);
+
status = SCARD_E_TIMEOUT;
do
{
@@ -1410,6 +1415,11 @@ LONG WINAPI Emulate_SCardGetStatusChangeA(SmartcardEmulationContext* smartcard,
Sleep(diff);
if (dwTimeout != INFINITE)
dwTimeout -= MIN(dwTimeout, diff);
+ if (freerdp_shall_disconnect_context(inst->context))
+ {
+ status = SCARD_E_CANCELLED;
+ break;
+ }
} while (dwTimeout > 0);
}
@@ -1436,6 +1446,10 @@ LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
SCardContext* value = HashTable_GetItemValue(smartcard->contexts, (const void*)hContext);
WINPR_ASSERT(value); /* Must be valid after Emulate_SCardIsValidContext */
+ freerdp* inst =
+ freerdp_settings_get_pointer_writable(smartcard->settings, FreeRDP_instance);
+ WINPR_ASSERT(inst);
+
status = SCARD_E_TIMEOUT;
do
{
@@ -1483,6 +1497,11 @@ LONG WINAPI Emulate_SCardGetStatusChangeW(SmartcardEmulationContext* smartcard,
Sleep(diff);
if (dwTimeout != INFINITE)
dwTimeout -= MIN(dwTimeout, diff);
+ if (freerdp_shall_disconnect_context(inst->context))
+ {
+ status = SCARD_E_CANCELLED;
+ break;
+ }
} while (dwTimeout > 0);
}
diff --git a/libfreerdp/emu/scard/smartcard_virtual_gids.c b/libfreerdp/emu/scard/smartcard_virtual_gids.c
index 3d4dda3..4f29c25 100644
--- a/libfreerdp/emu/scard/smartcard_virtual_gids.c
+++ b/libfreerdp/emu/scard/smartcard_virtual_gids.c
@@ -842,14 +842,14 @@ static BOOL vgids_get_public_key(vgidsContext* context, UINT16 doTag)
/* set response data */
Stream_SetPosition(response, 0);
context->responseData = response;
+ response = NULL;
rc = TRUE;
handle_error:
free(n);
free(e);
Stream_Free(pubKey, TRUE);
- if (!rc)
- Stream_Free(response, TRUE);
+ Stream_Free(response, TRUE);
return rc;
}
@@ -1047,8 +1047,10 @@ static BOOL vgids_perform_digital_signature(vgidsContext* context)
{ g_PKCS1_SHA256, sizeof(g_PKCS1_SHA256), EVP_sha256() },
{ g_PKCS1_SHA384, sizeof(g_PKCS1_SHA384), EVP_sha384() },
{ g_PKCS1_SHA512, sizeof(g_PKCS1_SHA512), EVP_sha512() },
+#if OPENSSL_VERSION_NUMBER >= 0x10101000L
{ g_PKCS1_SHA512_224, sizeof(g_PKCS1_SHA512_224), EVP_sha512_224() },
{ g_PKCS1_SHA512_256, sizeof(g_PKCS1_SHA512_256), EVP_sha512_256() }
+#endif
};
if (!pk)