PK11Context * md5 		= NULL; PK11Context * sha 		= NULL;
ssl3_ComputeDHKeyHash(SECItem dh_p, SECItem dh_g, SECItem dh_Ys,			     SSL3Random *client_rand, SSL3Random *server_rand,			     SSL3Hashes *hashes){    PK11Context * md5 		= NULL;    PK11Context * sha 		= NULL;    PRUint8     * hashBuf;    PRUint8     * pBuf;    SECStatus     rv 		= SECSuccess;    unsigned int  outLen;    unsigned int  bufLen;    PRUint8       buf[2*SSL3_RANDOM_LENGTH + 2 + 4096/8 + 2 + 4096/8];    bufLen = 2*SSL3_RANDOM_LENGTH + 2 + dh_p.len + 2 + dh_g.len + 2 + dh_Ys.len;    if (bufLen <= sizeof buf) {    	hashBuf = buf;    } else {    	hashBuf = PORT_Alloc(bufLen);	if (!hashBuf) {	    return SECFailure;	}    }    md5 = PK11_CreateDigestContext(SEC_OID_MD5);    if (md5 == NULL) {	ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE);	rv = SECFailure; /* Caller must set hiLevel error code. */	goto done;    }    sha = PK11_CreateDigestContext(SEC_OID_SHA1);    if (sha == NULL) {	ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE);	rv = SECFailure; /* Caller must set hiLevel error code. */	goto done;    }    memcpy(hashBuf, client_rand, SSL3_RANDOM_LENGTH);     	pBuf = hashBuf + SSL3_RANDOM_LENGTH;    memcpy(pBuf, server_rand, SSL3_RANDOM_LENGTH);    	pBuf += SSL3_RANDOM_LENGTH;    pBuf[0]  = (PRUint8)(dh_p.len >> 8);    pBuf[1]  = (PRUint8)(dh_p.len);    	pBuf += 2;    memcpy(pBuf, dh_p.data, dh_p.len);    	pBuf += dh_p.len;    pBuf[0] = (PRUint8)(dh_g.len >> 8);    pBuf[1] = (PRUint8)(dh_g.len);    	pBuf += 2;    memcpy(pBuf, dh_g.data, dh_g.len);    	pBuf += dh_g.len;    pBuf[0] = (PRUint8)(dh_Ys.len >> 8);    pBuf[1] = (PRUint8)(dh_Ys.len);    	pBuf += 2;    memcpy(pBuf, dh_Ys.data, dh_Ys.len);    	pBuf += dh_Ys.len;    PORT_Assert((unsigned int)(pBuf - hashBuf) == bufLen);    rv  = PK11_DigestBegin(md5);    rv |= PK11_DigestOp(md5, hashBuf, bufLen);    rv |= PK11_DigestFinal(md5, hashes->md5, &outLen, MD5_LENGTH);    PORT_Assert(rv != SECSuccess || outLen == MD5_LENGTH);    if (rv != SECSuccess) {	ssl_MapLowLevelError(SSL_ERROR_MD5_DIGEST_FAILURE);    	rv = SECFailure;	goto done;    }    rv  = PK11_DigestBegin(sha);    rv |= PK11_DigestOp(sha, hashBuf, bufLen);    rv |= PK11_DigestFinal(sha, hashes->sha, &outLen, SHA1_LENGTH);    PORT_Assert(rv != SECSuccess || outLen == SHA1_LENGTH);    if (rv != SECSuccess) {	ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE);    	rv = SECFailure;	goto done;    }    PRINT_BUF(95, (NULL, "DHkey hash: ", hashBuf, bufLen));    PRINT_BUF(95, (NULL, "DHkey hash: MD5 result", hashes->md5, MD5_LENGTH));    PRINT_BUF(95, (NULL, "DHkey hash: SHA1 result", hashes->sha, SHA1_LENGTH));done:    if (md5 != NULL) PK11_DestroyContext(md5, PR_TRUE);    if (sha != NULL) PK11_DestroyContext(sha, PR_TRUE);    if (hashBuf != buf && hashBuf != NULL)    	PORT_Free(hashBuf);    return rv;}