+ if (ctx->protocolSide == kSSLClientSide && ctx->peerCert && !ctx->allowServerIdentityChange) {
+ // Do not accept a different server cert during renegotiation unless allowed.
+ if((certChain!=NULL) && !CFEqual(ctx->peerCert, certChain))
+ {
+ CFRelease(certChain);
+ sslErrorLog("Illegal server identity change during renegotiation\n");
+ return errSSLProtocol;
+ }
+ }
+
+ // Replace old cert with new cert.
+ if (ctx->peerCert) {
+ sslDebugLog("SSLProcessCertificate: releasing existing cert chain\n");
+ CFRelease(ctx->peerCert);
+ }
+
+ ctx->peerCert = certChain;
+