Hello,

I am developing an application that uses a patched version of openssl which has engine support for musclecard. Attached is a simple patch for libmusclecard-1.3.3 that I needed in order to successfully execute a sequence of crypto operations with a smart card. The issue it attempts to resolve is that the cached context is not invalidated after the context is released. This causes MSCListTokens under at least the following sequence:
- MSCListTokens is called
- MSCEstablishConnection is called
- RSA encryption or decryption
- MSCReleaseConnection is called
- MSCListTokens is called and fails

I am not sure if this is an appropriate fix or if there is some other method of achieving it, but it works for me.

Any feedback is appreciated.

Cheers,
scott.


diff -pur libmusclecard-1.3.3/src/musclecard.c libmusclecard-1.3.3-cbn/src/musclecard.c
--- libmusclecard-1.3.3/src/musclecard.c	2006-03-21 14:22:06.000000000 -0500
+++ libmusclecard-1.3.3-cbn/src/musclecard.c	2006-06-14 15:18:58.000000000 -0400
@@ -607,6 +607,9 @@ MSC_RV MSCReleaseConnection(MSCLPTokenCo
 		rv = SCardReleaseContext(pConnection->hContext);
 		if (pcscToMSC(rv) != MSC_SUCCESS)
 			return pcscToMSC(rv);
+
+		if (pConnection->hContext == localHContext)
+			localHContext = 0;
 	}
 
 	pConnection->tokenLibHandle = 0;
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to