> From crypto-discuss-bounces at opensolaris.org Mon Apr 20 11:34:31 2009 > From: "Garrett D'Amore" <gdamore at opensolaris.org> > Dan McDonald wrote: > > Hello. > > > > I *know* that one is suppoed to have one open PKCS#11 session per slot and > > per thread if you have a multithreaded PKCS#11 app. What's less clear to me > > is if: > > > > > Its been a long time since I worked on the *implementation* of PKCS#11, > but... > > > - C_Initialize() is done per-thread or prior to thread creation. > > (I'd suspect once prior to threads, but I'm not sure, hence I'm > > asking.) > > > > I think once per app. I suspect doing it more than once might be > incredibly destructive -- I believe part of the intention here is that > C_Initialize can be used to initialize global locks, and such.
Multiple calls to C_Initialize() are safe (think of the case of multiple libraries independently using pkcs#11 interfaces). The return should be treated as successful if the result is either CKR_OK or CKR_CRYPTOKI_ALREADY_INITIALIZED. -JZ