Memory leak per TLS session removed. Call cleanup after each finalization.

This commit is contained in:
Alexandre Dulaunoy 2015-02-14 14:41:12 +01:00
parent 326e7a3eab
commit ac8ca39406

View file

@ -589,12 +589,14 @@ static int tls_P_hash(ssl,secret,seed,md,out)
HMAC_Init(&hm,secret->data,secret->len,md); HMAC_Init(&hm,secret->data,secret->len,md);
HMAC_Update(&hm,A,A_l); HMAC_Update(&hm,A,A_l);
HMAC_Final(&hm,_A,&A_l); HMAC_Final(&hm,_A,&A_l);
HMAC_cleanup(&hm);
A=_A; A=_A;
HMAC_Init(&hm,secret->data,secret->len,md); HMAC_Init(&hm,secret->data,secret->len,md);
HMAC_Update(&hm,A,A_l); HMAC_Update(&hm,A,A_l);
HMAC_Update(&hm,seed->data,seed->len); HMAC_Update(&hm,seed->data,seed->len);
HMAC_Final(&hm,tmp,&tmp_l); HMAC_Final(&hm,tmp,&tmp_l);
HMAC_cleanup(&hm);
tocpy=MIN(left,tmp_l); tocpy=MIN(left,tmp_l);
memcpy(ptr,tmp,tocpy); memcpy(ptr,tmp,tocpy);
@ -602,8 +604,6 @@ static int tls_P_hash(ssl,secret,seed,md,out)
left-=tocpy; left-=tocpy;
} }
HMAC_cleanup(&hm);
CRDUMPD("P_hash out",out); CRDUMPD("P_hash out",out);
return (0); return (0);