context->cipherInfo = &(pubKey->u.dsa);
context->cipherInfo = pubKey;
CK_RV NSC_VerifyInit(CK_SESSION_HANDLE hSession,			   CK_MECHANISM_PTR pMechanism,CK_OBJECT_HANDLE hKey) {    PK11Session *session;    PK11Object *key;    PK11SessionContext *context;    CK_KEY_TYPE key_type;    CK_RV crv = CKR_OK;    SECKEYLowPublicKey *pubKey;    PK11HashVerifyInfo *info = NULL;    /* Block Cipher MACing Algorithms use a different Context init method..*/    crv = pk11_InitCBCMac(hSession, pMechanism, hKey, CKA_VERIFY, PK11_VERIFY);    if (crv != CKR_FUNCTION_NOT_SUPPORTED) return crv;    session = pk11_SessionFromHandle(hSession);    if (session == NULL) return CKR_SESSION_HANDLE_INVALID;    crv = pk11_InitGeneric(session,&context,PK11_VERIFY,&key,hKey,&key_type,						CKO_PUBLIC_KEY,CKA_VERIFY);    if (crv != CKR_OK) {	pk11_FreeSession(session);	return crv;    }    context->multi = PR_FALSE;    switch(pMechanism->mechanism) {    case CKM_MD5_RSA_PKCS:        context->multi = PR_TRUE;	crv = pk11_doSubMD5(context);	if (crv != CKR_OK) break;	context->verify = (PK11Verify) pk11_hashCheckSign;	info = (PK11HashVerifyInfo *)PORT_Alloc(sizeof(PK11HashVerifyInfo));	if (info == NULL) {	   crv = CKR_HOST_MEMORY;	   break;	}	info->hashOid = SEC_OID_MD5;	goto finish_rsa;    case CKM_MD2_RSA_PKCS:        context->multi = PR_TRUE;	crv = pk11_doSubMD2(context);	if (crv != CKR_OK) break;	context->verify = (PK11Verify) pk11_hashCheckSign;	info = (PK11HashVerifyInfo *)PORT_Alloc(sizeof(PK11HashVerifyInfo));	if (info == NULL) {	   crv = CKR_HOST_MEMORY;	   break;	}	info->hashOid = SEC_OID_MD2;	goto finish_rsa;    case CKM_SHA1_RSA_PKCS:        context->multi = PR_TRUE;	crv = pk11_doSubSHA1(context);	if (crv != CKR_OK) break;	context->verify = (PK11Verify) pk11_hashCheckSign;	info = (PK11HashVerifyInfo *)PORT_Alloc(sizeof(PK11HashVerifyInfo));	if (info == NULL) {	   crv = CKR_HOST_MEMORY;	   break;	}	info->hashOid = SEC_OID_SHA1;	goto finish_rsa;    case CKM_RSA_PKCS:	context->verify = (PK11Verify) RSA_CheckSign;	goto finish_rsa;    case CKM_RSA_X_509:	context->verify = (PK11Verify) RSA_CheckSignRaw;finish_rsa:	if (key_type != CKK_RSA) {	    crv = CKR_KEY_TYPE_INCONSISTENT;	    break;	}	pubKey = pk11_GetPubKey(key,CKK_RSA);	if (pubKey == NULL) {	    crv = CKR_HOST_MEMORY;	    break;	}	if (info) {	    info->key = pubKey;	    context->cipherInfo = info;	    context->destroy = pk11_Space;	} else {	    context->cipherInfo = pubKey;	    context->destroy = pk11_Null;	}	break;    case CKM_DSA_SHA1:        context->multi = PR_TRUE;	crv = pk11_doSubSHA1(context);	if (crv != CKR_OK) break;	/* fall through */    case CKM_DSA:	if (key_type != CKK_DSA) {	    crv = CKR_KEY_TYPE_INCONSISTENT;	    break;	}	context->multi = PR_FALSE;	pubKey = pk11_GetPubKey(key,CKK_DSA);	if (pubKey == NULL) {	    crv = CKR_HOST_MEMORY;	    break;	}	context->cipherInfo = &(pubKey->u.dsa);	context->verify     = (PK11Verify) nsc_DSA_Verify_Stub;	context->destroy    = pk11_Null;	break;    case CKM_MD2_HMAC_GENERAL:	crv = pk11_doHMACInit(context,SEC_OID_MD2,key,				*(CK_ULONG *)pMechanism->pParameter);	break;    case CKM_MD2_HMAC:	crv = pk11_doHMACInit(context,SEC_OID_MD2,key,MD2_LENGTH);	break;    case CKM_MD5_HMAC_GENERAL:	crv = pk11_doHMACInit(context,SEC_OID_MD5,key,				*(CK_ULONG *)pMechanism->pParameter);	break;    case CKM_MD5_HMAC:	crv = pk11_doHMACInit(context,SEC_OID_MD5,key,MD5_LENGTH);	break;    case CKM_SHA_1_HMAC_GENERAL:	crv = pk11_doHMACInit(context,SEC_OID_SHA1,key,				*(CK_ULONG *)pMechanism->pParameter);	break;    case CKM_SHA_1_HMAC:	crv = pk11_doHMACInit(context,SEC_OID_SHA1,key,SHA1_LENGTH);	break;    case CKM_SSL3_MD5_MAC:	crv = pk11_doSSLMACInit(context,SEC_OID_MD5,key,					*(CK_ULONG *)pMechanism->pParameter);	break;    case CKM_SSL3_SHA1_MAC:	crv = pk11_doSSLMACInit(context,SEC_OID_SHA1,key,					*(CK_ULONG *)pMechanism->pParameter);	break;    case CKM_TLS_PRF_GENERAL:	crv = pk11_TLSPRFInit(context, key, key_type);    default:	crv = CKR_MECHANISM_INVALID;	break;    }    pk11_FreeObject(key);    if (crv != CKR_OK) {        PORT_Free(context);	pk11_FreeSession(session);	return crv;    }    pk11_SetContextByType(session, PK11_VERIFY, context);    pk11_FreeSession(session);    return CKR_OK;}