mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-04-28 02:34:40 +00:00
Seek out and destroy another evil cast.
This commit is contained in:
parent
1749d8a039
commit
51ca375e7e
@ -336,7 +336,7 @@ static int ebcdic_write(BIO *b, char *in, int inl)
|
||||
num = num + num; /* double the size */
|
||||
if (num < inl)
|
||||
num = inl;
|
||||
Free((char*)wbuf);
|
||||
Free(wbuf);
|
||||
wbuf=(EBCDIC_OUTBUFF *)Malloc(sizeof(EBCDIC_OUTBUFF) + num);
|
||||
|
||||
wbuf->alloced = num;
|
||||
|
@ -173,7 +173,7 @@ ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, unsigned char **pp,
|
||||
s=NULL;
|
||||
|
||||
ret->length=(int)len;
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
ret->data=s;
|
||||
ret->type=V_ASN1_BIT_STRING;
|
||||
if (a != NULL) (*a)=ret;
|
||||
|
@ -124,7 +124,7 @@ ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, unsigned char **pp,
|
||||
else
|
||||
s=NULL;
|
||||
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
ret->length=(int)len;
|
||||
ret->data=s;
|
||||
ret->type=tag;
|
||||
@ -218,7 +218,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
|
||||
{
|
||||
if ((ret->length < len) || (ret->data == NULL))
|
||||
{
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
s=(unsigned char *)Malloc((int)len + 1);
|
||||
if (s == NULL)
|
||||
{
|
||||
@ -235,7 +235,7 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, unsigned char **pp, long length,
|
||||
else
|
||||
{
|
||||
s=NULL;
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
}
|
||||
|
||||
ret->length=(int)len;
|
||||
|
@ -78,6 +78,6 @@ char *ASN1_dup(int (*i2d)(), char *(*d2i)(), char *x)
|
||||
i=i2d(x,&p);
|
||||
p= b;
|
||||
ret=d2i(NULL,&p,i);
|
||||
Free((char *)b);
|
||||
Free(b);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, unsigned char **pp,
|
||||
p+=len;
|
||||
}
|
||||
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
ret->data=s;
|
||||
ret->length=(int)len;
|
||||
if (a != NULL) (*a)=ret;
|
||||
@ -242,7 +242,7 @@ int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
|
||||
if (a->length < (sizeof(long)+1))
|
||||
{
|
||||
if (a->data != NULL)
|
||||
Free((char *)a->data);
|
||||
Free(a->data);
|
||||
if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
|
||||
memset((char *)a->data,0,sizeof(long)+1);
|
||||
}
|
||||
|
@ -115,5 +115,5 @@ void ASN1_HEADER_free(ASN1_HEADER *a)
|
||||
M_ASN1_OCTET_STRING_free(a->header);
|
||||
if (a->meth != NULL)
|
||||
a->meth->destroy(a->data);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
@ -108,6 +108,6 @@ int ASN1_i2d_bio(int (*i2d)(), BIO *out, unsigned char *x)
|
||||
j+=i;
|
||||
n-=i;
|
||||
}
|
||||
Free((char *)b);
|
||||
Free(b);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, unsigned char **pp,
|
||||
memcpy(s,p,(int)len);
|
||||
}
|
||||
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
ret->data=s;
|
||||
ret->length=(int)len;
|
||||
if (a != NULL) (*a)=ret;
|
||||
@ -317,7 +317,7 @@ ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, unsigned char **pp,
|
||||
p+=len;
|
||||
}
|
||||
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
ret->data=s;
|
||||
ret->length=(int)len;
|
||||
if (a != NULL) (*a)=ret;
|
||||
@ -340,7 +340,7 @@ int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
|
||||
if (a->length < (sizeof(long)+1))
|
||||
{
|
||||
if (a->data != NULL)
|
||||
Free((char *)a->data);
|
||||
Free(a->data);
|
||||
if ((a->data=(unsigned char *)Malloc(sizeof(long)+1)) != NULL)
|
||||
memset((char *)a->data,0,sizeof(long)+1);
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp,
|
||||
}
|
||||
if ((ret->data == NULL) || (ret->length < len))
|
||||
{
|
||||
if (ret->data != NULL) Free((char *)ret->data);
|
||||
if (ret->data != NULL) Free(ret->data);
|
||||
ret->data=(unsigned char *)Malloc(len ? (int)len : 1);
|
||||
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
|
||||
if (ret->data == NULL)
|
||||
|
@ -129,7 +129,7 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
ASN1err(ASN1_F_ASN1_SIGN,ERR_R_EVP_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (signature->data != NULL) Free((char *)signature->data);
|
||||
if (signature->data != NULL) Free(signature->data);
|
||||
signature->data=buf_out;
|
||||
buf_out=NULL;
|
||||
signature->length=outl;
|
||||
@ -141,8 +141,8 @@ int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2,
|
||||
err:
|
||||
memset(&ctx,0,sizeof(ctx));
|
||||
if (buf_in != NULL)
|
||||
{ memset((char *)buf_in,0,(unsigned int)inl); Free((char *)buf_in); }
|
||||
{ memset((char *)buf_in,0,(unsigned int)inl); Free(buf_in); }
|
||||
if (buf_out != NULL)
|
||||
{ memset((char *)buf_out,0,outll); Free((char *)buf_out); }
|
||||
{ memset((char *)buf_out,0,outll); Free(buf_out); }
|
||||
return(outl);
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ void ASN1_TYPE_free(ASN1_TYPE *a)
|
||||
{
|
||||
if (a == NULL) return;
|
||||
ASN1_TYPE_component_free(a);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int ASN1_TYPE_get(ASN1_TYPE *a)
|
||||
|
@ -101,7 +101,7 @@ int ASN1_verify(int (*i2d)(), X509_ALGOR *a, ASN1_BIT_STRING *signature,
|
||||
EVP_VerifyUpdate(&ctx,(unsigned char *)buf_in,inl);
|
||||
|
||||
memset(buf_in,0,(unsigned int)inl);
|
||||
Free((char *)buf_in);
|
||||
Free(buf_in);
|
||||
|
||||
if (EVP_VerifyFinal(&ctx,(unsigned char *)signature->data,
|
||||
(unsigned int)signature->length,pkey) <= 0)
|
||||
|
@ -381,8 +381,8 @@ ASN1_STRING *ASN1_STRING_type_new(int type)
|
||||
void ASN1_STRING_free(ASN1_STRING *a)
|
||||
{
|
||||
if (a == NULL) return;
|
||||
if (a->data != NULL) Free((char *)a->data);
|
||||
Free((char *)a);
|
||||
if (a->data != NULL) Free(a->data);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int ASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b)
|
||||
|
@ -161,7 +161,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size)
|
||||
if (sp == NULL)
|
||||
{
|
||||
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
|
||||
if (s != NULL) Free((char *)s);
|
||||
if (s != NULL) Free(s);
|
||||
goto err;
|
||||
}
|
||||
s=sp;
|
||||
|
@ -168,7 +168,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
|
||||
if (sp == NULL)
|
||||
{
|
||||
ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
|
||||
if (s != NULL) Free((char *)s);
|
||||
if (s != NULL) Free(s);
|
||||
goto err;
|
||||
}
|
||||
s=sp;
|
||||
|
@ -166,7 +166,7 @@ int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size)
|
||||
if (sp == NULL)
|
||||
{
|
||||
ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE);
|
||||
if (s != NULL) Free((char *)s);
|
||||
if (s != NULL) Free(s);
|
||||
goto err;
|
||||
}
|
||||
s=sp;
|
||||
|
@ -118,7 +118,7 @@ int i2d_DHparams(DH *a, unsigned char **pp)
|
||||
bs.length=BN_bn2bin(num[i],bs.data);
|
||||
i2d_ASN1_INTEGER(&bs,&p);
|
||||
}
|
||||
Free((char *)bs.data);
|
||||
Free(bs.data);
|
||||
ret=t;
|
||||
err:
|
||||
if (num[2] != NULL) BN_free(num[2]);
|
||||
|
@ -107,7 +107,7 @@ int i2d_DSAparams(DSA *a, unsigned char **pp)
|
||||
bs.length=BN_bn2bin(num[i],bs.data);
|
||||
i2d_ASN1_INTEGER(&bs,&p);
|
||||
}
|
||||
Free((char *)bs.data);
|
||||
Free(bs.data);
|
||||
ret=t;
|
||||
err:
|
||||
*pp=p;
|
||||
|
@ -119,7 +119,7 @@ int i2d_RSAPrivateKey(RSA *a, unsigned char **pp)
|
||||
bs.length=BN_bn2bin(num[i],bs.data);
|
||||
i2d_ASN1_INTEGER(&bs,&p);
|
||||
}
|
||||
Free((char *)bs.data);
|
||||
Free(bs.data);
|
||||
*pp=p;
|
||||
return(t);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ int i2d_RSAPublicKey(RSA *a, unsigned char **pp)
|
||||
bs.length=BN_bn2bin(num[i],bs.data);
|
||||
i2d_ASN1_INTEGER(&bs,&p);
|
||||
}
|
||||
Free((char *)bs.data);
|
||||
Free(bs.data);
|
||||
*pp=p;
|
||||
return(t);
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ int i2d_DSAPrivateKey(DSA *a, unsigned char **pp)
|
||||
bs.length=BN_bn2bin(num[i],bs.data);
|
||||
i2d_ASN1_INTEGER(&bs,&p);
|
||||
}
|
||||
Free((char *)bs.data);
|
||||
Free(bs.data);
|
||||
*pp=p;
|
||||
return(t);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ int i2d_DSAPublicKey(DSA *a, unsigned char **pp)
|
||||
bs.length=BN_bn2bin(num[i],bs.data);
|
||||
i2d_ASN1_INTEGER(&bs,&p);
|
||||
}
|
||||
Free((char *)bs.data);
|
||||
Free(bs.data);
|
||||
*pp=p;
|
||||
if(all) return(t);
|
||||
else return(tot);
|
||||
|
@ -139,7 +139,7 @@ int i2d_Netscape_RSA(RSA *a, unsigned char **pp, int (*cb)())
|
||||
}
|
||||
|
||||
if (pkey->private_key->data != NULL)
|
||||
Free((char *)pkey->private_key->data);
|
||||
Free(pkey->private_key->data);
|
||||
if ((pkey->private_key->data=(unsigned char *)Malloc(l[0])) == NULL)
|
||||
{
|
||||
ASN1err(ASN1_F_I2D_NETSCAPE_RSA,ERR_R_MALLOC_FAILURE);
|
||||
@ -334,7 +334,7 @@ static void NETSCAPE_PKEY_free(NETSCAPE_PKEY *a)
|
||||
M_ASN1_INTEGER_free(a->version);
|
||||
X509_ALGOR_free(a->algor);
|
||||
M_ASN1_OCTET_STRING_free(a->private_key);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
#endif /* NO_RC4 */
|
||||
|
@ -103,7 +103,7 @@ void PBEPARAM_free (PBEPARAM *a)
|
||||
if(a==NULL) return;
|
||||
M_ASN1_OCTET_STRING_free(a->salt);
|
||||
M_ASN1_INTEGER_free (a->iter);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
/* Return an algorithm identifier for a PKCS#5 PBE algorithm */
|
||||
|
@ -104,7 +104,7 @@ void PBE2PARAM_free (PBE2PARAM *a)
|
||||
if(a==NULL) return;
|
||||
X509_ALGOR_free(a->keyfunc);
|
||||
X509_ALGOR_free(a->encryption);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **pp)
|
||||
@ -158,7 +158,7 @@ void PBKDF2PARAM_free (PBKDF2PARAM *a)
|
||||
M_ASN1_INTEGER_free(a->iter);
|
||||
M_ASN1_INTEGER_free(a->keylength);
|
||||
X509_ALGOR_free(a->prf);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
/* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm:
|
||||
|
@ -116,6 +116,6 @@ void PKCS7_DIGEST_free(PKCS7_DIGEST *a)
|
||||
X509_ALGOR_free(a->md);
|
||||
PKCS7_free(a->contents);
|
||||
M_ASN1_OCTET_STRING_free(a->digest);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,6 @@ void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a)
|
||||
if (a == NULL) return;
|
||||
M_ASN1_INTEGER_free(a->version);
|
||||
PKCS7_ENC_CONTENT_free(a->enc_data);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,6 @@ void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a)
|
||||
ASN1_OBJECT_free(a->content_type);
|
||||
X509_ALGOR_free(a->algorithm);
|
||||
M_ASN1_OCTET_STRING_free(a->enc_data);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,6 @@ void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a)
|
||||
M_ASN1_INTEGER_free(a->version);
|
||||
sk_PKCS7_RECIP_INFO_pop_free(a->recipientinfo,PKCS7_RECIP_INFO_free);
|
||||
PKCS7_ENC_CONTENT_free(a->enc_data);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,6 @@ void PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *a)
|
||||
if (a == NULL) return;
|
||||
X509_NAME_free(a->issuer);
|
||||
M_ASN1_INTEGER_free(a->serial);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ PKCS7 *d2i_PKCS7(PKCS7 **a, unsigned char **pp, long length)
|
||||
{
|
||||
if ((*a)->asn1 != NULL)
|
||||
{
|
||||
Free((char *)(*a)->asn1);
|
||||
Free((*a)->asn1);
|
||||
(*a)->asn1=NULL;
|
||||
}
|
||||
(*a)->length=0;
|
||||
@ -251,7 +251,7 @@ void PKCS7_free(PKCS7 *a)
|
||||
{
|
||||
ASN1_OBJECT_free(a->type);
|
||||
}
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
void PKCS7_content_free(PKCS7 *a)
|
||||
@ -259,7 +259,7 @@ void PKCS7_content_free(PKCS7 *a)
|
||||
if(a == NULL)
|
||||
return;
|
||||
|
||||
if (a->asn1 != NULL) Free((char *)a->asn1);
|
||||
if (a->asn1 != NULL) Free(a->asn1);
|
||||
|
||||
if (a->d.ptr != NULL)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a)
|
||||
sk_X509_ATTRIBUTE_pop_free(a->unauth_attr,X509_ATTRIBUTE_free);
|
||||
if (a->pkey != NULL)
|
||||
EVP_PKEY_free(a->pkey);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
IMPLEMENT_STACK_OF(PKCS7_SIGNER_INFO)
|
||||
|
@ -126,6 +126,6 @@ void X509_KEY_free(X509 *a)
|
||||
X509_CINF_free(a->cert_info);
|
||||
X509_ALGOR_free(a->sig_alg);
|
||||
ASN1_BIT_STRING_free(a->signature);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ int RSA_print(BIO *bp, RSA *x, int off)
|
||||
if (!print(bp,"coefficient:",x->iqmp,m,off)) goto err;
|
||||
ret=1;
|
||||
err:
|
||||
if (m != NULL) Free((char *)m);
|
||||
if (m != NULL) Free(m);
|
||||
return(ret);
|
||||
}
|
||||
#endif /* NO_RSA */
|
||||
@ -204,7 +204,7 @@ int DSA_print(BIO *bp, DSA *x, int off)
|
||||
if ((x->g != NULL) && !print(bp,"G: ",x->g,m,off)) goto err;
|
||||
ret=1;
|
||||
err:
|
||||
if (m != NULL) Free((char *)m);
|
||||
if (m != NULL) Free(m);
|
||||
return(ret);
|
||||
}
|
||||
#endif /* !NO_DSA */
|
||||
@ -307,7 +307,7 @@ int DHparams_print(BIO *bp, DH *x)
|
||||
err:
|
||||
DHerr(DH_F_DHPARAMS_PRINT,reason);
|
||||
}
|
||||
if (m != NULL) Free((char *)m);
|
||||
if (m != NULL) Free(m);
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
@ -352,7 +352,7 @@ int DSAparams_print(BIO *bp, DSA *x)
|
||||
if (!print(bp,"g:",x->g,m,4)) goto err;
|
||||
ret=1;
|
||||
err:
|
||||
if (m != NULL) Free((char *)m);
|
||||
if (m != NULL) Free(m);
|
||||
DSAerr(DSA_F_DSAPARAMS_PRINT,reason);
|
||||
return(ret);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ int X509_print(BIO *bp, X509 *x)
|
||||
ret=1;
|
||||
err:
|
||||
if (str != NULL) ASN1_STRING_free(str);
|
||||
if (m != NULL) Free((char *)m);
|
||||
if (m != NULL) Free(m);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ void X509_ALGOR_free(X509_ALGOR *a)
|
||||
if (a == NULL) return;
|
||||
ASN1_OBJECT_free(a->algorithm);
|
||||
ASN1_TYPE_free(a->parameter);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
IMPLEMENT_STACK_OF(X509_ALGOR)
|
||||
|
@ -160,6 +160,6 @@ void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a)
|
||||
sk_ASN1_TYPE_pop_free(a->value.set,ASN1_TYPE_free);
|
||||
else
|
||||
ASN1_TYPE_free(a->value.single);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -134,6 +134,6 @@ void X509_EXTENSION_free(X509_EXTENSION *a)
|
||||
if (a == NULL) return;
|
||||
ASN1_OBJECT_free(a->object);
|
||||
M_ASN1_OCTET_STRING_free(a->value);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ void X509_INFO_free(X509_INFO *x)
|
||||
if (x->crl != NULL) X509_CRL_free(x->crl);
|
||||
if (x->x_pkey != NULL) X509_PKEY_free(x->x_pkey);
|
||||
if (x->enc_data != NULL) Free(x->enc_data);
|
||||
Free((char *)x);
|
||||
Free(x);
|
||||
}
|
||||
|
||||
IMPLEMENT_STACK_OF(X509_INFO)
|
||||
|
@ -146,6 +146,6 @@ void X509_PKEY_free(X509_PKEY *x)
|
||||
if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor);
|
||||
if (x->enc_pkey != NULL) M_ASN1_OCTET_STRING_free(x->enc_pkey);
|
||||
if (x->dec_pkey != NULL)EVP_PKEY_free(x->dec_pkey);
|
||||
if ((x->key_data != NULL) && (x->key_free)) Free((char *)x->key_data);
|
||||
Free((char *)x);
|
||||
if ((x->key_data != NULL) && (x->key_free)) Free(x->key_data);
|
||||
Free(x);
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void X509_PUBKEY_free(X509_PUBKEY *a)
|
||||
X509_ALGOR_free(a->algor);
|
||||
M_ASN1_BIT_STRING_free(a->public_key);
|
||||
if (a->pkey != NULL) EVP_PKEY_free(a->pkey);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
|
||||
|
@ -163,7 +163,7 @@ void X509_REQ_INFO_free(X509_REQ_INFO *a)
|
||||
X509_NAME_free(a->subject);
|
||||
X509_PUBKEY_free(a->pubkey);
|
||||
sk_X509_ATTRIBUTE_pop_free(a->attributes,X509_ATTRIBUTE_free);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int i2d_X509_REQ(X509_REQ *a, unsigned char **pp)
|
||||
@ -230,7 +230,7 @@ void X509_REQ_free(X509_REQ *a)
|
||||
X509_REQ_INFO_free(a->req_info);
|
||||
X509_ALGOR_free(a->sig_alg);
|
||||
M_ASN1_BIT_STRING_free(a->signature);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ void X509_SIG_free(X509_SIG *a)
|
||||
if (a == NULL) return;
|
||||
X509_ALGOR_free(a->algor);
|
||||
M_ASN1_OCTET_STRING_free(a->digest);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,7 @@ void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a)
|
||||
if (a == NULL) return;
|
||||
X509_PUBKEY_free(a->pubkey);
|
||||
M_ASN1_IA5STRING_free(a->challenge);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **pp)
|
||||
@ -161,6 +161,6 @@ void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a)
|
||||
NETSCAPE_SPKAC_free(a->spkac);
|
||||
X509_ALGOR_free(a->sig_algor);
|
||||
M_ASN1_BIT_STRING_free(a->signature);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,6 @@ void X509_VAL_free(X509_VAL *a)
|
||||
if (a == NULL) return;
|
||||
M_ASN1_TIME_free(a->notBefore);
|
||||
M_ASN1_TIME_free(a->notAfter);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void X509_free(X509 *a)
|
||||
X509_CERT_AUX_free(a->aux);
|
||||
|
||||
if (a->name != NULL) Free(a->name);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
|
@ -111,7 +111,7 @@ void X509_CERT_AUX_free(X509_CERT_AUX *a)
|
||||
ASN1_UTF8STRING_free(a->alias);
|
||||
ASN1_OCTET_STRING_free(a->keyid);
|
||||
ASN1_TYPE_free(a->other);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **pp)
|
||||
|
@ -334,7 +334,7 @@ static void ghbn_free(struct hostent *a)
|
||||
Free(a->h_addr_list[i]);
|
||||
Free(a->h_addr_list);
|
||||
}
|
||||
if (a->h_name != NULL) Free((char *)a->h_name);
|
||||
if (a->h_name != NULL) Free(a->h_name);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,13 @@ BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, BIGNUM *add,
|
||||
BIGNUM t;
|
||||
int found=0;
|
||||
int i,j,c1=0;
|
||||
BN_CTX *ctx;
|
||||
BN_CTX *ctx,*ctx2=NULL;
|
||||
int checks = BN_prime_checks_for_size(bits);
|
||||
|
||||
ctx=BN_CTX_new();
|
||||
if (ctx == NULL) goto err;
|
||||
ctx2=BN_CTX_new();
|
||||
if (ctx2 == NULL) goto err;
|
||||
if (ret == NULL)
|
||||
{
|
||||
if ((rnd=BN_new()) == NULL) goto err;
|
||||
@ -119,7 +121,7 @@ loop:
|
||||
|
||||
if (!safe)
|
||||
{
|
||||
i=BN_is_prime(rnd,checks,callback,ctx,cb_arg);
|
||||
i=BN_is_prime_fasttest(rnd,checks,callback,ctx,ctx2,cb_arg,0);
|
||||
if (i == -1) goto err;
|
||||
if (i == 0) goto loop;
|
||||
}
|
||||
@ -133,11 +135,11 @@ loop:
|
||||
|
||||
for (i=0; i<checks; i++)
|
||||
{
|
||||
j=BN_is_prime(rnd,1,callback,ctx,cb_arg);
|
||||
j=BN_is_prime_fasttest(rnd,1,callback,ctx,ctx2,cb_arg,0);
|
||||
if (j == -1) goto err;
|
||||
if (j == 0) goto loop;
|
||||
|
||||
j=BN_is_prime(&t,1,callback,ctx,cb_arg);
|
||||
j=BN_is_prime_fasttest(&t,1,callback,ctx,ctx2,cb_arg,0);
|
||||
if (j == -1) goto err;
|
||||
if (j == 0) goto loop;
|
||||
|
||||
@ -151,6 +153,7 @@ err:
|
||||
if (!found && (ret == NULL) && (rnd != NULL)) BN_free(rnd);
|
||||
BN_free(&t);
|
||||
if (ctx != NULL) BN_CTX_free(ctx);
|
||||
if (ctx2 != NULL) BN_CTX_free(ctx2);
|
||||
return(found ? rnd : NULL);
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ void EVP_PKEY_free(EVP_PKEY *x)
|
||||
}
|
||||
#endif
|
||||
EVP_PKEY_free_it(x);
|
||||
Free((char *)x);
|
||||
Free(x);
|
||||
}
|
||||
|
||||
static void EVP_PKEY_free_it(EVP_PKEY *x)
|
||||
|
@ -149,7 +149,7 @@ LHASH *lh_new(unsigned long (*h)(), int (*c)())
|
||||
ret->error=0;
|
||||
return(ret);
|
||||
err1:
|
||||
Free((char *)ret);
|
||||
Free(ret);
|
||||
err0:
|
||||
return(NULL);
|
||||
}
|
||||
@ -172,8 +172,8 @@ void lh_free(LHASH *lh)
|
||||
n=nn;
|
||||
}
|
||||
}
|
||||
Free((char *)lh->b);
|
||||
Free((char *)lh);
|
||||
Free(lh->b);
|
||||
Free(lh);
|
||||
}
|
||||
|
||||
void *lh_insert(LHASH *lh, void *data)
|
||||
@ -233,7 +233,7 @@ void *lh_delete(LHASH *lh, void *data)
|
||||
nn= *rn;
|
||||
*rn=nn->next;
|
||||
ret=nn->data;
|
||||
Free((char *)nn);
|
||||
Free(nn);
|
||||
lh->num_delete++;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
|
||||
sk_NAME_FUNCS_value(name_funcs_stack,ret->type)
|
||||
->free_func(ret->name,ret->type,ret->data);
|
||||
}
|
||||
Free((char *)ret);
|
||||
Free(ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,7 +216,7 @@ int OBJ_NAME_remove(const char *name, int type)
|
||||
sk_NAME_FUNCS_value(name_funcs_stack,ret->type)
|
||||
->free_func(ret->name,ret->type,ret->data);
|
||||
}
|
||||
Free((char *)ret);
|
||||
Free(ret);
|
||||
return(1);
|
||||
}
|
||||
else
|
||||
|
@ -643,7 +643,7 @@ int OBJ_create(char *oid, char *sn, char *ln)
|
||||
ok=OBJ_add_object(op);
|
||||
err:
|
||||
ASN1_OBJECT_free(op);
|
||||
Free((char *)buf);
|
||||
Free(buf);
|
||||
return(ok);
|
||||
}
|
||||
|
||||
|
@ -188,5 +188,5 @@ void PKCS12_BAGS_free (PKCS12_BAGS *a)
|
||||
}
|
||||
|
||||
ASN1_OBJECT_free (a->type);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
@ -107,5 +107,5 @@ void PKCS12_free (PKCS12 *a)
|
||||
M_ASN1_INTEGER_free(a->version);
|
||||
PKCS12_MAC_DATA_free (a->mac);
|
||||
PKCS7_free (a->authsafes);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
@ -106,5 +106,5 @@ void PKCS12_MAC_DATA_free (PKCS12_MAC_DATA *a)
|
||||
X509_SIG_free (a->dinfo);
|
||||
M_ASN1_OCTET_STRING_free(a->salt);
|
||||
M_ASN1_INTEGER_free(a->iter);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
@ -643,14 +643,14 @@ static void mime_hdr_free(MIME_HEADER *hdr)
|
||||
if(hdr->name) Free(hdr->name);
|
||||
if(hdr->value) Free(hdr->value);
|
||||
if(hdr->params) sk_pop_free(hdr->params, mime_param_free);
|
||||
Free((char *)hdr);
|
||||
Free(hdr);
|
||||
}
|
||||
|
||||
static void mime_param_free(MIME_PARAM *param)
|
||||
{
|
||||
if(param->param_name) Free(param->param_name);
|
||||
if(param->param_value) Free(param->param_value);
|
||||
Free((char *)param);
|
||||
Free(param);
|
||||
}
|
||||
|
||||
/* Check for a multipart boundary. Returns:
|
||||
|
@ -227,6 +227,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (v = 0; v < 3; v++)
|
||||
{
|
||||
#if 1
|
||||
key = RSA_generate_key(512*(v+1),3,0,0);
|
||||
clen=RSA_size(key);
|
||||
#else
|
||||
key = RSA_new();
|
||||
switch (v) {
|
||||
case 0:
|
||||
@ -239,6 +243,7 @@ int main(int argc, char *argv[])
|
||||
clen = key3(key, ctext_ex);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
num = RSA_public_encrypt(plen, ptext_ex, ctext, key,
|
||||
RSA_PKCS1_PADDING);
|
||||
|
@ -126,7 +126,7 @@ STACK *sk_new(int (*c)())
|
||||
ret->sorted=0;
|
||||
return(ret);
|
||||
err1:
|
||||
Free((char *)ret);
|
||||
Free(ret);
|
||||
err0:
|
||||
return(NULL);
|
||||
}
|
||||
@ -276,8 +276,8 @@ void sk_pop_free(STACK *st, void (*func)())
|
||||
void sk_free(STACK *st)
|
||||
{
|
||||
if (st == NULL) return;
|
||||
if (st->data != NULL) Free((char *)st->data);
|
||||
Free((char *)st);
|
||||
if (st->data != NULL) Free(st->data);
|
||||
Free(st);
|
||||
}
|
||||
|
||||
int sk_num(STACK *st)
|
||||
|
@ -181,7 +181,7 @@ err:
|
||||
#endif
|
||||
if (ret->data != NULL) sk_free(ret->data);
|
||||
if (ret->index != NULL) Free(ret->index);
|
||||
if (ret->qual != NULL) Free((char *)ret->qual);
|
||||
if (ret->qual != NULL) Free(ret->qual);
|
||||
if (ret != NULL) Free(ret);
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -218,9 +218,9 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
|
||||
memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)*
|
||||
sizeof(int));
|
||||
if (ctx->dirs != NULL)
|
||||
Free((char *)ctx->dirs);
|
||||
Free(ctx->dirs);
|
||||
if (ctx->dirs_type != NULL)
|
||||
Free((char *)ctx->dirs_type);
|
||||
Free(ctx->dirs_type);
|
||||
ctx->dirs=pp;
|
||||
ctx->dirs_type=ip;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ void AUTHORITY_KEYID_free(AUTHORITY_KEYID *a)
|
||||
M_ASN1_OCTET_STRING_free(a->keyid);
|
||||
sk_GENERAL_NAME_pop_free(a->issuer, GENERAL_NAME_free);
|
||||
M_ASN1_INTEGER_free (a->serial);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method,
|
||||
|
@ -123,7 +123,7 @@ void BASIC_CONSTRAINTS_free(BASIC_CONSTRAINTS *a)
|
||||
{
|
||||
if (a == NULL) return;
|
||||
M_ASN1_INTEGER_free (a->pathlen);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
static STACK_OF(CONF_VALUE) *i2v_BASIC_CONSTRAINTS(X509V3_EXT_METHOD *method,
|
||||
|
@ -213,7 +213,7 @@ void DIST_POINT_free(DIST_POINT *a)
|
||||
DIST_POINT_NAME_free(a->distpoint);
|
||||
M_ASN1_BIT_STRING_free(a->reasons);
|
||||
sk_GENERAL_NAME_pop_free(a->CRLissuer, GENERAL_NAME_free);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
int i2d_DIST_POINT_NAME(DIST_POINT_NAME *a, unsigned char **pp)
|
||||
@ -256,7 +256,7 @@ void DIST_POINT_NAME_free(DIST_POINT_NAME *a)
|
||||
if (a == NULL) return;
|
||||
sk_X509_NAME_ENTRY_pop_free(a->relativename, X509_NAME_ENTRY_free);
|
||||
sk_GENERAL_NAME_pop_free(a->fullname, GENERAL_NAME_free);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
DIST_POINT_NAME *d2i_DIST_POINT_NAME(DIST_POINT_NAME **a, unsigned char **pp,
|
||||
|
@ -211,7 +211,7 @@ void GENERAL_NAME_free(GENERAL_NAME *a)
|
||||
break;
|
||||
|
||||
}
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
/* Now the GeneralNames versions: a SEQUENCE OF GeneralName. These are needed as
|
||||
@ -286,6 +286,6 @@ void OTHERNAME_free(OTHERNAME *a)
|
||||
if (a == NULL) return;
|
||||
ASN1_OBJECT_free(a->type_id);
|
||||
ASN1_TYPE_free(a->value);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ void ACCESS_DESCRIPTION_free(ACCESS_DESCRIPTION *a)
|
||||
if (a == NULL) return;
|
||||
ASN1_OBJECT_free(a->method);
|
||||
GENERAL_NAME_free(a->location);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
STACK_OF(ACCESS_DESCRIPTION) *AUTHORITY_INFO_ACCESS_new()
|
||||
|
@ -121,7 +121,7 @@ void PKEY_USAGE_PERIOD_free(PKEY_USAGE_PERIOD *a)
|
||||
if (a == NULL) return;
|
||||
M_ASN1_GENERALIZEDTIME_free(a->notBefore);
|
||||
M_ASN1_GENERALIZEDTIME_free(a->notAfter);
|
||||
Free ((char *)a);
|
||||
Free (a);
|
||||
}
|
||||
|
||||
static int i2r_PKEY_USAGE_PERIOD(X509V3_EXT_METHOD *method,
|
||||
|
@ -104,7 +104,7 @@ void X509V3_conf_free(CONF_VALUE *conf)
|
||||
if(conf->name) Free(conf->name);
|
||||
if(conf->value) Free(conf->value);
|
||||
if(conf->section) Free(conf->section);
|
||||
Free((char *)conf);
|
||||
Free(conf);
|
||||
}
|
||||
|
||||
int X509V3_add_value_bool(const char *name, int asn1_bool,
|
||||
|
@ -380,7 +380,7 @@ void SSL_free(SSL *s)
|
||||
|
||||
if (s->method != NULL) s->method->ssl_free(s);
|
||||
|
||||
Free((char *)s);
|
||||
Free(s);
|
||||
}
|
||||
|
||||
void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio)
|
||||
@ -1215,7 +1215,7 @@ void SSL_CTX_free(SSL_CTX *a)
|
||||
sk_X509_pop_free(a->extra_certs,X509_free);
|
||||
if (a->comp_methods != NULL)
|
||||
sk_SSL_COMP_pop_free(a->comp_methods,SSL_COMP_free);
|
||||
Free((char *)a);
|
||||
Free(a);
|
||||
}
|
||||
|
||||
void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)
|
||||
|
Loading…
x
Reference in New Issue
Block a user