ssl3->crSpec = ssl3->cwSpec = &ssl3->specs[0]; ssl3->prSpec = ssl3->pwSpec = &ssl3->specs[1]; ssl3->hs.rehandshake = PR_FALSE; ssl3_InitCipherSpec(ss, ssl3->crSpec); ssl3_InitCipherSpec(ss, ssl3->prSpec);
ss->ssl3.crSpec = ss->ssl3.cwSpec = &ss->ssl3.specs[0]; ss->ssl3.prSpec = ss->ssl3.pwSpec = &ss->ssl3.specs[1]; ss->ssl3.hs.rehandshake = PR_FALSE; ssl3_InitCipherSpec(ss, ss->ssl3.crSpec); ssl3_InitCipherSpec(ss, ss->ssl3.prSpec);
ssl3_InitState(sslSocket *ss){    ssl3State *  ssl3 = NULL;    PK11Context *md5  = NULL;    PK11Context *sha  = NULL;    SECStatus    rv;    PORT_Assert( ssl_HaveSSL3HandshakeLock(ss));    /* reinitialization for renegotiated sessions XXX */    if (ss->ssl3 != NULL)	return SECSuccess;    ssl3 = PORT_ZNew(ssl3State); /* zero on purpose */    if (ssl3 == NULL)	return SECFailure;	/* PORT_ZAlloc has set memory error code. */    /* note that entire HandshakeState is zero, including the buffer */    ssl3->policy = SSL_ALLOWED;    ssl_GetSpecWriteLock(ss);    ssl3->crSpec = ssl3->cwSpec = &ssl3->specs[0];    ssl3->prSpec = ssl3->pwSpec = &ssl3->specs[1];    ssl3->hs.rehandshake = PR_FALSE;    ssl3_InitCipherSpec(ss, ssl3->crSpec);    ssl3_InitCipherSpec(ss, ssl3->prSpec);    ssl3->hs.ws = (ss->sec.isServer) ? wait_client_hello : wait_server_hello;    ssl_ReleaseSpecWriteLock(ss);    /*     * note: We should probably lookup an SSL3 slot for these     * handshake hashes in hopes that we wind up with the same slots     * that the master secret will wind up in ...     */    SSL_TRC(30,("%d: SSL3[%d]: start handshake hashes", SSL_GETPID(), ss->fd));    ssl3->hs.md5 = md5 = PK11_CreateDigestContext(SEC_OID_MD5);    if (md5 == NULL) {	ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE);	goto loser;    }    rv = PK11_DigestBegin(ssl3->hs.md5);    if (rv != SECSuccess) {	ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE);	goto loser;    }    sha = ssl3->hs.sha = PK11_CreateDigestContext(SEC_OID_SHA1);    if (sha == NULL) {	ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE);	goto loser;    }    rv = PK11_DigestBegin(ssl3->hs.sha);    if (rv != SECSuccess) {	ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE);	goto loser;    }    /* Don't hide this from the rest of the world any more. */    ss->ssl3 = ssl3;    return SECSuccess;loser:    if (md5 != NULL) PK11_DestroyContext(md5, PR_TRUE);    if (sha != NULL) PK11_DestroyContext(sha, PR_TRUE);    if (ssl3 != NULL) PORT_Free(ssl3);    return SECFailure;}