PORT_Assert( ssl_HaveXmitBufLock(ss)); PORT_Assert( ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss)); PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
ssl3_SendCertificateRequest(sslSocket *ss){    SECItem *      name;    CERTDistNames *ca_list;const uint8 *      certTypes;    SECItem *      names	= NULL;    SECStatus      rv;    int            length;    int            i;    int            calen	= 0;    int            nnames	= 0;    int            certTypesLength;    SSL_TRC(3, ("%d: SSL3[%d]: send certificate_request handshake",		SSL_GETPID(), ss->fd));    PORT_Assert( ssl_HaveXmitBufLock(ss));    PORT_Assert( ssl_HaveSSL3HandshakeLock(ss));    /* ssl3->ca_list is initialized to NULL, and never changed. */    ca_list = ss->ssl3->ca_list;    if (!ca_list) {	ca_list = ssl3_server_ca_list;    }    if (ca_list != NULL) {	names = ca_list->names;	nnames = ca_list->nnames;    }    if (!nnames) {	PORT_SetError(SSL_ERROR_NO_TRUSTED_SSL_CLIENT_CA);	return SECFailure;    }    for (i = 0, name = names; i < nnames; i++, name++) {	calen += 2 + name->len;    }    certTypes       = certificate_types;    certTypesLength = sizeof certificate_types;    length = 1 + certTypesLength + 2 + calen;    rv = ssl3_AppendHandshakeHeader(ss, certificate_request, length);    if (rv != SECSuccess) {	return rv; 		/* err set by AppendHandshake. */    }    rv = ssl3_AppendHandshakeVariable(ss, certTypes, certTypesLength, 1);    if (rv != SECSuccess) {	return rv; 		/* err set by AppendHandshake. */    }    rv = ssl3_AppendHandshakeNumber(ss, calen, 2);    if (rv != SECSuccess) {	return rv; 		/* err set by AppendHandshake. */    }    for (i = 0, name = names; i < nnames; i++, name++) {	rv = ssl3_AppendHandshakeVariable(ss, name->data, name->len, 2);	if (rv != SECSuccess) {	    return rv; 		/* err set by AppendHandshake. */	}    }    return SECSuccess;}