PK11SlotInfo *  slot   = PK11_GetSlotFromPrivateKey(serverKey);  ssl_GetSpecWriteLock(ss); pms = ssl3_GenerateRSAPMS(ss, ss->ssl3->prSpec, slot); ssl_ReleaseSpecWriteLock(ss);  PK11_FreeSlot(slot);
isTLS = (PRBool)(ss->ssl3.hs.kea_def->tls_keygen != 0);
ssl3_HandleRSAClientKeyExchange(sslSocket *ss,                                SSL3Opaque *b,				PRUint32 length,				SECKEYPrivateKey *serverKey){    PK11SymKey *      pms;    SECStatus         rv;    SECItem           enc_pms;    PORT_Assert( ssl_HaveRecvBufLock(ss) );    PORT_Assert( ssl_HaveSSL3HandshakeLock(ss) );    enc_pms.data = b;    enc_pms.len  = length;    if (ss->ssl3->prSpec->version > SSL_LIBRARY_VERSION_3_0) { /* isTLS */	PRInt32 kLen;	kLen = ssl3_ConsumeHandshakeNumber(ss, 2, &enc_pms.data, &enc_pms.len);	if (kLen < 0) {	    PORT_SetError(SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE);	    return SECFailure;	}	if ((unsigned)kLen < enc_pms.len) {	    enc_pms.len = kLen;	}    }    /*     * decrypt pms out of the incoming buffer     * Note: CKM_SSL3_PRE_MASTER_KEY_GEN is NOT the mechanism used to do      *	the unwrap.  Rather, it is the mechanism with which the unwrapped     *	pms will be used.     */    pms = PK11_PubUnwrapSymKey(serverKey, &enc_pms,			       CKM_SSL3_PRE_MASTER_KEY_GEN, CKA_DERIVE, 0);    if (pms != NULL) {	PRINT_BUF(60, (ss, "decrypted premaster secret:",		       PK11_GetKeyData(pms)->data,		       PK11_GetKeyData(pms)->len));    } else {	/* unwrap failed.  Generate a bogus pre-master secret and carry on. */	PK11SlotInfo *  slot   = PK11_GetSlotFromPrivateKey(serverKey);	ssl_GetSpecWriteLock(ss);	pms = ssl3_GenerateRSAPMS(ss, ss->ssl3->prSpec, slot);	ssl_ReleaseSpecWriteLock(ss);	PK11_FreeSlot(slot);    }    if (pms == NULL) {	/* last gasp.  */	ssl_MapLowLevelError(SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE);	return SECFailure;    }    rv = ssl3_InitPendingCipherSpec(ss,  pms);    PK11_FreeSymKey(pms);    if (rv != SECSuccess) {	SEND_ALERT	return SECFailure;	/* error code set by ssl3_InitPendingCipherSpec */    }    return SECSuccess;}