Merge pull request #6 from shearl/master

Switched to S_ISDIR for portable check if filesystem entry is directory....
Minor changes in ultralite.
CTAPI uses mutexes from common folder.
TRUE thread safe PKCS#11 library and enhanced sc-hsm-pkcs11-test program.
CTAPI problem fixed.
Bug fixed in freeSession.
first working version with saving hash state
sc-hsm-ultralite-sample: Added extensive error checking. Added hash state caching. Standardized logging. Added Windows/Linux logging scripts. Added Windows/Linux convenience scripts. General improvements.