ok=1;
;
static int ssl_set_cert(CERT *c, X509 *x)	{	EVP_PKEY *pkey;	int i,ok=0,bad=0;	pkey=X509_get_pubkey(x);	if (pkey == NULL)		{		SSLerr(SSL_F_SSL_SET_CERT,SSL_R_X509_LIB);		return(0);		}	i=ssl_cert_type(x,pkey);	if (i < 0)		{		SSLerr(SSL_F_SSL_SET_CERT,SSL_R_UNKNOWN_CERTIFICATE_TYPE);		EVP_PKEY_free(pkey);		return(0);		}	if (c->pkeys[i].privatekey != NULL)		{		EVP_PKEY_copy_parameters(pkey,c->pkeys[i].privatekey);		ERR_clear_error();#ifndef OPENSSL_NO_RSA		/* Don't check the public/private key, this is mostly		 * for smart cards. */		if ((c->pkeys[i].privatekey->type == EVP_PKEY_RSA) &&			(RSA_flags(c->pkeys[i].privatekey->pkey.rsa) &			 RSA_METHOD_FLAG_NO_CHECK))			 ok=1;		else#endif		{		if (!X509_check_private_key(x,c->pkeys[i].privatekey))			{			if ((i == SSL_PKEY_DH_RSA) || (i == SSL_PKEY_DH_DSA))				{				i=(i == SSL_PKEY_DH_RSA)?					SSL_PKEY_DH_DSA:SSL_PKEY_DH_RSA;				if (c->pkeys[i].privatekey == NULL)					ok=1;				else					{					if (!X509_check_private_key(x,						c->pkeys[i].privatekey))						bad=1;					else						ok=1;					}				}			else				bad=1;			}		else			ok=1;		} /* OPENSSL_NO_RSA */		}	else		ok=1;	EVP_PKEY_free(pkey);	if (bad)		{		EVP_PKEY_free(c->pkeys[i].privatekey);		c->pkeys[i].privatekey=NULL;		}	if (c->pkeys[i].x509 != NULL)		X509_free(c->pkeys[i].x509);	CRYPTO_add(&x->references,1,CRYPTO_LOCK_X509);	c->pkeys[i].x509=x;	c->key= &(c->pkeys[i]);	c->valid=0;	return(1);	}