Diff

Differences From Artifact [09dbb17ef5]:

To Artifact [498d154f21]:


  3856   3856   	if (*pulCount < 2) {
  3857   3857   		CACKEY_DEBUG_PRINTF("Error.  Buffer too small.");
  3858   3858   
  3859   3859   		return(CKR_BUFFER_TOO_SMALL);
  3860   3860   	}
  3861   3861   
  3862   3862   	pMechanismList[0] = CKM_RSA_PKCS;
  3863         -	pMechanismList[1] = CKM_SHA1_RSA_PKCS;
  3864         -	*pulCount = 2;
         3863  +	*pulCount = 1;
  3865   3864   
  3866   3865   	CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK);
  3867   3866   
  3868   3867   	return(CKR_OK);
  3869   3868   }
  3870   3869   
  3871   3870   CK_DEFINE_FUNCTION(CK_RV, C_GetMechanismInfo)(CK_SLOT_ID slotID, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo) {
................................................................................
  3909   3908   	mutex_retval = cackey_mutex_unlock(cackey_biglock);
  3910   3909   	if (mutex_retval != 0) {
  3911   3910   		CACKEY_DEBUG_PRINTF("Error.  Unlocking failed.");
  3912   3911   
  3913   3912   		return(CKR_GENERAL_ERROR);
  3914   3913   	}
  3915   3914   
  3916         -	/* XXX: This is untested, and further I'm not really sure if this is correct. */
  3917   3915   	switch (type) {
  3918   3916   		case CKM_RSA_PKCS:
  3919   3917   			pInfo->ulMinKeySize = 512;
  3920   3918   			pInfo->ulMaxKeySize = 8192;
  3921   3919   			pInfo->flags = CKF_HW | CKF_ENCRYPT | CKF_DECRYPT | CKF_SIGN | CKF_VERIFY;
  3922   3920   			break;
  3923         -		case CKM_RSA_X_509:
  3924         -			pInfo->ulMinKeySize = 512;
  3925         -			pInfo->ulMaxKeySize = 8192;
  3926         -			pInfo->flags = CKF_HW | CKF_ENCRYPT | CKF_DECRYPT | CKF_SIGN | CKF_VERIFY;
  3927         -			break;
  3928         -		case CKM_SHA1_RSA_PKCS:
  3929         -			pInfo->ulMinKeySize = 512;
  3930         -			pInfo->ulMaxKeySize = 8192;
  3931         -			pInfo->flags = CKF_HW | CKF_SIGN | CKF_VERIFY;
  3932         -			break;
  3933   3921   	}
  3934   3922   
  3935   3923   	CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK);
  3936   3924   
  3937   3925   	return(CKR_OK);
  3938   3926   }
  3939   3927   
................................................................................
  5516   5504   
  5517   5505   	if (pMechanism == NULL) {
  5518   5506   		CACKEY_DEBUG_PRINTF("Error. pMechanism is NULL.");
  5519   5507   
  5520   5508   		return(CKR_ARGUMENTS_BAD);
  5521   5509   	}
  5522   5510   
  5523         -	if (pMechanism->mechanism != CKM_RSA_PKCS && pMechanism->mechanism != CKM_SHA1_RSA_PKCS) {
  5524         -		CACKEY_DEBUG_PRINTF("Error. pMechanism->mechanism not specified as CKM_RSA_PKCS or CKM_SHA1_RSA_PKCS");
         5511  +	if (pMechanism->mechanism != CKM_RSA_PKCS) {
         5512  +		CACKEY_DEBUG_PRINTF("Error. pMechanism->mechanism not specified as CKM_RSA_PKCS");
  5525   5513   
  5526   5514   		return(CKR_MECHANISM_PARAM_INVALID);
  5527   5515   	}
  5528   5516   
  5529   5517   	if (hSession == 0 || hSession >= (sizeof(cackey_sessions) / sizeof(cackey_sessions[0]))) {
  5530   5518   		CACKEY_DEBUG_PRINTF("Error.  Session out of range.");
  5531   5519   		
................................................................................
  5745   5733   			}
  5746   5734   
  5747   5735   			memcpy(cackey_sessions[hSession].sign_buf + cackey_sessions[hSession].sign_bufused, pPart, ulPartLen);
  5748   5736   
  5749   5737   			cackey_sessions[hSession].sign_bufused += ulPartLen;
  5750   5738   
  5751   5739   			break;
  5752         -		case CKM_SHA1_RSA_PKCS:
  5753         -			/* XXX: Accumulate into a SHA1 hash */
  5754         -			cackey_mutex_unlock(cackey_biglock);
  5755         -
  5756         -			CACKEY_DEBUG_PRINTF("Returning CKR_FUNCTION_NOT_SUPPORTED (%i)", CKR_FUNCTION_NOT_SUPPORTED);
  5757         -
  5758         -			return(CKR_FUNCTION_NOT_SUPPORTED);
  5759         -			break;
  5760   5740   	}
  5761   5741   
  5762   5742   	mutex_retval = cackey_mutex_unlock(cackey_biglock);
  5763   5743   	if (mutex_retval != 0) {
  5764   5744   		CACKEY_DEBUG_PRINTF("Error.  Unlocking failed.");
  5765   5745   
  5766   5746   		return(CKR_GENERAL_ERROR);
................................................................................
  5871   5851   
  5872   5852   				*pulSignatureLen = sigbuflen;
  5873   5853   
  5874   5854   				retval = CKR_OK;
  5875   5855   			}
  5876   5856   
  5877   5857   			break;
  5878         -		case CKM_SHA1_RSA_PKCS:
  5879         -			/* XXX: Accumulate into a SHA1 hash */
  5880         -			cackey_mutex_unlock(cackey_biglock);
  5881         -
  5882         -			CACKEY_DEBUG_PRINTF("Returning CKR_FUNCTION_NOT_SUPPORTED (%i)", CKR_FUNCTION_NOT_SUPPORTED);
  5883         -
  5884         -			return(CKR_FUNCTION_NOT_SUPPORTED);
  5885         -			break;
  5886   5858   	}
  5887   5859   
  5888   5860   	if (terminate_sign) {
  5889   5861   		if (cackey_sessions[hSession].sign_buf) {
  5890   5862   			free(cackey_sessions[hSession].sign_buf);
  5891   5863   		}
  5892   5864