Diff

Differences From Artifact [f66c56f731]:

To Artifact [47f51881b0]:


  3161   3161   		CACKEY_DEBUG_PRINTF("Error. Invalid slot requested (%lu), slot not currently active", slotID);
  3162   3162   
  3163   3163   		cackey_mutex_unlock(cackey_biglock);
  3164   3164   
  3165   3165   		return(CKR_SLOT_ID_INVALID);
  3166   3166   	}
  3167   3167   
         3168  +	pInfo->flags = CKF_REMOVABLE_DEVICE | CKF_HW_SLOT;
         3169  +
         3170  +	if (cackey_token_present(&cackey_slots[slotID]) == CACKEY_PCSC_S_TOKENPRESENT) {
         3171  +		pInfo->flags |= CKF_TOKEN_PRESENT;
         3172  +	}
         3173  +
         3174  +	bytes_to_copy = strlen(cackey_slots[slotID].pcsc_reader);
         3175  +	if (sizeof(pInfo->manufacturerID) < bytes_to_copy) {
         3176  +		bytes_to_copy = sizeof(pInfo->manufacturerID);
         3177  +	}
         3178  +	memcpy(pInfo->manufacturerID, cackey_slots[slotID].pcsc_reader, bytes_to_copy);
         3179  +
  3168   3180   	mutex_retval = cackey_mutex_unlock(cackey_biglock);
  3169   3181   	if (mutex_retval != 0) {
  3170   3182   		CACKEY_DEBUG_PRINTF("Error.  Unlocking failed.");
  3171   3183   
  3172   3184   		return(CKR_GENERAL_ERROR);
  3173   3185   	}
  3174   3186   
  3175   3187   	memset(pInfo->slotDescription, ' ', sizeof(pInfo->slotDescription));
  3176   3188   	memcpy(pInfo->slotDescription, slotDescription, sizeof(slotDescription) - 1);
  3177   3189   
  3178   3190   	memset(pInfo->manufacturerID, ' ', sizeof(pInfo->manufacturerID));
  3179   3191   
  3180         -	bytes_to_copy = strlen(cackey_slots[slotID].pcsc_reader);
  3181         -	if (sizeof(pInfo->manufacturerID) < bytes_to_copy) {
  3182         -		bytes_to_copy = sizeof(pInfo->manufacturerID);
  3183         -	}
  3184         -	memcpy(pInfo->manufacturerID, cackey_slots[slotID].pcsc_reader, bytes_to_copy);
  3185         -
  3186         -	pInfo->flags = CKF_REMOVABLE_DEVICE | CKF_HW_SLOT;
  3187         -
  3188         -	if (cackey_token_present(&cackey_slots[slotID]) == CACKEY_PCSC_S_TOKENPRESENT) {
  3189         -		pInfo->flags |= CKF_TOKEN_PRESENT;
  3190         -	}
  3191         -
  3192   3192   	pInfo->hardwareVersion.major = (cackey_getversion() >> 16) & 0xff;
  3193   3193   	pInfo->hardwareVersion.minor = (cackey_getversion() >> 8) & 0xff;
  3194   3194   
  3195   3195   	pInfo->firmwareVersion.major = 0x00;
  3196   3196   	pInfo->firmwareVersion.minor = 0x00;
  3197   3197   
  3198   3198   	CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK);