mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
fixed memory leak in cert signature verification at connect (Patch from Phenom). Also removed some unused variables reported by gcc
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6516 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0b0010ff59
commit
2b9a211184
@ -698,8 +698,8 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long days)
|
||||
EVP_MD_CTX ctx;
|
||||
unsigned char *p,*buf_in=NULL;
|
||||
unsigned char *buf_hashout=NULL,*buf_sigout=NULL;
|
||||
int inl=0,hashoutl=0,hashoutll=0;
|
||||
int sigoutl=0,sigoutll=0;
|
||||
int inl=0,hashoutl=0;
|
||||
int sigoutl=0;
|
||||
X509_ALGOR *a;
|
||||
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
@ -729,10 +729,10 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long days)
|
||||
inl=i2d(data,NULL);
|
||||
buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
|
||||
|
||||
hashoutll=hashoutl=EVP_MD_size(type);
|
||||
hashoutl=EVP_MD_size(type);
|
||||
buf_hashout=(unsigned char *)OPENSSL_malloc((unsigned int)hashoutl);
|
||||
|
||||
sigoutll=sigoutl=2048; // hashoutl; //EVP_PKEY_size(pkey);
|
||||
sigoutl=2048; // hashoutl; //EVP_PKEY_size(pkey);
|
||||
buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
|
||||
|
||||
if ((buf_in == NULL) || (buf_hashout == NULL) || (buf_sigout == NULL))
|
||||
@ -795,6 +795,12 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long days)
|
||||
/* XXX CLEANUP */
|
||||
err:
|
||||
/* cleanup */
|
||||
if(buf_in != NULL)
|
||||
OPENSSL_free(buf_in) ;
|
||||
if(buf_hashout != NULL)
|
||||
OPENSSL_free(buf_hashout) ;
|
||||
if(buf_sigout != NULL)
|
||||
OPENSSL_free(buf_sigout) ;
|
||||
std::cerr << "GPGAuthMgr::SignX509Req() err: FAIL" << std::endl;
|
||||
|
||||
return NULL;
|
||||
@ -840,8 +846,8 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509)
|
||||
EVP_MD_CTX ctx;
|
||||
unsigned char *p,*buf_in=NULL;
|
||||
unsigned char *buf_hashout=NULL,*buf_sigout=NULL;
|
||||
int inl=0,hashoutl=0,hashoutll=0;
|
||||
int sigoutl=0,sigoutll=0;
|
||||
int inl=0,hashoutl=0;
|
||||
int sigoutl=0;
|
||||
//X509_ALGOR *a;
|
||||
|
||||
EVP_MD_CTX_init(&ctx);
|
||||
@ -850,10 +856,10 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509)
|
||||
inl=i2d(data,NULL);
|
||||
buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
|
||||
|
||||
hashoutll=hashoutl=EVP_MD_size(type);
|
||||
hashoutl=EVP_MD_size(type);
|
||||
buf_hashout=(unsigned char *)OPENSSL_malloc((unsigned int)hashoutl);
|
||||
|
||||
sigoutll=sigoutl=2048; //hashoutl; //EVP_PKEY_size(pkey);
|
||||
sigoutl=2048; //hashoutl; //EVP_PKEY_size(pkey);
|
||||
buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
@ -915,6 +921,8 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509)
|
||||
|
||||
OPENSSL_free(buf_in) ;
|
||||
OPENSSL_free(buf_hashout) ;
|
||||
OPENSSL_free(buf_sigout) ;
|
||||
|
||||
return true;
|
||||
|
||||
err:
|
||||
@ -924,6 +932,8 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509)
|
||||
OPENSSL_free(buf_in) ;
|
||||
if(buf_hashout != NULL)
|
||||
OPENSSL_free(buf_hashout) ;
|
||||
if(buf_sigout != NULL)
|
||||
OPENSSL_free(buf_sigout) ;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user