}
int tls1_setup_key_block(SSL *s)	{	unsigned char *p1,*p2;	const EVP_CIPHER *c;	const EVP_MD *hash;	int num;	SSL_COMP *comp;#ifdef KSSL_DEBUG	printf ("tls1_setup_key_block()\n");#endif	/* KSSL_DEBUG */	if (s->s3->tmp.key_block_length != 0)		return(1);	if (!ssl_cipher_get_evp(s->session,&c,&hash,&comp))		{		SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,SSL_R_CIPHER_OR_HASH_UNAVAILABLE);		return(0);		}	s->s3->tmp.new_sym_enc=c;	s->s3->tmp.new_hash=hash;	num=EVP_CIPHER_key_length(c)+EVP_MD_size(hash)+EVP_CIPHER_iv_length(c);	num*=2;	ssl3_cleanup_key_block(s);	if ((p1=(unsigned char *)OPENSSL_malloc(num)) == NULL)		goto err;	if ((p2=(unsigned char *)OPENSSL_malloc(num)) == NULL)		goto err;	s->s3->tmp.key_block_length=num;	s->s3->tmp.key_block=p1;#ifdef TLS_DEBUGprintf("client random\n");{ int z; for (z=0; z<SSL3_RANDOM_SIZE; z++) printf("%02X%c",s->s3->client_random[z],((z+1)%16)?' ':'\n'); }printf("server random\n");{ int z; for (z=0; z<SSL3_RANDOM_SIZE; z++) printf("%02X%c",s->s3->server_random[z],((z+1)%16)?' ':'\n'); }printf("pre-master\n");{ int z; for (z=0; z<s->session->master_key_length; z++) printf("%02X%c",s->session->master_key[z],((z+1)%16)?' ':'\n'); }#endif	tls1_generate_key_block(s,p1,p2,num);	memset(p2,0,num);	OPENSSL_free(p2);#ifdef TLS_DEBUGprintf("\nkey block\n");{ int z; for (z=0; z<num; z++) printf("%02X%c",p1[z],((z+1)%16)?' ':'\n'); }#endif	if (!(s->options & SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS))		{		/* enable vulnerability countermeasure for CBC ciphers with		 * known-IV problem (http://www.openssl.org/~bodo/tls-cbc.txt)		 */		s->s3->need_empty_fragments = 1;#ifndef NO_RC4		if ((s->session->cipher != NULL) && ((s->session->cipher->algorithms & SSL_ENC_MASK) == SSL_RC4))			s->s3->need_empty_fragments = 0;#endif		}			return(1);err:	SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK,ERR_R_MALLOC_FAILURE);	return(0);	}