pInfo->ulMinPinLen = 0; if (slot->minimumPinLen > 0) { pInfo->ulMinPinLen = (CK_ULONG)slot->minimumPinLen; }
pInfo->ulMinPinLen = (CK_ULONG)slot->minimumPinLen;
CK_RV NSC_GetTokenInfo(CK_SLOT_ID slotID,CK_TOKEN_INFO_PTR pInfo){    SFTKSlot *slot = sftk_SlotFromID(slotID);    NSSLOWKEYDBHandle *handle;    if (slot == NULL) return CKR_SLOT_ID_INVALID;    PORT_Memcpy(pInfo->manufacturerID,manufacturerID,32);    PORT_Memcpy(pInfo->model,"NSS 3           ",16);    PORT_Memcpy(pInfo->serialNumber,"0000000000000000",16);    pInfo->ulMaxSessionCount = 0; /* arbitrarily large */    pInfo->ulSessionCount = slot->sessionCount;    pInfo->ulMaxRwSessionCount = 0; /* arbitarily large */    pInfo->ulRwSessionCount = slot->rwSessionCount;    pInfo->firmwareVersion.major = 0;    pInfo->firmwareVersion.minor = 0;    PORT_Memcpy(pInfo->label,slot->tokDescription,32);    handle = slot->keyDB;    if (handle == NULL) {        pInfo->flags= CKF_RNG | CKF_WRITE_PROTECTED | CKF_THREAD_SAFE;	pInfo->ulMaxPinLen = 0;	pInfo->ulMinPinLen = 0;	pInfo->ulTotalPublicMemory = 0;	pInfo->ulFreePublicMemory = 0;	pInfo->ulTotalPrivateMemory = 0;	pInfo->ulFreePrivateMemory = 0;	pInfo->hardwareVersion.major = 4;	pInfo->hardwareVersion.minor = 0;    } else {	/*	 * we have three possible states which we may be in:	 *   (1) No DB password has been initialized. This also means we	 *   have no keys in the key db.	 *   (2) Password initialized to NULL. This means we have keys, but	 *   the user has chosen not use a password.	 *   (3) Finally we have an initialized password whicn is not NULL, and	 *   we will need to prompt for it.	 */	if (nsslowkey_HasKeyDBPassword(handle) == SECFailure) {	    pInfo->flags = CKF_THREAD_SAFE | CKF_LOGIN_REQUIRED;	} else if (!sftk_checkNeedLogin(slot)) {	    pInfo->flags = CKF_THREAD_SAFE | CKF_USER_PIN_INITIALIZED;	} else {	    pInfo->flags = CKF_THREAD_SAFE | 				CKF_LOGIN_REQUIRED | CKF_USER_PIN_INITIALIZED;	}	pInfo->ulMaxPinLen = SFTK_MAX_PIN;	pInfo->ulMinPinLen = 0;	if (slot->minimumPinLen > 0) {	    pInfo->ulMinPinLen = (CK_ULONG)slot->minimumPinLen;	}	pInfo->ulTotalPublicMemory = 1;	pInfo->ulFreePublicMemory = 1;	pInfo->ulTotalPrivateMemory = 1;	pInfo->ulFreePrivateMemory = 1;	pInfo->hardwareVersion.major = CERT_DB_FILE_VERSION;	pInfo->hardwareVersion.minor = handle->version;    }    return CKR_OK;}