unsigned char *otmp = NULL, *ptmp = NULL;
int r, ret = 0;
AES_KEY wctx;
- otmp = OPENSSL_malloc(keylen + 8);
- ptmp = OPENSSL_malloc(keylen);
+ otmp = malloc(keylen + 8);
+ ptmp = malloc(keylen);
if (!otmp || !ptmp)
return 0;
if (AES_set_encrypt_key(kek, keybits, &wctx))
err:
if (otmp)
- OPENSSL_free(otmp);
+ free(otmp);
if (ptmp)
- OPENSSL_free(ptmp);
+ free(ptmp);
return ret;
}
if (len-- > 1) /* using one because of the bits left byte */
{
- s=(unsigned char *)OPENSSL_malloc((int)len);
+ s=(unsigned char *)malloc((int)len);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
s=NULL;
ret->length=(int)len;
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->data=s;
ret->type=V_ASN1_BIT_STRING;
if (a != NULL) (*a)=ret;
{
if (!value) return(1); /* Don't need to set */
if (a->data == NULL)
- c=(unsigned char *)OPENSSL_malloc(w+1);
+ c=(unsigned char *)malloc(w+1);
else
c=(unsigned char *)OPENSSL_realloc_clean(a->data,
a->length,
if (len != 0)
{
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=(unsigned char *)malloc((int)len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
else
s=NULL;
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->length=(int)len;
ret->data=s;
ret->type=tag;
{
if ((ret->length < len) || (ret->data == NULL))
{
- if (ret->data != NULL) OPENSSL_free(ret->data);
- s=(unsigned char *)OPENSSL_malloc((int)len + 1);
+ if (ret->data != NULL) free(ret->data);
+ s=(unsigned char *)malloc((int)len + 1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
else
{
s=NULL;
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
}
ret->length=(int)len;
if (!asn1_const_Finish(c)) goto err;
a->length=num;
- if (a->data != NULL) OPENSSL_free(a->data);
+ if (a->data != NULL) free(a->data);
a->data=(unsigned char *)b.data;
if (os != NULL) ASN1_STRING_free(os);
return(1);
err:
ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error);
if (os != NULL) ASN1_STRING_free(os);
- if (b.data != NULL) OPENSSL_free(b.data);
+ if (b.data != NULL) free(b.data);
return(0);
}
if (!EVP_Digest(str, i, md, len, type, NULL))
return 0;
- OPENSSL_free(str);
+ free(str);
return(1);
}
if (x == NULL) return(NULL);
i=i2d(x,NULL);
- b=OPENSSL_malloc(i+10);
+ b=malloc(i+10);
if (b == NULL)
{ ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
p= b;
i=i2d(x,&p);
p2= b;
ret=d2i(NULL,&p2,i);
- OPENSSL_free(b);
+ free(b);
return(ret);
}
{ ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
p= b;
ret=ASN1_item_d2i(NULL,&p,i, it);
- OPENSSL_free(b);
+ free(b);
return(ret);
}
if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
- OPENSSL_free(a->data);
- if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL)
+ free(a->data);
+ if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL)
memset((char *)a->data,0,sizeof(long)+1);
}
if (a->data == NULL)
len=((j == 0)?0:((j/8)+1));
if (ret->length < len+4)
{
- unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
+ unsigned char *new_data=realloc(ret->data, len+4);
if (!new_data)
{
ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
- p=OPENSSL_malloc(len);
+ p=malloc(len);
if (p == NULL)
{
ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ,
return(NULL);
}
if (s->data != NULL)
- OPENSSL_free(s->data);
+ free(s->data);
s->data=(unsigned char *)p;
}
int i,j=0,n,ret=1;
n=i2d(x,NULL);
- b=(char *)OPENSSL_malloc(n);
+ b=(char *)malloc(n);
if (b == NULL)
{
ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE);
j+=i;
n-=i;
}
- OPENSSL_free(b);
+ free(b);
return(ret);
}
j+=i;
n-=i;
}
- OPENSSL_free(b);
+ free(b);
return(ret);
}
p= *pp;
pend = p + len;
- /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
+ /* We must malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=(unsigned char *)malloc((int)len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
memcpy(s,p,(int)len);
}
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
goto err;
}
- /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
+ /* We must malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=(unsigned char *)malloc((int)len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
p+=len;
}
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
- OPENSSL_free(a->data);
- if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL)
+ free(a->data);
+ if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL)
memset((char *)a->data,0,sizeof(long)+1);
}
if (a->data == NULL)
len=((j == 0)?0:((j/8)+1));
if (ret->length < len+4)
{
- unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
+ unsigned char *new_data=realloc(ret->data, len+4);
if (!new_data)
{
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
dest = *out;
if(dest->data) {
dest->length = 0;
- OPENSSL_free(dest->data);
+ free(dest->data);
dest->data = NULL;
}
dest->type = str_type;
cpyfunc = cpy_utf8;
break;
}
- if(!(p = OPENSSL_malloc(outlen + 1))) {
+ if(!(p = malloc(outlen + 1))) {
if(free_out) ASN1_STRING_free(dest);
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE);
return -1;
if (blsize > tmpsize)
{
if (tmp != ftmp)
- OPENSSL_free(tmp);
+ free(tmp);
tmpsize = blsize + 32;
- tmp = OPENSSL_malloc(tmpsize);
+ tmp = malloc(tmpsize);
if (!tmp)
goto err;
}
len+=i;
}
if (tmp != ftmp)
- OPENSSL_free(tmp);
+ free(tmp);
if (bl)
BN_free(bl);
return(len);
err:
if (tmp != ftmp)
- OPENSSL_free(tmp);
+ free(tmp);
if (bl)
BN_free(bl);
return(0);
i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
if (i > (int)(sizeof(buf) - 1))
{
- p = OPENSSL_malloc(i + 1);
+ p = malloc(i + 1);
if (!p)
return -1;
i2t_ASN1_OBJECT(p,i + 1,a);
return BIO_write(bp, "<INVALID>", 9);
BIO_write(bp,p,i);
if (p != buf)
- OPENSSL_free(p);
+ free(p);
return(i);
}
if ((data == NULL) || (ret->length < len))
{
ret->length=0;
- if (data != NULL) OPENSSL_free(data);
- data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
+ if (data != NULL) free(data);
+ data=(unsigned char *)malloc(len ? (int)len : 1);
if (data == NULL)
{ i=ERR_R_MALLOC_FAILURE; goto err; }
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
{
ASN1_OBJECT *ret;
- ret=(ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT));
+ ret=(ASN1_OBJECT *)malloc(sizeof(ASN1_OBJECT));
if (ret == NULL)
{
ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE);
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS)
{
#ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */
- if (a->sn != NULL) OPENSSL_free((void *)a->sn);
- if (a->ln != NULL) OPENSSL_free((void *)a->ln);
+ if (a->sn != NULL) free((void *)a->sn);
+ if (a->ln != NULL) free((void *)a->ln);
#endif
a->sn=a->ln=NULL;
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
{
- if (a->data != NULL) OPENSSL_free((void *)a->data);
+ if (a->data != NULL) free((void *)a->data);
a->data=NULL;
a->length=0;
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
- OPENSSL_free(a);
+ free(a);
}
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
inl=ASN1_item_i2d(asn,&buf_in, it);
outll=outl=EVP_PKEY_size(pkey);
- buf_out=OPENSSL_malloc((unsigned int)outl);
+ buf_out=malloc((unsigned int)outl);
if ((buf_in == NULL) || (buf_out == NULL))
{
outl=0;
ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB);
goto err;
}
- if (signature->data != NULL) OPENSSL_free(signature->data);
+ if (signature->data != NULL) free(signature->data);
signature->data=buf_out;
buf_out=NULL;
signature->length=outl;
err:
EVP_MD_CTX_cleanup(ctx);
if (buf_in != NULL)
- { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); }
+ { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); free(buf_in); }
if (buf_out != NULL)
- { OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); }
+ { OPENSSL_cleanse((char *)buf_out,outll); free(buf_out); }
return(outl);
}
t.type = str->type;
t.value.ptr = (char *)str;
der_len = i2d_ASN1_TYPE(&t, NULL);
- der_buf = OPENSSL_malloc(der_len);
+ der_buf = malloc(der_len);
if(!der_buf) return -1;
p = der_buf;
i2d_ASN1_TYPE(&t, &p);
outlen = do_hex_dump(io_ch, arg, der_buf, der_len);
- OPENSSL_free(der_buf);
+ free(der_buf);
if(outlen < 0) return -1;
return outlen + 1;
}
return 0;
}
if(!(tmp = ASN1_STRING_TABLE_get(nid))) {
- tmp = OPENSSL_malloc(sizeof(ASN1_STRING_TABLE));
+ tmp = malloc(sizeof(ASN1_STRING_TABLE));
if(!tmp) {
ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD,
ERR_R_MALLOC_FAILURE);
static void st_free(ASN1_STRING_TABLE *tbl)
{
- if(tbl->flags & STABLE_FLAGS_MALLOC) OPENSSL_free(tbl);
+ if(tbl->flags & STABLE_FLAGS_MALLOC) free(tbl);
}
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
- p=OPENSSL_malloc(len);
+ p=malloc(len);
if (p == NULL)
{
ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
return(NULL);
}
if (s->data != NULL)
- OPENSSL_free(s->data);
+ free(s->data);
s->data=(unsigned char *)p;
}
}
OPENSSL_cleanse(buf_in,(unsigned int)inl);
- OPENSSL_free(buf_in);
+ free(buf_in);
if (EVP_DigestVerifyFinal(&ctx,signature->data,
(size_t)signature->length) <= 0)
const char *pem_str, const char *info)
{
EVP_PKEY_ASN1_METHOD *ameth;
- ameth = OPENSSL_malloc(sizeof(EVP_PKEY_ASN1_METHOD));
+ ameth = malloc(sizeof(EVP_PKEY_ASN1_METHOD));
if (!ameth)
return NULL;
if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC))
{
if (ameth->pem_str)
- OPENSSL_free(ameth->pem_str);
+ free(ameth->pem_str);
if (ameth->info)
- OPENSSL_free(ameth->info);
- OPENSSL_free(ameth);
+ free(ameth->info);
+ free(ameth);
}
}
/* Allocate buffer for new encoding */
- new_der = OPENSSL_malloc(len);
+ new_der = malloc(len);
if (!new_der)
goto err;
err:
if (orig_der)
- OPENSSL_free(orig_der);
+ free(orig_der);
if (new_der)
- OPENSSL_free(new_der);
+ free(new_der);
return ret;
bad:
if (der)
- OPENSSL_free(der);
+ free(der);
if (sk)
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
{
c=str->data;
if (c == NULL)
- str->data=OPENSSL_malloc(len+1);
+ str->data=malloc(len+1);
else
- str->data=OPENSSL_realloc(c,len+1);
+ str->data=realloc(c,len+1);
if (str->data == NULL)
{
void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
{
if (str->data)
- OPENSSL_free(str->data);
+ free(str->data);
str->data = data;
str->length = len;
}
{
ASN1_STRING *ret;
- ret=(ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING));
+ ret=(ASN1_STRING *)malloc(sizeof(ASN1_STRING));
if (ret == NULL)
{
ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE);
{
if (a == NULL) return;
if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
- OPENSSL_free(a->data);
- OPENSSL_free(a);
+ free(a->data);
+ free(a);
}
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
/* New macros */
#define M_ASN1_New_Malloc(ret,type) \
- if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
+ if ((ret=(type *)malloc(sizeof(type))) == NULL) \
{ c.line=__LINE__; goto err2; }
#define M_ASN1_New(arg,func) \
if (rv > 0)
{
BIO_puts(out, micstr);
- OPENSSL_free(micstr);
+ free(micstr);
continue;
}
if (rv != -2)
}
}
} else tmpval = NULL;
- mhdr = (MIME_HEADER *) OPENSSL_malloc(sizeof(MIME_HEADER));
+ mhdr = (MIME_HEADER *) malloc(sizeof(MIME_HEADER));
if(!mhdr) return NULL;
mhdr->name = tmpname;
mhdr->value = tmpval;
if(!tmpval) return 0;
} else tmpval = NULL;
/* Parameter values are case sensitive so leave as is */
- mparam = (MIME_PARAM *) OPENSSL_malloc(sizeof(MIME_PARAM));
+ mparam = (MIME_PARAM *) malloc(sizeof(MIME_PARAM));
if(!mparam) return 0;
mparam->param_name = tmpname;
mparam->param_value = tmpval;
static void mime_hdr_free(MIME_HEADER *hdr)
{
- if(hdr->name) OPENSSL_free(hdr->name);
- if(hdr->value) OPENSSL_free(hdr->value);
+ if(hdr->name) free(hdr->name);
+ if(hdr->value) free(hdr->value);
if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free);
- OPENSSL_free(hdr);
+ free(hdr);
}
static void mime_param_free(MIME_PARAM *param)
{
- if(param->param_name) OPENSSL_free(param->param_name);
- if(param->param_value) OPENSSL_free(param->param_value);
- OPENSSL_free(param);
+ if(param->param_name) free(param->param_name);
+ if(param->param_value) free(param->param_value);
+ free(param);
}
/* Check for a multipart boundary. Returns:
p--;
}
p++;
- lntmp = OPENSSL_malloc((p - ln) + 1);
+ lntmp = malloc((p - ln) + 1);
if (lntmp == NULL)
return 0;
memcpy(lntmp, ln, p - ln);
} else octmp = *oct;
if(octmp->data) {
- OPENSSL_free(octmp->data);
+ free(octmp->data);
octmp->data = NULL;
}
static int asn1_bio_new(BIO *b)
{
BIO_ASN1_BUF_CTX *ctx;
- ctx = OPENSSL_malloc(sizeof(BIO_ASN1_BUF_CTX));
+ ctx = malloc(sizeof(BIO_ASN1_BUF_CTX));
if (!ctx)
return 0;
if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE))
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
{
- ctx->buf = OPENSSL_malloc(size);
+ ctx->buf = malloc(size);
if (!ctx->buf)
return 0;
ctx->bufsize = size;
if (ctx == NULL)
return 0;
if (ctx->buf)
- OPENSSL_free(ctx->buf);
- OPENSSL_free(ctx);
+ free(ctx->buf);
+ free(ctx);
b->init = 0;
b->ptr = NULL;
b->flags = 0;
ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED);
return NULL;
}
- ndef_aux = OPENSSL_malloc(sizeof(NDEF_SUPPORT));
+ ndef_aux = malloc(sizeof(NDEF_SUPPORT));
asn_bio = BIO_new(BIO_f_asn1());
/* ASN1 bio needs to be next to output BIO */
if (asn_bio)
BIO_free(asn_bio);
if (ndef_aux)
- OPENSSL_free(ndef_aux);
+ free(ndef_aux);
return NULL;
}
ndef_aux = *(NDEF_SUPPORT **)parg;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
- p = OPENSSL_malloc(derlen);
+ p = malloc(derlen);
ndef_aux->derbuf = p;
*pbuf = p;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
ndef_aux = *(NDEF_SUPPORT **)parg;
if (ndef_aux->derbuf)
- OPENSSL_free(ndef_aux->derbuf);
+ free(ndef_aux->derbuf);
ndef_aux->derbuf = NULL;
*pbuf = NULL;
NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg;
if (!ndef_prefix_free(b, pbuf, plen, parg))
return 0;
- OPENSSL_free(*pndef_aux);
+ free(*pndef_aux);
*pndef_aux = NULL;
return 1;
}
return 0;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
- p = OPENSSL_malloc(derlen);
+ p = malloc(derlen);
ndef_aux->derbuf = p;
*pbuf = p;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
if (num+i > slen)
{
if (s == NULL)
- sp=(unsigned char *)OPENSSL_malloc(
+ sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
- sp=(unsigned char *)OPENSSL_realloc(s,
+ sp=(unsigned char *)realloc(s,
(unsigned int)num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
goto err;
}
s=sp;
if (num+i > slen)
{
if (s == NULL)
- sp=(unsigned char *)OPENSSL_malloc(
+ sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
sp=OPENSSL_realloc_clean(s,slen,num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
goto err;
}
s=sp;
if (num+i > slen)
{
if (s == NULL)
- sp=(unsigned char *)OPENSSL_malloc(
+ sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
- sp=(unsigned char *)OPENSSL_realloc(s,
+ sp=(unsigned char *)realloc(s,
(unsigned int)num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
goto err;
}
s=sp;
/* Since its RC4 encrypted length is actual length */
- if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL)
+ if ((zz=(unsigned char *)malloc(rsalen)) == NULL)
{
ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE);
goto err;
/* Write out private key encoding */
i2d_RSAPrivateKey(a,&zz);
- if ((zz=OPENSSL_malloc(pkeylen)) == NULL)
+ if ((zz=malloc(pkeylen)) == NULL)
{
ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE);
goto err;
if (!saltlen)
saltlen = PKCS5_SALT_LEN;
- if (!(osalt->data = OPENSSL_malloc (saltlen)))
+ if (!(osalt->data = malloc (saltlen)))
goto merr;
osalt->length = saltlen;
X509_signature_print(out, x->sig_alg, NULL);
p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0);
BIO_printf(out,"%8sIssuer: %s\n","",p);
- OPENSSL_free(p);
+ free(p);
BIO_printf(out,"%8sLast Update: ","");
ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x));
BIO_printf(out,"\n%8sNext Update: ","");
}
ret=1;
err:
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
if (BIO_printf(bp," Subject OCSP hash: ") <= 0)
goto err;
derlen = i2d_X509_NAME(x->cert_info->subject, NULL);
- if ((der = dertmp = (unsigned char *)OPENSSL_malloc (derlen)) == NULL)
+ if ((der = dertmp = (unsigned char *)malloc (derlen)) == NULL)
goto err;
i2d_X509_NAME(x->cert_info->subject, &dertmp);
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err;
}
- OPENSSL_free (der);
+ free (der);
der=NULL;
/* display the hash of the public key as it would appear
return (1);
err:
- if (der != NULL) OPENSSL_free(der);
+ if (der != NULL) free(der);
return(0);
}
b=X509_NAME_oneline(name,NULL,0);
if (!*b)
{
- OPENSSL_free(b);
+ free(b);
return 1;
}
s=b+1; /* skip the first slash */
err:
X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB);
}
- OPENSSL_free(b);
+ free(b);
return(ret);
}
*in = p;
ret = 1;
err:
- if (free_cont && buf.data) OPENSSL_free(buf.data);
+ if (free_cont && buf.data) free(buf.data);
return ret;
}
if (*free_cont)
{
if (stmp->data)
- OPENSSL_free(stmp->data);
+ free(stmp->data);
stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */
stmp->length = len;
*free_cont = 0;
len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);
if (len <= 0)
return len;
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (!buf)
return -1;
p = buf;
do_sort = 0;
else
{
- derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk)
+ derlst = malloc(sk_ASN1_VALUE_num(sk)
* sizeof(*derlst));
- tmpdat = OPENSSL_malloc(skcontlen);
+ tmpdat = malloc(skcontlen);
if (!derlst || !tmpdat)
return 0;
}
i++, tder++)
(void)sk_ASN1_VALUE_set(sk, i, tder->field);
}
- OPENSSL_free(derlst);
- OPENSSL_free(tmpdat);
+ free(derlst);
+ free(tmpdat);
return 1;
}
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
if (!combine)
{
- OPENSSL_free(*pval);
+ free(*pval);
*pval = NULL;
}
break;
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
if (!combine)
{
- OPENSSL_free(*pval);
+ free(*pval);
*pval = NULL;
}
break;
case V_ASN1_ANY:
ASN1_primitive_free(pval, NULL);
- OPENSSL_free(*pval);
+ free(*pval);
break;
default:
}
if (!combine)
{
- *pval = OPENSSL_malloc(it->size);
+ *pval = malloc(it->size);
if (!*pval)
goto memerr;
memset(*pval, 0, it->size);
}
if (!combine)
{
- *pval = OPENSSL_malloc(it->size);
+ *pval = malloc(it->size);
if (!*pval)
goto memerr;
memset(*pval, 0, it->size);
return 1;
case V_ASN1_ANY:
- typ = OPENSSL_malloc(sizeof(ASN1_TYPE));
+ typ = malloc(sizeof(ASN1_TYPE));
if (!typ)
return 0;
typ->value.ptr = NULL;
ASN1_PCTX *ASN1_PCTX_new(void)
{
ASN1_PCTX *ret;
- ret = OPENSSL_malloc(sizeof(ASN1_PCTX));
+ ret = malloc(sizeof(ASN1_PCTX));
if (ret == NULL)
{
ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE);
void ASN1_PCTX_free(ASN1_PCTX *p)
{
- OPENSSL_free(p);
+ free(p);
}
unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p)
s = i2s_ASN1_INTEGER(NULL, str);
if (BIO_puts(out, s) <= 0)
ret = 0;
- OPENSSL_free(s);
+ free(s);
return ret;
}
if (enc)
{
if (enc->enc)
- OPENSSL_free(enc->enc);
+ free(enc->enc);
enc->enc = NULL;
enc->len = 0;
enc->modified = 1;
return 1;
if (enc->enc)
- OPENSSL_free(enc->enc);
- enc->enc = OPENSSL_malloc(inlen);
+ free(enc->enc);
+ enc->enc = malloc(inlen);
if (!enc->enc)
return 0;
memcpy(enc->enc, in, inlen);
int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk))
{
X509_CRL_METHOD *m;
- m = OPENSSL_malloc(sizeof(X509_CRL_METHOD));
+ m = malloc(sizeof(X509_CRL_METHOD));
if (!m)
return NULL;
m->crl_init = crl_init;
{
if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
return;
- OPENSSL_free(m);
+ free(m);
}
void X509_CRL_set_meth_data(X509_CRL *crl, void *dat)
{
X509_INFO *ret=NULL;
- ret=(X509_INFO *)OPENSSL_malloc(sizeof(X509_INFO));
+ ret=(X509_INFO *)malloc(sizeof(X509_INFO));
if (ret == NULL)
{
ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE);
if (x->x509 != NULL) X509_free(x->x509);
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) OPENSSL_free(x->enc_data);
- OPENSSL_free(x);
+ if (x->enc_data != NULL) free(x->enc_data);
+ free(x);
}
IMPLEMENT_STACK_OF(X509_INFO)
static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it)
{
X509_NAME *ret = NULL;
- ret = OPENSSL_malloc(sizeof(X509_NAME));
+ ret = malloc(sizeof(X509_NAME));
if(!ret) goto memerr;
if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL)
goto memerr;
{
if (ret->entries)
sk_X509_NAME_ENTRY_free(ret->entries);
- OPENSSL_free(ret);
+ free(ret);
}
return 0;
}
BUF_MEM_free(a->bytes);
sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
if (a->canon_enc)
- OPENSSL_free(a->canon_enc);
- OPENSSL_free(a);
+ free(a->canon_enc);
+ free(a);
*pval = NULL;
}
if (a->canon_enc)
{
- OPENSSL_free(a->canon_enc);
+ free(a->canon_enc);
a->canon_enc = NULL;
}
/* Special case: empty X509_NAME => null encoding */
a->canon_enclen = i2d_name_canon(intname, NULL);
- p = OPENSSL_malloc(a->canon_enclen);
+ p = malloc(a->canon_enclen);
if (!p)
goto err;
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)) OPENSSL_free(x->key_data);
- OPENSSL_free(x);
+ if ((x->key_data != NULL) && (x->key_free)) free(x->key_data);
+ free(x);
}
if (penc)
{
if (pub->public_key->data)
- OPENSSL_free(pub->public_key->data);
+ free(pub->public_key->data);
pub->public_key->data = penc;
pub->public_key->length = penclen;
/* Set number of unused bits to zero */
break;
case ASN1_OP_D2I_POST:
- if (ret->name != NULL) OPENSSL_free(ret->name);
+ if (ret->name != NULL) free(ret->name);
ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
break;
ASIdentifiers_free(ret->rfc3779_asid);
#endif
- if (ret->name != NULL) OPENSSL_free(ret->name);
+ if (ret->name != NULL) free(ret->name);
break;
}
if (*buffer == NULL) {
if (*maxlen == 0)
*maxlen = 1024;
- *buffer = OPENSSL_malloc(*maxlen);
+ *buffer = malloc(*maxlen);
if (*currlen > 0) {
assert(*sbuffer != NULL);
memcpy(*buffer, *sbuffer, *currlen);
*sbuffer = NULL;
} else {
*maxlen += 1024;
- *buffer = OPENSSL_realloc(*buffer, *maxlen);
+ *buffer = realloc(*buffer, *maxlen);
}
}
/* What to do if *buffer is NULL? */
format, args);
if (dynbuf) {
ret = BIO_write(bio, dynbuf, (int)retlen);
- OPENSSL_free(dynbuf);
+ free(dynbuf);
} else {
ret = BIO_write(bio, hugebuf, (int)retlen);
}
ret = 1;
err:
if (str != NULL)
- OPENSSL_free(str);
+ free(str);
if ((ret == 0) && (s != -1)) {
close(s);
s = -1;
p = *addr;
if (p) {
*p = '\0';
- p = OPENSSL_realloc(p, nl);
+ p = realloc(p, nl);
} else {
- p = OPENSSL_malloc(nl);
+ p = malloc(nl);
}
if (p == NULL) {
BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
l = ntohl(sa.from.sa_in.sin_addr.s_addr);
port = ntohs(sa.from.sa_in.sin_port);
if (*addr == NULL) {
- if ((p = OPENSSL_malloc(24)) == NULL) {
+ if ((p = malloc(24)) == NULL) {
BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
goto end;
}
{
BIO_F_BUFFER_CTX *ctx;
- ctx = (BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX));
+ ctx = (BIO_F_BUFFER_CTX *)malloc(sizeof(BIO_F_BUFFER_CTX));
if (ctx == NULL)
return (0);
- ctx->ibuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+ ctx->ibuf = (char *)malloc(DEFAULT_BUFFER_SIZE);
if (ctx->ibuf == NULL) {
- OPENSSL_free(ctx);
+ free(ctx);
return (0);
}
- ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+ ctx->obuf = (char *)malloc(DEFAULT_BUFFER_SIZE);
if (ctx->obuf == NULL) {
- OPENSSL_free(ctx->ibuf);
- OPENSSL_free(ctx);
+ free(ctx->ibuf);
+ free(ctx);
return (0);
}
ctx->ibuf_size = DEFAULT_BUFFER_SIZE;
return (0);
b = (BIO_F_BUFFER_CTX *)a->ptr;
if (b->ibuf != NULL)
- OPENSSL_free(b->ibuf);
+ free(b->ibuf);
if (b->obuf != NULL)
- OPENSSL_free(b->obuf);
- OPENSSL_free(a->ptr);
+ free(b->obuf);
+ free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
break;
case BIO_C_SET_BUFF_READ_DATA:
if (num > ctx->ibuf_size) {
- p1 = OPENSSL_malloc((int)num);
+ p1 = malloc((int)num);
if (p1 == NULL)
goto malloc_error;
if (ctx->ibuf != NULL)
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
ctx->ibuf = p1;
}
ctx->ibuf_off = 0;
p1 = ctx->ibuf;
p2 = ctx->obuf;
if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) {
- p1 = (char *)OPENSSL_malloc((int)num);
+ p1 = (char *)malloc((int)num);
if (p1 == NULL)
goto malloc_error;
}
if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) {
- p2 = (char *)OPENSSL_malloc((int)num);
+ p2 = (char *)malloc((int)num);
if (p2 == NULL) {
if (p1 != ctx->ibuf)
- OPENSSL_free(p1);
+ free(p1);
goto malloc_error;
}
}
if (ctx->ibuf != p1) {
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
ctx->ibuf = p1;
ctx->ibuf_off = 0;
ctx->ibuf_len = 0;
ctx->ibuf_size = ibs;
}
if (ctx->obuf != p2) {
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
ctx->obuf = p2;
ctx->obuf_off = 0;
ctx->obuf_len = 0;
{
BIO_LINEBUFFER_CTX *ctx;
- ctx = (BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX));
+ ctx = (BIO_LINEBUFFER_CTX *)malloc(sizeof(BIO_LINEBUFFER_CTX));
if (ctx == NULL)
return (0);
- ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
+ ctx->obuf = (char *)malloc(DEFAULT_LINEBUFFER_SIZE);
if (ctx->obuf == NULL) {
- OPENSSL_free(ctx);
+ free(ctx);
return (0);
}
ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE;
return (0);
b = (BIO_LINEBUFFER_CTX *)a->ptr;
if (b->obuf != NULL)
- OPENSSL_free(b->obuf);
- OPENSSL_free(a->ptr);
+ free(b->obuf);
+ free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
obs = (int)num;
p = ctx->obuf;
if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) {
- p = (char *)OPENSSL_malloc((int)num);
+ p = (char *)malloc((int)num);
if (p == NULL)
goto malloc_error;
}
ctx->obuf_len = obs;
}
memcpy(p, ctx->obuf, ctx->obuf_len);
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
ctx->obuf = p;
ctx->obuf_size = obs;
}
{
NBIO_TEST *nt;
- if (!(nt = (NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST))))
+ if (!(nt = (NBIO_TEST *)malloc(sizeof(NBIO_TEST))))
return (0);
nt->lrn = -1;
nt->lwn = -1;
if (a == NULL)
return (0);
if (a->ptr != NULL)
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
{
BIO *ret = NULL;
- ret = (BIO *)OPENSSL_malloc(sizeof(BIO));
+ ret = (BIO *)malloc(sizeof(BIO));
if (ret == NULL) {
BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
if (!BIO_set(ret, method)) {
- OPENSSL_free(ret);
+ free(ret);
ret = NULL;
}
return (ret);
if ((a->method == NULL) || (a->method->destroy == NULL))
return (1);
a->method->destroy(a);
- OPENSSL_free(a);
+ free(a);
return (1);
}
{
BIO_ACCEPT *ret;
- if ((ret = (BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL)
+ if ((ret = (BIO_ACCEPT *)malloc(sizeof(BIO_ACCEPT))) == NULL)
return (NULL);
memset(ret, 0, sizeof(BIO_ACCEPT));
return;
if (a->param_addr != NULL)
- OPENSSL_free(a->param_addr);
+ free(a->param_addr);
if (a->addr != NULL)
- OPENSSL_free(a->addr);
+ free(a->addr);
if (a->bio_chain != NULL)
BIO_free(a->bio_chain);
- OPENSSL_free(a);
+ free(a);
}
static void
if (num == 0) {
b->init = 1;
if (data->param_addr != NULL)
- OPENSSL_free(data->param_addr);
+ free(data->param_addr);
data->param_addr = BUF_strdup(ptr);
} else if (num == 1) {
data->accept_nbio = (ptr != NULL);
{
struct bio_bio_st *b;
- b = OPENSSL_malloc(sizeof *b);
+ b = malloc(sizeof *b);
if (b == NULL)
return 0;
bio_destroy_pair(bio);
if (b->buf != NULL) {
- OPENSSL_free(b->buf);
+ free(b->buf);
}
- OPENSSL_free(b);
+ free(b);
return 1;
}
if (b->size != new_size) {
if (b->buf) {
- OPENSSL_free(b->buf);
+ free(b->buf);
b->buf = NULL;
}
b->size = new_size;
}
if (b1->buf == NULL) {
- b1->buf = OPENSSL_malloc(b1->size);
+ b1->buf = malloc(b1->size);
if (b1->buf == NULL) {
BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE);
return 0;
}
if (b2->buf == NULL) {
- b2->buf = OPENSSL_malloc(b2->size);
+ b2->buf = malloc(b2->size);
if (b2->buf == NULL) {
BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE);
return 0;
break;
}
if (c->param_port != NULL)
- OPENSSL_free(c->param_port);
+ free(c->param_port);
c->param_port = BUF_strdup(p);
}
}
{
BIO_CONNECT *ret;
- if ((ret = (BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL)
+ if ((ret = (BIO_CONNECT *)malloc(sizeof(BIO_CONNECT))) == NULL)
return (NULL);
ret->state = BIO_CONN_S_BEFORE;
ret->param_hostname = NULL;
return;
if (a->param_hostname != NULL)
- OPENSSL_free(a->param_hostname);
+ free(a->param_hostname);
if (a->param_port != NULL)
- OPENSSL_free(a->param_port);
- OPENSSL_free(a);
+ free(a->param_port);
+ free(a);
}
BIO_METHOD
b->init = 1;
if (num == 0) {
if (data->param_hostname != NULL)
- OPENSSL_free(data->param_hostname);
+ free(data->param_hostname);
data->param_hostname = BUF_strdup(ptr);
} else if (num == 1) {
if (data->param_port != NULL)
- OPENSSL_free(data->param_port);
+ free(data->param_port);
data->param_port = BUF_strdup(ptr);
} else if (num == 2) {
char buf[16];
(void) snprintf(buf, sizeof buf, "%d.%d.%d.%d",
p[0], p[1], p[2], p[3]);
if (data->param_hostname != NULL)
- OPENSSL_free(data->param_hostname);
+ free(data->param_hostname);
data->param_hostname = BUF_strdup(buf);
memcpy(&(data->ip[0]), ptr, 4);
} else if (num == 3) {
(void) snprintf(buf, sizeof buf, "%d",
*(int *)ptr);
if (data->param_port != NULL)
- OPENSSL_free(data->param_port);
+ free(data->param_port);
data->param_port = BUF_strdup(buf);
data->port= *(int *)ptr;
}
bi->init = 0;
bi->num = 0;
- data = OPENSSL_malloc(sizeof(bio_dgram_data));
+ data = malloc(sizeof(bio_dgram_data));
if (data == NULL)
return 0;
memset(data, 0x00, sizeof(bio_dgram_data));
data = (bio_dgram_data *)a->ptr;
if (data != NULL)
- OPENSSL_free(data);
+ free(data);
return (1);
}
* SCTP-AUTH has to be activated for the listening socket
* already, otherwise the connected socket won't use it. */
sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
- authchunks = OPENSSL_malloc(sockopt_len);
+ authchunks = malloc(sockopt_len);
memset(authchunks, 0, sizeof(sockopt_len));
ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len);
OPENSSL_assert(ret >= 0);
auth_forward = 1;
}
- OPENSSL_free(authchunks);
+ free(authchunks);
OPENSSL_assert(auth_data);
OPENSSL_assert(auth_forward);
bi->init = 0;
bi->num = 0;
- data = OPENSSL_malloc(sizeof(bio_dgram_sctp_data));
+ data = malloc(sizeof(bio_dgram_sctp_data));
if (data == NULL)
return 0;
memset(data, 0x00, sizeof(bio_dgram_sctp_data));
data = (bio_dgram_sctp_data *)a->ptr;
if (data != NULL)
- OPENSSL_free(data);
+ free(data);
return (1);
}
if (data->saved_message.length > 0) {
dgram_sctp_write(data->saved_message.bio, data->saved_message.data,
data->saved_message.length);
- OPENSSL_free(data->saved_message.data);
+ free(data->saved_message.data);
data->saved_message.length = 0;
}
struct sctp_authchunks *authchunks;
optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
- authchunks = OPENSSL_malloc(optlen);
+ authchunks = malloc(optlen);
memset(authchunks, 0, sizeof(optlen));
ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen);
OPENSSL_assert(ii >= 0);
auth_forward = 1;
}
- OPENSSL_free(authchunks);
+ free(authchunks);
if (!auth_data || !auth_forward) {
BIOerr(BIO_F_DGRAM_SCTP_READ, BIO_R_CONNECT_ERROR);
if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
data->saved_message.bio = b;
data->saved_message.length = inl;
- data->saved_message.data = OPENSSL_malloc(inl);
+ data->saved_message.data = malloc(inl);
memcpy(data->saved_message.data, in, inl);
return inl;
}
/* Add new key */
sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t);
- authkey = OPENSSL_malloc(sockopt_len);
+ authkey = malloc(sockopt_len);
memset(authkey, 0x00, sockopt_len);
authkey->sca_keynumber = authkeyid.scact_keynumber + 1;
#ifndef __FreeBSD__
{ 0, "", LOG_ERR } /* The default */
};
- if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) {
+ if ((buf = (char *)malloc(inl + 1)) == NULL) {
return (0);
}
strlcpy(buf, in, inl + 1);
xsyslog(b, priority, pp);
- OPENSSL_free(buf);
+ free(buf);
return (ret);
}
bn_check_top(mod);
- if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL)
+ if ((ret=(BN_BLINDING *)malloc(sizeof(BN_BLINDING))) == NULL)
{
BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
if (r->Ai != NULL) BN_free(r->Ai);
if (r->e != NULL) BN_free(r->e );
if (r->mod != NULL) BN_free(r->mod);
- OPENSSL_free(r);
+ free(r);
}
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
BN_CTX *BN_CTX_new(void)
{
- BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX));
+ BN_CTX *ret = malloc(sizeof(BN_CTX));
if(!ret)
{
BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
#endif
BN_STACK_finish(&ctx->stack);
BN_POOL_finish(&ctx->pool);
- OPENSSL_free(ctx);
+ free(ctx);
}
void BN_CTX_start(BN_CTX *ctx)
static void BN_STACK_finish(BN_STACK *st)
{
- if(st->size) OPENSSL_free(st->indexes);
+ if(st->size) free(st->indexes);
}
#ifndef OPENSSL_NO_DEPRECATED
{
unsigned int newsize = (st->size ?
(st->size * 3 / 2) : BN_CTX_START_FRAMES);
- unsigned int *newitems = OPENSSL_malloc(newsize *
+ unsigned int *newitems = malloc(newsize *
sizeof(unsigned int));
if(!newitems) return 0;
if(st->depth)
memcpy(newitems, st->indexes, st->depth *
sizeof(unsigned int));
- if(st->size) OPENSSL_free(st->indexes);
+ if(st->size) free(st->indexes);
st->indexes = newitems;
st->size = newsize;
}
bn++;
}
p->current = p->head->next;
- OPENSSL_free(p->head);
+ free(p->head);
p->head = p->current;
}
}
{
BIGNUM *bn;
unsigned int loop = 0;
- BN_POOL_ITEM *item = OPENSSL_malloc(sizeof(BN_POOL_ITEM));
+ BN_POOL_ITEM *item = malloc(sizeof(BN_POOL_ITEM));
if(!item) return NULL;
/* Initialise the structure */
bn = item->vals;
powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
else
#endif
- if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
+ if ((powerbufFree=(unsigned char*)malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
goto err;
powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
if (powerbuf!=NULL)
{
OPENSSL_cleanse(powerbuf,powerbufLen);
- if (powerbufFree) OPENSSL_free(powerbufFree);
+ if (powerbufFree) free(powerbufFree);
}
BN_CTX_end(ctx);
return(ret);
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
int *arr=NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
int *arr=NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) *
+ if ((arr = (int *)malloc(sizeof(int) *
max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
{
OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
- OPENSSL_free(a->d);
+ free(a->d);
}
i=BN_get_flags(a,BN_FLG_MALLOCED);
OPENSSL_cleanse(a,sizeof(BIGNUM));
if (i)
- OPENSSL_free(a);
+ free(a);
}
void BN_free(BIGNUM *a)
if (a == NULL) return;
bn_check_top(a);
if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA)))
- OPENSSL_free(a->d);
+ free(a->d);
if (a->flags & BN_FLG_MALLOCED)
- OPENSSL_free(a);
+ free(a);
else
{
#ifndef OPENSSL_NO_DEPRECATED
{
BIGNUM *ret;
- if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
+ if ((ret=(BIGNUM *)malloc(sizeof(BIGNUM))) == NULL)
{
BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return(NULL);
}
- a=A=(BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG)*words);
+ a=A=(BN_ULONG *)malloc(sizeof(BN_ULONG)*words);
if (A == NULL)
{
BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE);
else
{
/* r == NULL, BN_new failure */
- OPENSSL_free(a);
+ free(a);
}
}
/* If a == NULL, there was an error in allocation in
{
BN_ULONG *a = bn_expand_internal(b, words);
if(!a) return NULL;
- if(b->d) OPENSSL_free(b->d);
+ if(b->d) free(b->d);
b->d=a;
b->dmax=words;
}
{
BN_MONT_CTX *ret;
- if ((ret=(BN_MONT_CTX *)OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL)
+ if ((ret=(BN_MONT_CTX *)malloc(sizeof(BN_MONT_CTX))) == NULL)
return(NULL);
BN_MONT_CTX_init(ret);
BN_free(&(mont->N));
BN_free(&(mont->Ni));
if (mont->flags & BN_FLG_MALLOCED)
- OPENSSL_free(mont);
+ free(mont);
}
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
static const char Hex[]="0123456789ABCDEF";
-/* Must 'OPENSSL_free' the returned data */
+/* Must 'free' the returned data */
char *BN_bn2hex(const BIGNUM *a)
{
int i,j,v,z=0;
char *buf;
char *p;
- buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2);
+ buf=(char *)malloc(a->top*BN_BYTES*2+2);
if (buf == NULL)
{
BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE);
return(buf);
}
-/* Must 'OPENSSL_free' the returned data */
+/* Must 'free' the returned data */
char *BN_bn2dec(const BIGNUM *a)
{
int i=0,num, ok = 0;
*/
i=BN_num_bits(a)*3;
num=(i/10+i/1000+1)+1;
- bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
- buf=(char *)OPENSSL_malloc(num+3);
+ bn_data=(BN_ULONG *)malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
+ buf=(char *)malloc(num+3);
if ((buf == NULL) || (bn_data == NULL))
{
BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE);
}
ok = 1;
err:
- if (bn_data != NULL) OPENSSL_free(bn_data);
+ if (bn_data != NULL) free(bn_data);
if (t != NULL) BN_free(t);
if (!ok && buf)
{
- OPENSSL_free(buf);
+ free(buf);
buf = NULL;
}
bit=(bits-1)%8;
mask=0xff<<(bit+1);
- buf=(unsigned char *)OPENSSL_malloc(bytes);
+ buf=(unsigned char *)malloc(bytes);
if (buf == NULL)
{
BNerr(BN_F_BNRAND,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,bytes);
- OPENSSL_free(buf);
+ free(buf);
}
bn_check_top(rnd);
return(ret);
{
BN_RECP_CTX *ret;
- if ((ret=(BN_RECP_CTX *)OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL)
+ if ((ret=(BN_RECP_CTX *)malloc(sizeof(BN_RECP_CTX))) == NULL)
return(NULL);
BN_RECP_CTX_init(ret);
BN_free(&(recp->N));
BN_free(&(recp->Nr));
if (recp->flags & BN_FLG_MALLOCED)
- OPENSSL_free(recp);
+ free(recp);
}
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx)
if (str == NULL) return(NULL);
- ret=OPENSSL_malloc(siz+1);
+ ret=malloc(siz+1);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
if (data == NULL) return(NULL);
- ret=OPENSSL_malloc(siz);
+ ret=malloc(siz);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE);
{
BUF_MEM *ret;
- ret=OPENSSL_malloc(sizeof(BUF_MEM));
+ ret=malloc(sizeof(BUF_MEM));
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
if (a->data != NULL)
{
memset(a->data,0,(unsigned int)a->max);
- OPENSSL_free(a->data);
+ free(a->data);
}
- OPENSSL_free(a);
+ free(a);
}
int BUF_MEM_grow(BUF_MEM *str, size_t len)
}
n=(len+3)/3*4;
if (str->data == NULL)
- ret=OPENSSL_malloc(n);
+ ret=malloc(n);
else
- ret=OPENSSL_realloc(str->data,n);
+ ret=realloc(str->data,n);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
}
n=(len+3)/3*4;
if (str->data == NULL)
- ret=OPENSSL_malloc(n);
+ ret=malloc(n);
else
ret=OPENSSL_realloc_clean(str->data,str->max,n);
if (ret == NULL)
if (!key)
return 0;
r = pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key);
- OPENSSL_free(key);
+ free(key);
return r;
}
return -2;
CMAC_CTX *CMAC_CTX_new(void)
{
CMAC_CTX *ctx;
- ctx = OPENSSL_malloc(sizeof(CMAC_CTX));
+ ctx = malloc(sizeof(CMAC_CTX));
if (!ctx)
return NULL;
EVP_CIPHER_CTX_init(&ctx->cctx);
void CMAC_CTX_free(CMAC_CTX *ctx)
{
CMAC_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in)
if (kekri->key)
{
OPENSSL_cleanse(kekri->key, kekri->keylen);
- OPENSSL_free(kekri->key);
+ free(kekri->key);
}
}
else if (ri->type == CMS_RECIPINFO_PASS)
if (pwri->pass)
{
OPENSSL_cleanse(pwri->pass, pwri->passlen);
- OPENSSL_free(pwri->pass);
+ free(pwri->pass);
}
}
}
/* Generate random session key */
if (!enc || !ec->key)
{
- tkey = OPENSSL_malloc(tkeylen);
+ tkey = malloc(tkeylen);
if (!tkey)
{
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
{
/* Use random key */
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
ec->key = tkey;
ec->keylen = tkeylen;
tkey = NULL;
if (ec->key && !keep_key)
{
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
ec->key = NULL;
}
if (tkey)
{
OPENSSL_cleanse(tkey, tkeylen);
- OPENSSL_free(tkey);
+ free(tkey);
}
if (ok)
return b;
ec->cipher = cipher;
if (key)
{
- ec->key = OPENSSL_malloc(keylen);
+ ec->key = malloc(keylen);
if (!ec->key)
return 0;
memcpy(ec->key, key, keylen);
if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
ktri->encryptedKey->length) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (ec->key)
{
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
}
ec->key = ek;
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
goto err;
}
- wkey = OPENSSL_malloc(ec->keylen + 8);
+ wkey = malloc(ec->keylen + 8);
if (!wkey)
{
err:
if (!r && wkey)
- OPENSSL_free(wkey);
+ free(wkey);
OPENSSL_cleanse(&actx, sizeof(actx));
return r;
goto err;
}
- ukey = OPENSSL_malloc(kekri->encryptedKey->length - 8);
+ ukey = malloc(kekri->encryptedKey->length - 8);
if (!ukey)
{
err:
if (!r && ukey)
- OPENSSL_free(ukey);
+ free(ukey);
OPENSSL_cleanse(&actx, sizeof(actx));
return r;
if (ec->key)
{
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
ec->key = NULL;
ec->keylen = 0;
}
CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE);
if (rrder)
- OPENSSL_free(rrder);
+ free(rrder);
return r;
/* Invalid size */
return 0;
}
- tmp = OPENSSL_malloc(inlen);
+ tmp = malloc(inlen);
/* setup IV by decrypting last two blocks */
EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2);
rv = 1;
err:
OPENSSL_cleanse(tmp, inlen);
- OPENSSL_free(tmp);
+ free(tmp);
return rv;
}
if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx))
goto err;
- key = OPENSSL_malloc(keylen);
+ key = malloc(keylen);
if (!key)
goto err;
}
else
{
- key = OPENSSL_malloc(pwri->encryptedKey->length);
+ key = malloc(pwri->encryptedKey->length);
if (!key)
{
EVP_CIPHER_CTX_cleanup(&kekctx);
if (!r && key)
- OPENSSL_free(key);
+ free(key);
X509_ALGOR_free(kekalg);
return r;
{
unsigned char *sig;
unsigned int siglen;
- sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey));
+ sig = malloc(EVP_PKEY_size(si->pkey));
if (!sig)
{
CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,
{
CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,
CMS_R_SIGNFINAL_ERROR);
- OPENSSL_free(sig);
+ free(sig);
goto err;
}
ASN1_STRING_set0(si->signature, sig, siglen);
goto err;
if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0)
goto err;
- OPENSSL_free(abuf);
- abuf = OPENSSL_malloc(siglen);
+ free(abuf);
+ abuf = malloc(siglen);
if(!abuf)
goto err;
if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0)
err:
if (abuf)
- OPENSSL_free(abuf);
+ free(abuf);
EVP_MD_CTX_cleanup(&mctx);
return 0;
if(!abuf)
goto err;
r = EVP_DigestVerifyUpdate(&mctx, abuf, alen);
- OPENSSL_free(abuf);
+ free(abuf);
if (r <= 0)
{
r = -1;
return 0;
r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities,
V_ASN1_SEQUENCE, smder, smderlen);
- OPENSSL_free(smder);
+ free(smder);
return r;
}
{
void *p;
- p=OPENSSL_malloc(no*size);
+ p=malloc(no*size);
if (p)
memset(p, 0, no*size);
return p;
static void zlib_zfree(void* opaque, void* address)
{
- OPENSSL_free(address);
+ free(address);
}
#if 0
{
int err;
struct zlib_state *state =
- (struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state));
+ (struct zlib_state *)malloc(sizeof(struct zlib_state));
if (state == NULL)
goto err;
CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state);
return 1;
err:
- if (state) OPENSSL_free(state);
+ if (state) free(state);
return 0;
}
zlib_stateful_ex_idx);
inflateEnd(&state->istream);
deflateEnd(&state->ostream);
- OPENSSL_free(state);
+ free(state);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data);
}
return 0;
}
#endif
- ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX));
+ ctx = malloc(sizeof(BIO_ZLIB_CTX));
if(!ctx)
{
COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE);
{
/* Destroy decompress context */
inflateEnd(&ctx->zin);
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
}
if(ctx->obuf)
{
/* Destroy compress context */
deflateEnd(&ctx->zout);
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
}
- OPENSSL_free(ctx);
+ free(ctx);
bi->ptr = NULL;
bi->init = 0;
bi->flags = 0;
BIO_clear_retry_flags(b);
if(!ctx->ibuf)
{
- ctx->ibuf = OPENSSL_malloc(ctx->ibufsize);
+ ctx->ibuf = malloc(ctx->ibufsize);
if(!ctx->ibuf)
{
COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE);
BIO_clear_retry_flags(b);
if(!ctx->obuf)
{
- ctx->obuf = OPENSSL_malloc(ctx->obufsize);
+ ctx->obuf = malloc(ctx->obufsize);
/* Need error here */
if(!ctx->obuf)
{
{
if (ctx->ibuf)
{
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
ctx->ibuf = NULL;
}
ctx->ibufsize = ibs;
{
if (ctx->obuf)
{
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
ctx->obuf = NULL;
}
ctx->obufsize = obs;
{
COMP_CTX *ret;
- if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL)
+ if ((ret=(COMP_CTX *)malloc(sizeof(COMP_CTX))) == NULL)
{
/* ZZZZZZZZZZZZZZZZ */
return(NULL);
ret->meth=meth;
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
if (ctx->meth->finish != NULL)
ctx->meth->finish(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
if (v != NULL)
{
(void)sk_CONF_VALUE_delete_ptr(ts,v);
- OPENSSL_free(v->name);
- OPENSSL_free(v->value);
- OPENSSL_free(v);
+ free(v->name);
+ free(v->value);
+ free(v);
}
return 1;
}
if (conf == NULL || conf->data == NULL) return;
lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make
- * sure the 'OPENSSL_free()' works as
+ * sure the 'free()' works as
* expected */
lh_CONF_VALUE_doall_arg(conf->data,
LHASH_DOALL_ARG_FN(value_free_hash),
for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--)
{
vv=sk_CONF_VALUE_value(sk,i);
- OPENSSL_free(vv->value);
- OPENSSL_free(vv->name);
- OPENSSL_free(vv);
+ free(vv->value);
+ free(vv->name);
+ free(vv);
}
if (sk != NULL) sk_CONF_VALUE_free(sk);
- OPENSSL_free(a->section);
- OPENSSL_free(a);
+ free(a->section);
+ free(a);
}
/* Up until OpenSSL 0.9.5a, this was new_section */
if ((sk=sk_CONF_VALUE_new_null()) == NULL)
goto err;
- if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL)
+ if ((v=malloc(sizeof(CONF_VALUE))) == NULL)
goto err;
i=strlen(section)+1;
- if ((v->section=OPENSSL_malloc(i)) == NULL)
+ if ((v->section=malloc(i)) == NULL)
goto err;
memcpy(v->section,section,i);
if (!ok)
{
if (sk != NULL) sk_CONF_VALUE_free(sk);
- if (v != NULL) OPENSSL_free(v);
+ if (v != NULL) free(v);
v=NULL;
}
return(v);
{
CONF *ret;
- ret = OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
+ ret = malloc(sizeof(CONF) + sizeof(unsigned short *));
if (ret)
if (meth->init(ret) == 0)
{
- OPENSSL_free(ret);
+ free(ret);
ret = NULL;
}
return ret;
{
if (def_destroy_data(conf))
{
- OPENSSL_free(conf);
+ free(conf);
return 1;
}
return 0;
goto err;
}
- section=(char *)OPENSSL_malloc(10);
+ section=(char *)malloc(10);
if (section == NULL)
{
CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
p++;
*p='\0';
- if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
+ if (!(v=(CONF_VALUE *)malloc(sizeof(CONF_VALUE))))
{
CONFerr(CONF_F_DEF_LOAD_BIO,
ERR_R_MALLOC_FAILURE);
goto err;
}
if (psection == NULL) psection=section;
- v->name=(char *)OPENSSL_malloc(strlen(pname)+1);
+ v->name=(char *)malloc(strlen(pname)+1);
v->value=NULL;
if (v->name == NULL)
{
if (vv != NULL)
{
sk_CONF_VALUE_delete_ptr(ts,vv);
- OPENSSL_free(vv->name);
- OPENSSL_free(vv->value);
- OPENSSL_free(vv);
+ free(vv->name);
+ free(vv->value);
+ free(vv);
}
#endif
v=NULL;
}
}
if (buff != NULL) BUF_MEM_free(buff);
- if (section != NULL) OPENSSL_free(section);
+ if (section != NULL) free(section);
return(1);
err:
if (buff != NULL) BUF_MEM_free(buff);
- if (section != NULL) OPENSSL_free(section);
+ if (section != NULL) free(section);
if (line != NULL) *line=eline;
(void) snprintf(btmp,sizeof btmp,"%ld",eline);
ERR_add_error_data(2,"line ",btmp);
}
if (v != NULL)
{
- if (v->name != NULL) OPENSSL_free(v->name);
- if (v->value != NULL) OPENSSL_free(v->value);
- if (v != NULL) OPENSSL_free(v);
+ if (v->name != NULL) free(v->name);
+ if (v->value != NULL) free(v->value);
+ if (v != NULL) free(v);
}
return(0);
}
buf->data[to++]= *(from++);
}
buf->data[to]='\0';
- if (*pto != NULL) OPENSSL_free(*pto);
+ if (*pto != NULL) free(*pto);
*pto=buf->data;
- OPENSSL_free(buf);
+ free(buf);
return(1);
err:
if (buf != NULL) BUF_MEM_free(buf);
err:
if (filename == NULL)
- OPENSSL_free(file);
+ free(file);
NCONF_free(conf);
return ret;
supported_modules = sk_CONF_MODULE_new_null();
if (supported_modules == NULL)
return NULL;
- tmod = OPENSSL_malloc(sizeof(CONF_MODULE));
+ tmod = malloc(sizeof(CONF_MODULE));
if (tmod == NULL)
return NULL;
if (!sk_CONF_MODULE_push(supported_modules, tmod))
{
- OPENSSL_free(tmod);
+ free(tmod);
return NULL;
}
CONF_IMODULE *imod = NULL;
/* Otherwise add initialized module to list */
- imod = OPENSSL_malloc(sizeof(CONF_IMODULE));
+ imod = malloc(sizeof(CONF_IMODULE));
if (!imod)
goto err;
if (imod)
{
if (imod->name)
- OPENSSL_free(imod->name);
+ free(imod->name);
if (imod->value)
- OPENSSL_free(imod->value);
- OPENSSL_free(imod);
+ free(imod->value);
+ free(imod);
}
return -1;
{
if (md->dso)
DSO_free(md->dso);
- OPENSSL_free(md->name);
- OPENSSL_free(md);
+ free(md->name);
+ free(md);
}
/* finish and free up all modules instances */
if (imod->pmod->finish)
imod->pmod->finish(imod);
imod->pmod->links--;
- OPENSSL_free(imod->name);
- OPENSSL_free(imod->value);
- OPENSSL_free(imod);
+ free(imod->name);
+ free(imod->value);
+ free(imod);
}
/* Add a static module to OpenSSL */
#endif
len += strlen(OPENSSL_CONF);
- file = OPENSSL_malloc(len + 1);
+ file = malloc(len + 1);
if (!file)
return NULL;
}
i = sk_OPENSSL_STRING_push(app_locks, str);
if (!i)
- OPENSSL_free(str);
+ free(str);
else
i += CRYPTO_NUM_LOCKS; /* gap of one :-) */
return (i);
}
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
- pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock));
+ pointer = (CRYPTO_dynlock *)malloc(sizeof(CRYPTO_dynlock));
if (pointer == NULL) {
CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
return (0);
pointer->references = 1;
pointer->data = dynlock_create_callback(__FILE__, __LINE__);
if (pointer->data == NULL) {
- OPENSSL_free(pointer);
+ free(pointer);
CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
return (0);
}
if (i == -1) {
dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
- OPENSSL_free(pointer);
+ free(pointer);
} else
i += 1; /* to avoid 0 */
return - i;
if (pointer) {
dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
- OPENSSL_free(pointer);
+ free(pointer);
}
}
if (tmpbuf == NULL)
{
- tmpbuf=OPENSSL_malloc(BSIZE);
+ tmpbuf=malloc(BSIZE);
if (tmpbuf == NULL) return(-1);
}
if (net == NULL)
{
- net=OPENSSL_malloc(BSIZE);
+ net=malloc(BSIZE);
if (net == NULL) return(-1);
}
if (unnet == NULL)
{
- unnet=OPENSSL_malloc(BSIZE);
+ unnet=malloc(BSIZE);
if (unnet == NULL) return(-1);
}
/* left over data from last decrypt */
if (outbuf == NULL)
{
- outbuf=OPENSSL_malloc(BSIZE+HDRSIZE);
+ outbuf=malloc(BSIZE+HDRSIZE);
if (outbuf == NULL) return(-1);
}
/* If we are sending less than 8 bytes, the same char will look
err:
if (penc)
- OPENSSL_free(penc);
+ free(penc);
if (pval)
ASN1_STRING_free(pval);
err:
if (dp != NULL)
- OPENSSL_free(dp);
+ free(dp);
if (params != NULL)
ASN1_STRING_free(params);
if (prkey != NULL)
else
ktype = "PKCS#3 DH Parameters";
- m= OPENSSL_malloc(buf_len+10);
+ m= malloc(buf_len+10);
if (m == NULL)
{
reason=ERR_R_MALLOC_FAILURE;
err:
DHerr(DH_F_DO_DH_PRINT,reason);
}
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
{
DH *ret;
- ret=(DH *)OPENSSL_malloc(sizeof(DH));
+ ret=(DH *)malloc(sizeof(DH));
if (ret == NULL)
{
DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (!ENGINE_init(engine))
{
DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
ret->engine = engine;
{
DHerr(DH_F_DH_NEW_METHOD,ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
if (r->g != NULL) BN_clear_free(r->g);
if (r->q != NULL) BN_clear_free(r->q);
if (r->j != NULL) BN_clear_free(r->j);
- if (r->seed) OPENSSL_free(r->seed);
+ if (r->seed) free(r->seed);
if (r->counter != NULL) BN_clear_free(r->counter);
if (r->pub_key != NULL) BN_clear_free(r->pub_key);
if (r->priv_key != NULL) BN_clear_free(r->priv_key);
- OPENSSL_free(r);
+ free(r);
}
int DH_up_ref(DH *r)
static int pkey_dh_init(EVP_PKEY_CTX *ctx)
{
DH_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(DH_PKEY_CTX));
+ dctx = malloc(sizeof(DH_PKEY_CTX));
if (!dctx)
return 0;
dctx->prime_len = 1024;
{
DH_PKEY_CTX *dctx = ctx->data;
if (dctx)
- OPENSSL_free(dctx);
+ free(dctx);
}
static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
err:
if (penc)
- OPENSSL_free(penc);
+ free(penc);
if (pval)
ASN1_STRING_free(pval);
err:
if (dp != NULL)
- OPENSSL_free(dp);
+ free(dp);
if (params != NULL)
ASN1_STRING_free(params);
if (prkey != NULL)
update_buflen(priv_key, &buf_len);
update_buflen(pub_key, &buf_len);
- m=(unsigned char *)OPENSSL_malloc(buf_len+10);
+ m=(unsigned char *)malloc(buf_len+10);
if (m == NULL)
{
DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);
if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err;
ret=1;
err:
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
unsigned char *m=NULL;
update_buflen(dsa_sig->r, &buf_len);
update_buflen(dsa_sig->s, &buf_len);
- m = OPENSSL_malloc(buf_len+10);
+ m = malloc(buf_len+10);
if (m == NULL)
{
DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE);
rv = 1;
err:
if (m)
- OPENSSL_free(m);
+ free(m);
DSA_SIG_free(dsa_sig);
return rv;
}
{
if(operation == ASN1_OP_NEW_PRE) {
DSA_SIG *sig;
- sig = OPENSSL_malloc(sizeof(DSA_SIG));
+ sig = malloc(sizeof(DSA_SIG));
if (!sig)
{
DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE);
{
DSA *ret;
- ret=(DSA *)OPENSSL_malloc(sizeof(DSA));
+ ret=(DSA *)malloc(sizeof(DSA));
if (ret == NULL)
{
DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (!ENGINE_init(engine))
{
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
ret->engine = engine;
DSAerr(DSA_F_DSA_NEW_METHOD,
ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
if (r->priv_key != NULL) BN_clear_free(r->priv_key);
if (r->kinv != NULL) BN_clear_free(r->kinv);
if (r->r != NULL) BN_clear_free(r->r);
- OPENSSL_free(r);
+ free(r);
}
int DSA_up_ref(DSA *r)
static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
{
DSA_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(DSA_PKEY_CTX));
+ dctx = malloc(sizeof(DSA_PKEY_CTX));
if (!dctx)
return 0;
dctx->nbits = 1024;
{
DSA_PKEY_CTX *dctx = ctx->data;
if (dctx)
- OPENSSL_free(dctx);
+ free(dctx);
}
static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
DSA_SIG *DSA_SIG_new(void)
{
DSA_SIG *sig;
- sig = OPENSSL_malloc(sizeof(DSA_SIG));
+ sig = malloc(sizeof(DSA_SIG));
if (!sig)
return NULL;
sig->r = NULL;
BN_free(sig->r);
if (sig->s)
BN_free(sig->s);
- OPENSSL_free(sig);
+ free(sig);
}
}
* (or NULL if they are to be used independantly of a DSO object) and a
* filename to transform. They should either return NULL (if there is an error
* condition) or a newly allocated string containing the transformed form that
- * the caller will need to free with OPENSSL_free() when done. */
+ * the caller will need to free with free() when done. */
typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
/* The function prototype used for method functions (or caller-provided
* callbacks) that merge two file specifications. They are passed a
* a DSO object) and two file specifications to merge. They should
* either return NULL (if there is an error condition) or a newly allocated
* string containing the result of merging that the caller will need
- * to free with OPENSSL_free() when done.
+ * to free with free() when done.
* Here, merging means that bits and pieces are taken from each of the
* file specifications and added together in whatever fashion that is
* sensible for the DSO method in question. The only rule that really
const char *name;
/* Loads a shared library, NB: new DSO_METHODs must ensure that a
* successful load populates the loaded_filename field, and likewise a
- * successful unload OPENSSL_frees and NULLs it out. */
+ * successful unload frees and NULLs it out. */
int (*dso_load)(DSO *dso);
/* Unloads a shared library */
int (*dso_unload)(DSO *dso);
* simply duplicated. NB: This function is usually called from within a
* DSO_METHOD during the processing of a DSO_load() call, and is exposed so that
* caller-created DSO_METHODs can do the same thing. A non-NULL return value
- * will need to be OPENSSL_free()'d. */
+ * will need to be free()'d. */
char *DSO_convert_filename(DSO *dso, const char *filename);
/* This function will invoke the DSO's merger callback to merge two file
* specifications, or if the callback isn't set it will instead use the
* DSO_METHOD's merger. A non-NULL return value will need to be
- * OPENSSL_free()'d. */
+ * free()'d. */
char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
/* If the DSO is currently loaded, this returns the filename that it was loaded
* under, otherwise it returns NULL. So it is also useful as a test as to
err:
/* Cleanup! */
if(filename != NULL)
- OPENSSL_free(filename);
+ free(filename);
if(ptr != NULL)
dlclose(ptr);
return(0);
if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/'))
{
len = strlen(filespec1) + 1;
- merged = OPENSSL_malloc(len);
+ merged = malloc(len);
if(!merged)
{
DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
else if (!filespec1)
{
len = strlen(filespec2) + 1;
- merged = OPENSSL_malloc(strlen(filespec2) + 1);
+ merged = malloc(strlen(filespec2) + 1);
if(!merged)
{
DSOerr(DSO_F_DLFCN_MERGER,
spec2len--;
len--;
}
- merged = OPENSSL_malloc(len + 2);
+ merged = malloc(len + 2);
if(!merged)
{
DSOerr(DSO_F_DLFCN_MERGER,
if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
rsize += 3; /* The length of "lib" */
}
- translated = OPENSSL_malloc(rsize);
+ translated = malloc(rsize);
if(translated == NULL)
{
DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
* to stealing the "best available" method. Will fallback
* to DSO_METH_null() in the worst case. */
default_DSO_meth = DSO_METHOD_openssl();
- ret = (DSO *)OPENSSL_malloc(sizeof(DSO));
+ ret = (DSO *)malloc(sizeof(DSO));
if(ret == NULL)
{
DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
{
/* sk_new doesn't generate any errors so we do */
DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
- OPENSSL_free(ret);
+ free(ret);
return(NULL);
}
if(meth == NULL)
ret->references = 1;
if((ret->meth->init != NULL) && !ret->meth->init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
sk_void_free(dso->meth_data);
if(dso->filename != NULL)
- OPENSSL_free(dso->filename);
+ free(dso->filename);
if(dso->loaded_filename != NULL)
- OPENSSL_free(dso->loaded_filename);
+ free(dso->loaded_filename);
- OPENSSL_free(dso);
+ free(dso);
return(1);
}
return(0);
}
/* We'll duplicate filename */
- copied = OPENSSL_malloc(strlen(filename) + 1);
+ copied = malloc(strlen(filename) + 1);
if(copied == NULL)
{
DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE);
}
BUF_strlcpy(copied, filename, strlen(filename) + 1);
if(dso->filename)
- OPENSSL_free(dso->filename);
+ free(dso->filename);
dso->filename = copied;
return(1);
}
}
if(result == NULL)
{
- result = OPENSSL_malloc(strlen(filename) + 1);
+ result = malloc(strlen(filename) + 1);
if(result == NULL)
{
DSOerr(DSO_F_DSO_CONVERT_FILENAME,
penclen = i2o_ECPublicKey(ec_key, NULL);
if (penclen <= 0)
goto err;
- penc = OPENSSL_malloc(penclen);
+ penc = malloc(penclen);
if (!penc)
goto err;
p = penc;
else
ASN1_STRING_free(pval);
if (penc)
- OPENSSL_free(penc);
+ free(penc);
return 0;
}
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
return 0;
}
- ep = (unsigned char *) OPENSSL_malloc(eplen);
+ ep = (unsigned char *) malloc(eplen);
if (!ep)
{
EC_KEY_set_enc_flags(ec_key, old_flags);
if (!i2d_ECPrivateKey(ec_key, &p))
{
EC_KEY_set_enc_flags(ec_key, old_flags);
- OPENSSL_free(ep);
+ free(ep);
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
}
/* restore old encoding flags */
if (ktype > 0)
{
buf_len += 10;
- if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buffer = malloc(buf_len)) == NULL)
{
reason = ERR_R_MALLOC_FAILURE;
goto err;
if (ctx)
BN_CTX_free(ctx);
if (buffer != NULL)
- OPENSSL_free(buffer);
+ free(buffer);
return(ret);
}
}
else
{
- if ((buffer_1 = OPENSSL_malloc(len_1)) == NULL)
+ if ((buffer_1 = malloc(len_1)) == NULL)
{
ECerr(EC_F_EC_ASN1_GROUP2CURVE,
ERR_R_MALLOC_FAILURE);
}
else
{
- if ((buffer_2 = OPENSSL_malloc(len_2)) == NULL)
+ if ((buffer_2 = malloc(len_2)) == NULL)
{
ECerr(EC_F_EC_ASN1_GROUP2CURVE,
ERR_R_MALLOC_FAILURE);
ok = 1;
err: if (buffer_1)
- OPENSSL_free(buffer_1);
+ free(buffer_1);
if (buffer_2)
- OPENSSL_free(buffer_2);
+ free(buffer_2);
if (tmp_1)
BN_free(tmp_1);
if (tmp_2)
ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_EC_LIB);
goto err;
}
- if ((buffer = OPENSSL_malloc(len)) == NULL)
+ if ((buffer = malloc(len)) == NULL)
{
ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_MALLOC_FAILURE);
goto err;
if (tmp)
BN_free(tmp);
if (buffer)
- OPENSSL_free(buffer);
+ free(buffer);
return(ret);
}
if (params->curve->seed != NULL)
{
if (ret->seed != NULL)
- OPENSSL_free(ret->seed);
- if (!(ret->seed = OPENSSL_malloc(params->curve->seed->length)))
+ free(ret->seed);
+ if (!(ret->seed = malloc(params->curve->seed->length)))
{
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
ERR_R_MALLOC_FAILURE);
priv_key->version = a->version;
buf_len = (size_t)BN_num_bytes(a->priv_key);
- buffer = OPENSSL_malloc(buf_len);
+ buffer = malloc(buf_len);
if (buffer == NULL)
{
ECerr(EC_F_I2D_ECPRIVATEKEY,
if (tmp_len > buf_len)
{
- unsigned char *tmp_buffer = OPENSSL_realloc(buffer, tmp_len);
+ unsigned char *tmp_buffer = realloc(buffer, tmp_len);
if (!tmp_buffer)
{
ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
ok=1;
err:
if (buffer)
- OPENSSL_free(buffer);
+ free(buffer);
if (priv_key)
EC_PRIVATEKEY_free(priv_key);
return(ok?ret:0);
if (*out == NULL)
{
- if ((*out = OPENSSL_malloc(buf_len)) == NULL)
+ if ((*out = malloc(buf_len)) == NULL)
{
ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE);
return 0;
*out, buf_len, NULL))
{
ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB);
- OPENSSL_free(*out);
+ free(*out);
*out = NULL;
return 0;
}
{
EC_KEY *ret;
- ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
+ ret=(EC_KEY *)malloc(sizeof(EC_KEY));
if (ret == NULL)
{
ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
OPENSSL_cleanse((void *)r, sizeof(EC_KEY));
- OPENSSL_free(r);
+ free(r);
}
EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
return NULL;
}
- ret = OPENSSL_malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (ret == NULL)
{
ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE);
if (!meth->group_init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
BN_free(&group->cofactor);
if (group->seed)
- OPENSSL_free(group->seed);
+ free(group->seed);
- OPENSSL_free(group);
+ free(group);
}
if (group->seed)
{
OPENSSL_cleanse(group->seed, group->seed_len);
- OPENSSL_free(group->seed);
+ free(group->seed);
}
OPENSSL_cleanse(group, sizeof *group);
- OPENSSL_free(group);
+ free(group);
}
if (src->seed)
{
if (dest->seed)
- OPENSSL_free(dest->seed);
- dest->seed = OPENSSL_malloc(src->seed_len);
+ free(dest->seed);
+ dest->seed = malloc(src->seed_len);
if (dest->seed == NULL)
return 0;
if (!memcpy(dest->seed, src->seed, src->seed_len))
else
{
if (dest->seed)
- OPENSSL_free(dest->seed);
+ free(dest->seed);
dest->seed = NULL;
dest->seed_len = 0;
}
{
if (group->seed)
{
- OPENSSL_free(group->seed);
+ free(group->seed);
group->seed = NULL;
group->seed_len = 0;
}
if (!len || !p)
return 1;
- if ((group->seed = OPENSSL_malloc(len)) == NULL)
+ if ((group->seed = malloc(len)) == NULL)
return 0;
memcpy(group->seed, p, len);
group->seed_len = len;
/* no explicit entry needed */
return 1;
- d = OPENSSL_malloc(sizeof *d);
+ d = malloc(sizeof *d);
if (d == NULL)
return 0;
EC_EXTRA_DATA *next = (*p)->next;
(*p)->free_func((*p)->data);
- OPENSSL_free(*p);
+ free(*p);
*p = next;
return;
EC_EXTRA_DATA *next = (*p)->next;
(*p)->clear_free_func((*p)->data);
- OPENSSL_free(*p);
+ free(*p);
*p = next;
return;
EC_EXTRA_DATA *next = d->next;
d->free_func(d->data);
- OPENSSL_free(d);
+ free(d);
d = next;
}
EC_EXTRA_DATA *next = d->next;
d->clear_free_func(d->data);
- OPENSSL_free(d);
+ free(d);
d = next;
}
return NULL;
}
- ret = OPENSSL_malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (ret == NULL)
{
ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE);
if (!ret->meth->point_init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
if (point->meth->point_finish != 0)
point->meth->point_finish(point);
- OPENSSL_free(point);
+ free(point);
}
else if (point->meth->point_finish != 0)
point->meth->point_finish(point);
OPENSSL_cleanse(point, sizeof *point);
- OPENSSL_free(point);
+ free(point);
}
if (!group)
return NULL;
- ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
+ ret = (EC_PRE_COMP *)malloc(sizeof(EC_PRE_COMP));
if (!ret)
{
ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
for (p = pre->points; *p != NULL; p++)
EC_POINT_free(*p);
- OPENSSL_free(pre->points);
+ free(pre->points);
}
- OPENSSL_free(pre);
+ free(pre);
}
static void ec_pre_comp_clear_free(void *pre_)
EC_POINT_clear_free(*p);
OPENSSL_cleanse(p, sizeof *p);
}
- OPENSSL_free(pre->points);
+ free(pre->points);
}
OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ free(pre);
}
if (BN_is_zero(scalar))
{
- r = OPENSSL_malloc(1);
+ r = malloc(1);
if (!r)
{
ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
}
len = BN_num_bits(scalar);
- r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation
+ r = malloc(len + 1); /* modified wNAF may be one digit longer than binary representation
* (*ret_len will be set to the actual length, i.e. at most
* BN_num_bits(scalar) + 1) */
if (r == NULL)
err:
if (!ok)
{
- OPENSSL_free(r);
+ free(r);
r = NULL;
}
if (ok)
totalnum = num + numblocks;
- wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
- wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
- wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */
- val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
+ wsize = malloc(totalnum * sizeof wsize[0]);
+ wNAF_len = malloc(totalnum * sizeof wNAF_len[0]);
+ wNAF = malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */
+ val_sub = malloc(totalnum * sizeof val_sub[0]);
if (!wsize || !wNAF_len || !wNAF || !val_sub)
{
wNAF_len[i] = tmp_len;
wNAF[i + 1] = NULL;
- wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
+ wNAF[i] = malloc(wNAF_len[i]);
if (wNAF[i] == NULL)
{
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
- OPENSSL_free(tmp_wNAF);
+ free(tmp_wNAF);
goto err;
}
memcpy(wNAF[i], pp, wNAF_len[i]);
if (*tmp_points == NULL)
{
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
- OPENSSL_free(tmp_wNAF);
+ free(tmp_wNAF);
goto err;
}
val_sub[i] = tmp_points;
tmp_points += pre_points_per_block;
pp += blocksize;
}
- OPENSSL_free(tmp_wNAF);
+ free(tmp_wNAF);
}
}
}
/* All points we precompute now go into a single array 'val'.
* 'val_sub[i]' is a pointer to the subarray for the i-th point,
* or to a subarray of 'pre_comp->points' if we already have precomputation. */
- val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
+ val = malloc((num_val + 1) * sizeof val[0]);
if (val == NULL)
{
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
if (tmp != NULL)
EC_POINT_free(tmp);
if (wsize != NULL)
- OPENSSL_free(wsize);
+ free(wsize);
if (wNAF_len != NULL)
- OPENSSL_free(wNAF_len);
+ free(wNAF_len);
if (wNAF != NULL)
{
signed char **w;
for (w = wNAF; *w != NULL; w++)
- OPENSSL_free(*w);
+ free(*w);
- OPENSSL_free(wNAF);
+ free(wNAF);
}
if (val != NULL)
{
for (v = val; *v != NULL; v++)
EC_POINT_clear_free(*v);
- OPENSSL_free(val);
+ free(val);
}
if (val_sub != NULL)
{
- OPENSSL_free(val_sub);
+ free(val_sub);
}
return ret;
}
pre_points_per_block = (size_t)1 << (w - 1);
num = pre_points_per_block * numblocks; /* number of points to compute and store */
- points = OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1));
+ points = malloc(sizeof (EC_POINT*)*(num + 1));
if (!points)
{
ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE);
for (p = points; *p != NULL; p++)
EC_POINT_free(*p);
- OPENSSL_free(points);
+ free(points);
}
if (tmp_point)
EC_POINT_free(tmp_point);
static int pkey_ec_init(EVP_PKEY_CTX *ctx)
{
EC_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(EC_PKEY_CTX));
+ dctx = malloc(sizeof(EC_PKEY_CTX));
if (!dctx)
return 0;
dctx->gen_group = NULL;
{
if (dctx->gen_group)
EC_GROUP_free(dctx->gen_group);
- OPENSSL_free(dctx);
+ free(dctx);
}
}
if (buf_len == 0)
return NULL;
- if ((buf = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buf = malloc(buf_len)) == NULL)
return NULL;
if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx))
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
ret = BN_bin2bn(buf, buf_len, ret);
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
EC_POINT *ret;
if ((buf_len = BN_num_bytes(bn)) == 0) return NULL;
- buf = OPENSSL_malloc(buf_len);
+ buf = malloc(buf_len);
if (buf == NULL)
return NULL;
if (!BN_bn2bin(bn, buf))
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
{
if ((ret = EC_POINT_new(group)) == NULL)
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
}
{
if (point == NULL)
EC_POINT_clear_free(ret);
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
static const char *HEX_DIGITS = "0123456789ABCDEF";
-/* the return value must be freed (using OPENSSL_free()) */
+/* the return value must be freed (using free()) */
char *EC_POINT_point2hex(const EC_GROUP *group,
const EC_POINT *point,
point_conversion_form_t form,
if (buf_len == 0)
return NULL;
- if ((buf = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buf = malloc(buf_len)) == NULL)
return NULL;
if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx))
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
- ret = (char *)OPENSSL_malloc(buf_len*2+2);
+ ret = (char *)malloc(buf_len*2+2);
if (ret == NULL)
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
p = ret;
}
*p='\0';
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
seed_len = EC_GROUP_get_seed_len(x);
buf_len += 10;
- if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buffer = malloc(buf_len)) == NULL)
{
reason = ERR_R_MALLOC_FAILURE;
goto err;
if (ctx)
BN_CTX_free(ctx);
if (buffer != NULL)
- OPENSSL_free(buffer);
+ free(buffer);
return(ret);
}
static NISTP224_PRE_COMP *nistp224_pre_comp_new()
{
NISTP224_PRE_COMP *ret = NULL;
- ret = (NISTP224_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ ret = (NISTP224_PRE_COMP *) malloc(sizeof *ret);
if (!ret)
{
ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- OPENSSL_free(pre);
+ free(pre);
}
static void nistp224_pre_comp_clear_free(void *pre_)
return;
OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ free(pre);
}
/******************************************************************************/
* converting those into affine form is time well spent */
mixed = 1;
}
- secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
- pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
+ secrets = malloc(num_points * sizeof(felem_bytearray));
+ pre_comp = malloc(num_points * 17 * 3 * sizeof(felem));
if (mixed)
- tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
+ tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem));
if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL)))
{
ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
if (secrets != NULL)
- OPENSSL_free(secrets);
+ free(secrets);
if (pre_comp != NULL)
- OPENSSL_free(pre_comp);
+ free(pre_comp);
if (tmp_felems != NULL)
- OPENSSL_free(tmp_felems);
+ free(tmp_felems);
return ret;
}
static NISTP256_PRE_COMP *nistp256_pre_comp_new()
{
NISTP256_PRE_COMP *ret = NULL;
- ret = (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ ret = (NISTP256_PRE_COMP *) malloc(sizeof *ret);
if (!ret)
{
ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- OPENSSL_free(pre);
+ free(pre);
}
static void nistp256_pre_comp_clear_free(void *pre_)
return;
OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ free(pre);
}
/******************************************************************************/
* converting those into affine form is time well spent */
mixed = 1;
}
- secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
- pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem));
+ secrets = malloc(num_points * sizeof(felem_bytearray));
+ pre_comp = malloc(num_points * 17 * 3 * sizeof(smallfelem));
if (mixed)
- tmp_smallfelems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(smallfelem));
+ tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem));
if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL)))
{
ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
if (secrets != NULL)
- OPENSSL_free(secrets);
+ free(secrets);
if (pre_comp != NULL)
- OPENSSL_free(pre_comp);
+ free(pre_comp);
if (tmp_smallfelems != NULL)
- OPENSSL_free(tmp_smallfelems);
+ free(tmp_smallfelems);
return ret;
}
static NISTP521_PRE_COMP *nistp521_pre_comp_new()
{
NISTP521_PRE_COMP *ret = NULL;
- ret = (NISTP521_PRE_COMP *)OPENSSL_malloc(sizeof(NISTP521_PRE_COMP));
+ ret = (NISTP521_PRE_COMP *)malloc(sizeof(NISTP521_PRE_COMP));
if (!ret)
{
ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- OPENSSL_free(pre);
+ free(pre);
}
static void nistp521_pre_comp_clear_free(void *pre_)
return;
OPENSSL_cleanse(pre, sizeof(*pre));
- OPENSSL_free(pre);
+ free(pre);
}
/******************************************************************************/
* converting those into affine form is time well spent */
mixed = 1;
}
- secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
- pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
+ secrets = malloc(num_points * sizeof(felem_bytearray));
+ pre_comp = malloc(num_points * 17 * 3 * sizeof(felem));
if (mixed)
- tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
+ tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem));
if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL)))
{
ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
if (secrets != NULL)
- OPENSSL_free(secrets);
+ free(secrets);
if (pre_comp != NULL)
- OPENSSL_free(pre_comp);
+ free(pre_comp);
if (tmp_felems != NULL)
- OPENSSL_free(tmp_felems);
+ free(tmp_felems);
return ret;
}
* We need twice that. */
pow2 <<= 1;
- heap = OPENSSL_malloc(pow2 * sizeof heap[0]);
+ heap = malloc(pow2 * sizeof heap[0]);
if (heap == NULL) goto err;
/* The array is used as a binary tree, exactly as in heapsort:
if (heap[i] != NULL)
BN_clear_free(heap[i]);
}
- OPENSSL_free(heap);
+ free(heap);
}
return ret;
}
{
ECDH_DATA *ret;
- ret=(ECDH_DATA *)OPENSSL_malloc(sizeof(ECDH_DATA));
+ ret=(ECDH_DATA *)malloc(sizeof(ECDH_DATA));
if (ret == NULL)
{
ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
{
ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
#endif
OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA));
- OPENSSL_free(r);
+ free(r);
}
ECDH_DATA *ecdh_check(EC_KEY *key)
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR);
goto err;
}
- if ((buf = OPENSSL_malloc(buflen)) == NULL)
+ if ((buf = malloc(buflen)) == NULL)
{
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);
goto err;
if (tmp) EC_POINT_free(tmp);
if (ctx) BN_CTX_end(ctx);
if (ctx) BN_CTX_free(ctx);
- if (buf) OPENSSL_free(buf);
+ if (buf) free(buf);
return(ret);
}
{
ECDSA_DATA *ret;
- ret=(ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA));
+ ret=(ECDSA_DATA *)malloc(sizeof(ECDSA_DATA));
if (ret == NULL)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
#endif
OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA));
- OPENSSL_free(r);
+ free(r);
}
ECDSA_DATA *ecdsa_check(EC_KEY *key)
* structure. */
static int dynamic_ex_data_idx = -1;
-static void int_free_str(char *s) { OPENSSL_free(s); }
+static void int_free_str(char *s) { free(s); }
/* Because our ex_data element may or may not get allocated depending on whether
* a "first-use" occurs before the ENGINE is freed, we have a memory leak
* problem to solve. We can't declare a "new" handler for the ex_data as we
if(ctx->dynamic_dso)
DSO_free(ctx->dynamic_dso);
if(ctx->DYNAMIC_LIBNAME)
- OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME);
+ free((void*)ctx->DYNAMIC_LIBNAME);
if(ctx->engine_id)
- OPENSSL_free((void*)ctx->engine_id);
+ free((void*)ctx->engine_id);
if(ctx->dirs)
sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str);
- OPENSSL_free(ctx);
+ free(ctx);
}
}
static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
{
dynamic_data_ctx *c;
- c = OPENSSL_malloc(sizeof(dynamic_data_ctx));
+ c = malloc(sizeof(dynamic_data_ctx));
if(!c)
{
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
if(!c->dirs)
{
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
- OPENSSL_free(c);
+ free(c);
return 0;
}
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
/* If we lost the race to set the context, c is non-NULL and *ctx is the
* context of the thread that won. */
if(c)
- OPENSSL_free(c);
+ free(c);
return 1;
}
if(p && (strlen((const char *)p) < 1))
p = NULL;
if(ctx->DYNAMIC_LIBNAME)
- OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME);
+ free((void*)ctx->DYNAMIC_LIBNAME);
if(p)
ctx->DYNAMIC_LIBNAME = BUF_strdup(p);
else
if(p && (strlen((const char *)p) < 1))
p = NULL;
if(ctx->engine_id)
- OPENSSL_free((void*)ctx->engine_id);
+ free((void*)ctx->engine_id);
if(p)
ctx->engine_id = BUF_strdup(p);
else
if(DSO_load(ctx->dynamic_dso, merge, NULL, 0))
{
/* Found what we're looking for */
- OPENSSL_free(merge);
+ free(merge);
return 1;
}
- OPENSSL_free(merge);
+ free(merge);
}
return 0;
}
{
ENGINE *ret;
- ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE));
+ ret = (ENGINE *)malloc(sizeof(ENGINE));
if(ret == NULL)
{
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
if(e->destroy)
e->destroy(e);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data);
- OPENSSL_free(e);
+ free(e);
return 1;
}
}
static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
{
- ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(
+ ENGINE_CLEANUP_ITEM *item = malloc(sizeof(
ENGINE_CLEANUP_ITEM));
if(!item) return NULL;
item->cb = cb;
static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item)
{
(*(item->cb))();
- OPENSSL_free(item);
+ free(item);
}
void ENGINE_cleanup(void)
{
hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
if (!hptr) {
- hptr = OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX));
+ hptr = malloc(3*sizeof(E_RSAX_MOD_CTX));
if (!hptr) return NULL;
hptr[2].type = hptr[1].type= hptr[0].type = 0;
RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr);
E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
if(hptr)
{
- OPENSSL_free(hptr);
+ free(hptr);
RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
}
if (rsa->_method_mod_n)
fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);
if(!fnd)
{
- fnd = OPENSSL_malloc(sizeof(ENGINE_PILE));
+ fnd = malloc(sizeof(ENGINE_PILE));
if(!fnd) goto end;
fnd->uptodate = 1;
fnd->nid = *nids;
fnd->sk = sk_ENGINE_new_null();
if(!fnd->sk)
{
- OPENSSL_free(fnd);
+ free(fnd);
goto end;
}
fnd->funct = NULL;
sk_ENGINE_free(p->sk);
if(p->funct)
engine_unlocked_finish(p->funct, 0);
- OPENSSL_free(p);
+ free(p);
}
static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE)
static void build_SYS_str_reasons(void)
{
- /* OPENSSL_malloc cannot be used here, use static storage instead */
+ /* malloc cannot be used here, use static storage instead */
static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
int i;
static int init = 1;
if (((p)->err_data[i] != NULL) && \
(p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
{ \
- OPENSSL_free((p)->err_data[i]); \
+ free((p)->err_data[i]); \
(p)->err_data[i]=NULL; \
} \
(p)->err_data_flags[i]=0; \
{
err_clear_data(s,i);
}
- OPENSSL_free(s);
+ free(s);
}
void ERR_load_ERR_strings(void)
/* ret == the error state, if NULL, make a new one */
if (ret == NULL)
{
- ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE));
+ ret=(ERR_STATE *)malloc(sizeof(ERR_STATE));
if (ret == NULL) return(&fallback);
CRYPTO_THREADID_cpy(&ret->tid, &tid);
ret->top=0;
char *str,*p,*a;
s=80;
- str=OPENSSL_malloc(s+1);
+ str=malloc(s+1);
if (str == NULL) return;
str[0]='\0';
if (n > s)
{
s=n+20;
- p=OPENSSL_realloc(str,s+1);
+ p=realloc(str,s+1);
if (p == NULL)
{
- OPENSSL_free(str);
+ free(str);
return;
}
else
{
BIO_B64_CTX *ctx;
- ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX));
+ ctx=(BIO_B64_CTX *)malloc(sizeof(BIO_B64_CTX));
if (ctx == NULL) return(0);
ctx->buf_len=0;
static int b64_free(BIO *a)
{
if (a == NULL) return(0);
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
{
BIO_ENC_CTX *ctx;
- ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX));
+ ctx=(BIO_ENC_CTX *)malloc(sizeof(BIO_ENC_CTX));
if (ctx == NULL) return(0);
EVP_CIPHER_CTX_init(&ctx->cipher);
b=(BIO_ENC_CTX *)a->ptr;
EVP_CIPHER_CTX_cleanup(&(b->cipher));
OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX));
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
{
BIO_OK_CTX *ctx;
- ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
+ ctx=(BIO_OK_CTX *)malloc(sizeof(BIO_OK_CTX));
if (ctx == NULL) return(0);
ctx->buf_len=0;
if (a == NULL) return(0);
EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX));
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
EVP_MD_CTX *EVP_MD_CTX_create(void)
{
- EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx);
+ EVP_MD_CTX *ctx=malloc(sizeof *ctx);
if (ctx)
EVP_MD_CTX_init(ctx);
if (ctx->digest != type)
{
if (ctx->digest && ctx->digest->ctx_size)
- OPENSSL_free(ctx->md_data);
+ free(ctx->md_data);
ctx->digest=type;
if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size)
{
ctx->update = type->update;
- ctx->md_data=OPENSSL_malloc(type->ctx_size);
+ ctx->md_data=malloc(type->ctx_size);
if (ctx->md_data == NULL)
{
EVPerr(EVP_F_EVP_DIGESTINIT_EX,
out->md_data = tmp_buf;
else
{
- out->md_data=OPENSSL_malloc(out->digest->ctx_size);
+ out->md_data=malloc(out->digest->ctx_size);
if (!out->md_data)
{
EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE);
if (ctx)
{
EVP_MD_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
}
&& !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE))
{
OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size);
- OPENSSL_free(ctx->md_data);
+ free(ctx->md_data);
}
if (ctx->pctx)
EVP_PKEY_CTX_free(ctx->pctx);
EVP_AES_GCM_CTX *gctx = c->cipher_data;
OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm));
if (gctx->iv != c->iv)
- OPENSSL_free(gctx->iv);
+ free(gctx->iv);
return 1;
}
if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen))
{
if (gctx->iv != c->iv)
- OPENSSL_free(gctx->iv);
- gctx->iv = OPENSSL_malloc(arg);
+ free(gctx->iv);
+ gctx->iv = malloc(arg);
if (!gctx->iv)
return 0;
}
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
{
- EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx);
+ EVP_CIPHER_CTX *ctx=malloc(sizeof *ctx);
if (ctx)
EVP_CIPHER_CTX_init(ctx);
return ctx;
ctx->cipher=cipher;
if (ctx->cipher->ctx_size)
{
- ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
+ ctx->cipher_data=malloc(ctx->cipher->ctx_size);
if (!ctx->cipher_data)
{
EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
if (ctx)
{
EVP_CIPHER_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
}
OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
}
if (c->cipher_data)
- OPENSSL_free(c->cipher_data);
+ free(c->cipher_data);
#ifndef OPENSSL_NO_ENGINE
if (c->engine)
/* The EVP_CIPHER we used belongs to an ENGINE, release the
if (in->cipher_data && in->cipher->ctx_size)
{
- out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size);
+ out->cipher_data=malloc(in->cipher->ctx_size);
if (!out->cipher_data)
{
EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE);
EVP_PBE_CTL *pbe_tmp;
if (!pbe_algs)
pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
- if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL))))
+ if (!(pbe_tmp = (EVP_PBE_CTL*) malloc (sizeof(EVP_PBE_CTL))))
{
EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE);
return 0;
static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe)
{
- OPENSSL_freeFunc(pbe);
+ free(pbe);
}
void EVP_PBE_cleanup(void)
{
EVP_PKEY *ret;
- ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
+ ret=(EVP_PKEY *)malloc(sizeof(EVP_PKEY));
if (ret == NULL)
{
EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
EVP_PKEY_free_it(x);
if (x->attributes)
sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
- OPENSSL_free(x);
+ free(x);
}
static void EVP_PKEY_free_it(EVP_PKEY *x)
}
size=RSA_size(priv->pkey.rsa);
- key=(unsigned char *)OPENSSL_malloc(size+2);
+ key=(unsigned char *)malloc(size+2);
if (key == NULL)
{
/* ERROR */
ret=1;
err:
if (key != NULL) OPENSSL_cleanse(key,size);
- OPENSSL_free(key);
+ free(key);
return(ret);
}
return NULL;
}
- ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
+ ret = malloc(sizeof(EVP_PKEY_CTX));
if (!ret)
{
#ifndef OPENSSL_NO_ENGINE
EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags)
{
EVP_PKEY_METHOD *pmeth;
- pmeth = OPENSSL_malloc(sizeof(EVP_PKEY_METHOD));
+ pmeth = malloc(sizeof(EVP_PKEY_METHOD));
if (!pmeth)
return NULL;
void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth)
{
if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC))
- OPENSSL_free(pmeth);
+ free(pmeth);
}
EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e)
return 0;
}
#endif
- rctx = OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
+ rctx = malloc(sizeof(EVP_PKEY_CTX));
if (!rctx)
return NULL;
* functional reference we held for this reason. */
ENGINE_finish(ctx->engine);
#endif
- OPENSSL_free(ctx);
+ free(ctx);
}
int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
static void
def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs)
{
- OPENSSL_free(funcs);
+ free(funcs);
}
/* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from
{
EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void;
sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, def_cleanup_util_cb);
- OPENSSL_free(item);
+ free(item);
}
/* Return the EX_CLASS_ITEM from the "ex_data" hash table that corresponds to a
CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA);
p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d);
if (!p) {
- gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM));
+ gen = malloc(sizeof(EX_CLASS_ITEM));
if (gen) {
gen->class_index = class_index;
gen->meth_num = 0;
gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null();
if (!gen->meth)
- OPENSSL_free(gen);
+ free(gen);
else {
/* Because we're inside the ex_data lock, the
* return value from the insert will be NULL */
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
int toret = -1;
- CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc(
+ CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)malloc(
sizeof(CRYPTO_EX_DATA_FUNCS));
if (!a) {
CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE);
while (sk_CRYPTO_EX_DATA_FUNCS_num(item->meth) <= item->meth_num) {
if (!sk_CRYPTO_EX_DATA_FUNCS_push(item->meth, NULL)) {
CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE);
- OPENSSL_free(a);
+ free(a);
goto err;
}
}
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
if (mx > 0) {
- storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
+ storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
if (!storage)
goto skip;
for (i = 0; i < mx; i++)
}
}
if (storage)
- OPENSSL_free(storage);
+ free(storage);
return 1;
}
if (j < mx)
mx = j;
if (mx > 0) {
- storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
+ storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
if (!storage)
goto skip;
for (i = 0; i < mx; i++)
CRYPTO_set_ex_data(to, i, ptr);
}
if (storage)
- OPENSSL_free(storage);
+ free(storage);
return 1;
}
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
if (mx > 0) {
- storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
+ storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
if (!storage)
goto skip;
for (i = 0; i < mx; i++)
}
}
if (storage)
- OPENSSL_free(storage);
+ free(storage);
if (ad->sk) {
sk_void_free(ad->sk);
ad->sk = NULL;
{
if (!*pder)
{
- *pder = OPENSSL_malloc(os->length);
+ *pder = malloc(os->length);
inc = 0;
}
else inc = 1;
static int pkey_hmac_init(EVP_PKEY_CTX *ctx)
{
HMAC_PKEY_CTX *hctx;
- hctx = OPENSSL_malloc(sizeof(HMAC_PKEY_CTX));
+ hctx = malloc(sizeof(HMAC_PKEY_CTX));
if (!hctx)
return 0;
hctx->md = NULL;
{
if (hctx->ktmp.length)
OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length);
- OPENSSL_free(hctx->ktmp.data);
+ free(hctx->ktmp.data);
hctx->ktmp.data = NULL;
}
- OPENSSL_free(hctx);
+ free(hctx);
}
static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
if (!key)
return 0;
r = pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key);
- OPENSSL_free(key);
+ free(key);
return r;
}
return -2;
fgets(buf,256,stdin);
if (buf[0] == '\0') break;
i=strlen(buf);
- p=OPENSSL_malloc(i+1);
+ p=malloc(i+1);
memcpy(p,buf,i+1);
lh_insert(conf,p);
}
_LHASH *ret;
int i;
- if ((ret=OPENSSL_malloc(sizeof(_LHASH))) == NULL)
+ if ((ret=malloc(sizeof(_LHASH))) == NULL)
goto err0;
- if ((ret->b=OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
+ if ((ret->b=malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
goto err1;
for (i=0; i<MIN_NODES; i++)
ret->b[i]=NULL;
ret->error=0;
return(ret);
err1:
- OPENSSL_free(ret);
+ free(ret);
err0:
return(NULL);
}
while (n != NULL)
{
nn=n->next;
- OPENSSL_free(n);
+ free(n);
n=nn;
}
}
- OPENSSL_free(lh->b);
- OPENSSL_free(lh);
+ free(lh->b);
+ free(lh);
}
void *lh_insert(_LHASH *lh, void *data)
if (*rn == NULL)
{
- if ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL)
+ if ((nn=(LHASH_NODE *)malloc(sizeof(LHASH_NODE))) == NULL)
{
lh->error++;
return(NULL);
nn= *rn;
*rn=nn->next;
ret=nn->data;
- OPENSSL_free(nn);
+ free(nn);
lh->num_delete++;
}
if ((lh->p) >= lh->pmax)
{
j=(int)lh->num_alloc_nodes*2;
- n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
+ n=(LHASH_NODE **)realloc(lh->b,
(int)(sizeof(LHASH_NODE *)*j));
if (n == NULL)
{
lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
if (lh->p == 0)
{
- n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
+ n=(LHASH_NODE **)realloc(lh->b,
(unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
if (n == NULL)
{
{
GCM128_CONTEXT *ret;
- if ((ret = (GCM128_CONTEXT *)OPENSSL_malloc(sizeof(GCM128_CONTEXT))))
+ if ((ret = (GCM128_CONTEXT *)malloc(sizeof(GCM128_CONTEXT))))
CRYPTO_gcm128_init(ret,key,block);
return ret;
{
if (ctx) {
OPENSSL_cleanse(ctx,sizeof(*ctx));
- OPENSSL_free(ctx);
+ free(ctx);
}
}
for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
{
MemCheck_off();
- name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
+ name_funcs = malloc(sizeof(NAME_FUNCS));
MemCheck_on();
if (!name_funcs)
{
alias=type&OBJ_NAME_ALIAS;
type&= ~OBJ_NAME_ALIAS;
- onp=(OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME));
+ onp=(OBJ_NAME *)malloc(sizeof(OBJ_NAME));
if (onp == NULL)
{
/* ERROR */
sk_NAME_FUNCS_value(name_funcs_stack,
ret->type)->free_func(ret->name,ret->type,ret->data);
}
- OPENSSL_free(ret);
+ free(ret);
}
else
{
sk_NAME_FUNCS_value(name_funcs_stack,
ret->type)->free_func(ret->name,ret->type,ret->data);
}
- OPENSSL_free(ret);
+ free(ret);
return(1);
}
else
int n;
d.type=type;
- d.names=OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names);
+ d.names=malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names);
d.n=0;
OBJ_NAME_do_all(type,do_all_sorted_fn,&d);
for(n=0 ; n < d.n ; ++n)
fn(d.names[n],arg);
- OPENSSL_free((void *)d.names);
+ free((void *)d.names);
}
static int free_type;
static void name_funcs_free(NAME_FUNCS *ptr)
{
- OPENSSL_free(ptr);
+ free(ptr);
}
void OBJ_NAME_cleanup(int type)
{
if (--a->obj->nid == 0)
ASN1_OBJECT_free(a->obj);
- OPENSSL_free(a);
+ free(a);
}
static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ)
if (added == NULL)
if (!init_added()) return(0);
if ((o=OBJ_dup(obj)) == NULL) goto err;
- if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_NID]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
if ((o->length != 0) && (obj->data != NULL))
- if (!(ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_DATA]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
if (o->sn != NULL)
- if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
if (o->ln != NULL)
- if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
for (i=ADDED_DATA; i<=ADDED_NID; i++)
{
aop=lh_ADDED_OBJ_insert(added,ao[i]);
/* memory leak, buit should not normally matter */
if (aop != NULL)
- OPENSSL_free(aop);
+ free(aop);
}
}
o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE);
err:
for (i=ADDED_DATA; i<=ADDED_NID; i++)
- if (ao[i] != NULL) OPENSSL_free(ao[i]);
- if (o != NULL) OPENSSL_free(o);
+ if (ao[i] != NULL) free(ao[i]);
+ if (o != NULL) free(o);
return(NID_undef);
}
/* Work out total size */
j = ASN1_object_size(0,i,V_ASN1_OBJECT);
- if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL;
+ if((buf=(unsigned char *)malloc(j)) == NULL) return NULL;
p = buf;
/* Write out tag+length */
cp=buf;
op=d2i_ASN1_OBJECT(NULL,&cp,j);
- OPENSSL_free(buf);
+ free(buf);
return op;
}
}
n++;
n += i;
- OPENSSL_free(bndec);
+ free(bndec);
}
else
{
i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
if (i <= 0) return(0);
- if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL)
+ if ((buf=(unsigned char *)malloc(i)) == NULL)
{
OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE);
return(0);
ok=OBJ_add_object(op);
err:
ASN1_OBJECT_free(op);
- OPENSSL_free(buf);
+ free(buf);
return(ok);
}
OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB);
return(NULL);
}
- data=OPENSSL_malloc(o->length);
+ data=malloc(o->length);
if (data == NULL)
goto err;
if (o->data != NULL)
if (o->ln != NULL)
{
i=strlen(o->ln)+1;
- ln=OPENSSL_malloc(i);
+ ln=malloc(i);
if (ln == NULL) goto err;
memcpy(ln,o->ln,i);
r->ln=ln;
if (o->sn != NULL)
{
i=strlen(o->sn)+1;
- sn=OPENSSL_malloc(i);
+ sn=malloc(i);
if (sn == NULL) goto err;
memcpy(sn,o->sn,i);
r->sn=sn;
return(r);
err:
OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE);
- if (ln != NULL) OPENSSL_free(ln);
- if (sn != NULL) OPENSSL_free(sn);
- if (data != NULL) OPENSSL_free(data);
- if (r != NULL) OPENSSL_free(r);
+ if (ln != NULL) free(ln);
+ if (sn != NULL) free(sn);
+ if (data != NULL) free(data);
+ if (r != NULL) free(r);
return(NULL);
}
sigx_app = sk_nid_triple_new(sigx_cmp);
if (!sigx_app)
return 0;
- ntr = OPENSSL_malloc(sizeof(int) * 3);
+ ntr = malloc(sizeof(int) * 3);
if (!ntr)
return 0;
ntr->sign_id = signid;
if (!sk_nid_triple_push(sig_app, ntr))
{
- OPENSSL_free(ntr);
+ free(ntr);
return 0;
}
static void sid_free(nid_triple *tt)
{
- OPENSSL_free(tt);
+ free(tt);
}
void OBJ_sigid_free(void)
if (data)
{
if ((i=i2d(data,NULL)) <= 0) goto err;
- if (!(b=p=OPENSSL_malloc((unsigned int)i)))
+ if (!(b=p=malloc((unsigned int)i)))
goto err;
if (i2d(data, &p) <= 0) goto err;
}
V_ASN1_SEQUENCE,
V_ASN1_UNIVERSAL,
IS_SEQUENCE))<=0) goto err;
- if (!(b=p=OPENSSL_malloc((unsigned int)i)))
+ if (!(b=p=malloc((unsigned int)i)))
goto err;
if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d,
V_ASN1_SEQUENCE,
}
if (!s && !(s = ASN1_STRING_new())) goto err;
if (!(ASN1_STRING_set(s, b, i))) goto err;
- OPENSSL_free(b);
+ free(b);
return s;
err:
- if (b) OPENSSL_free(b);
+ if (b) free(b);
return NULL;
}
#endif
* it relies on library internals.
*/
os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
- os.data = OPENSSL_malloc(os.length);
+ os.data = malloc(os.length);
if (os.data == NULL)
goto err;
tmpval = os.data;
ret = 1;
err:
if (os.data)
- OPENSSL_free(os.data);
+ free(os.data);
return ret;
}
if (rctx->mem)
BIO_free(rctx->mem);
if (rctx->iobuf)
- OPENSSL_free(rctx->iobuf);
- OPENSSL_free(rctx);
+ free(rctx->iobuf);
+ free(rctx);
}
int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req)
static const char post_hdr[] = "POST %s HTTP/1.0\r\n";
OCSP_REQ_CTX *rctx;
- rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX));
+ rctx = malloc(sizeof(OCSP_REQ_CTX));
rctx->state = OHS_ERROR;
rctx->mem = BIO_new(BIO_s_mem());
rctx->io = io;
rctx->iobuflen = maxline;
else
rctx->iobuflen = OCSP_MAX_LINE_LEN;
- rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
+ rctx->iobuf = malloc(rctx->iobuflen);
if (!rctx->iobuf)
return 0;
if (!path)
if (!*phost) goto mem_err;
- OPENSSL_free(buf);
+ free(buf);
return 1;
err:
- if (buf) OPENSSL_free(buf);
- if (*ppath) OPENSSL_free(*ppath);
- if (*pport) OPENSSL_free(*pport);
- if (*phost) OPENSSL_free(*phost);
+ if (buf) free(buf);
+ if (*ppath) free(*ppath);
+ if (*pport) free(*pport);
+ if (*phost) free(*phost);
return 0;
}
else {
/* unknown */
}
- if (name != NULL) OPENSSL_free(name);
- if (header != NULL) OPENSSL_free(header);
- if (data != NULL) OPENSSL_free(data);
+ if (name != NULL) free(name);
+ if (header != NULL) free(header);
+ if (data != NULL) free(data);
name=NULL;
header=NULL;
data=NULL;
ret=NULL;
}
- if (name != NULL) OPENSSL_free(name);
- if (header != NULL) OPENSSL_free(header);
- if (data != NULL) OPENSSL_free(data);
+ if (name != NULL) free(name);
+ if (header != NULL) free(header);
+ if (data != NULL) free(data);
return(ret);
}
return 0;
}
if(check_pem(nm, name)) break;
- OPENSSL_free(nm);
- OPENSSL_free(header);
- OPENSSL_free(data);
+ free(nm);
+ free(header);
+ free(data);
}
if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err;
if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err;
ret = 1;
err:
- if (!ret || !pnm) OPENSSL_free(nm);
- OPENSSL_free(header);
- if (!ret) OPENSSL_free(data);
+ if (!ret || !pnm) free(nm);
+ free(header);
+ if (!ret) free(data);
return ret;
}
}
/* dzise + 8 bytes are needed */
/* actually it needs the cipher block size extra... */
- data=(unsigned char *)OPENSSL_malloc((unsigned int)dsize+20);
+ data=(unsigned char *)malloc((unsigned int)dsize+20);
if (data == NULL)
{
PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE);
if (data != NULL)
{
OPENSSL_cleanse(data,(unsigned int)dsize);
- OPENSSL_free(data);
+ free(data);
}
return(ret);
}
goto err;
}
- buf = OPENSSL_malloc(PEM_BUFSIZE*8);
+ buf = malloc(PEM_BUFSIZE*8);
if (buf == NULL)
{
reason=ERR_R_MALLOC_FAILURE;
EVP_EncodeFinal(&ctx,buf,&outl);
if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err;
OPENSSL_cleanse(buf, PEM_BUFSIZE*8);
- OPENSSL_free(buf);
+ free(buf);
buf = NULL;
if ( (BIO_write(bp,"-----END ",9) != 9) ||
(BIO_write(bp,name,nlen) != nlen) ||
err:
if (buf) {
OPENSSL_cleanse(buf, PEM_BUFSIZE*8);
- OPENSSL_free(buf);
+ free(buf);
}
PEMerr(PEM_F_PEM_WRITE_BIO,reason);
return(0);
*header=headerB->data;
*data=(unsigned char *)dataB->data;
*len=bl;
- OPENSSL_free(nameB);
- OPENSSL_free(headerB);
- OPENSSL_free(dataB);
+ free(nameB);
+ free(headerB);
+ free(dataB);
return(1);
err:
BUF_MEM_free(nameB);
ret=d2i(x,&p,len);
if (ret == NULL)
PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB);
- OPENSSL_free(data);
+ free(data);
return(ret);
}
if (ret == NULL)
PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB);
err:
- OPENSSL_free(nm);
+ free(nm);
OPENSSL_cleanse(data, len);
- OPENSSL_free(data);
+ free(data);
return(ret);
}
err:
if (ret == NULL)
PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB);
- OPENSSL_free(nm);
- OPENSSL_free(data);
+ free(nm);
+ free(data);
return(ret);
}
j=RSA_size(pubk[i]->pkey.rsa);
if (j > max) max=j;
}
- s=(char *)OPENSSL_malloc(max*2);
+ s=(char *)malloc(max*2);
if (s == NULL)
{
PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE);
ret=npubk;
err:
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH);
return(ret);
}
}
i=RSA_size(priv->pkey.rsa);
if (i < 100) i=100;
- s=(unsigned char *)OPENSSL_malloc(i*2);
+ s=(unsigned char *)malloc(i*2);
if (s == NULL)
{
PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE);
err:
EVP_MD_CTX_cleanup(&ctx->md);
EVP_CIPHER_CTX_cleanup(&ctx->cipher);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
return(ret);
}
#else /* !OPENSSL_NO_RSA */
int i,ret=0;
unsigned int m_len;
- m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2);
+ m=(unsigned char *)malloc(EVP_PKEY_size(pkey)+2);
if (m == NULL)
{
PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE);
ret=1;
err:
/* ctx has been zeroed by EVP_SignFinal() */
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
unsigned char *tmpbuf, *q;
unsigned int i;
p = *in + nbyte - 1;
- tmpbuf = OPENSSL_malloc(nbyte);
+ tmpbuf = malloc(nbyte);
if (!tmpbuf)
return 0;
q = tmpbuf;
for (i = 0; i < nbyte; i++)
*q++ = *p--;
*r = BN_bin2bn(tmpbuf, nbyte, NULL);
- OPENSSL_free(tmpbuf);
+ free(tmpbuf);
if (*r)
{
*in += nbyte;
return NULL;
length = blob_length(bitlen, isdss, ispub);
- buf = OPENSSL_malloc(length);
+ buf = malloc(length);
if (!buf)
{
PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE);
err:
if (buf)
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
p = *out;
else
{
- p = OPENSSL_malloc(outlen);
+ p = malloc(outlen);
if (!p)
return -1;
*out = p;
if (outlen < 0)
return -1;
wrlen = BIO_write(out, tmp, outlen);
- OPENSSL_free(tmp);
+ free(tmp);
if (wrlen == outlen)
return outlen;
return -1;
PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ);
return NULL;
}
- enctmp = OPENSSL_malloc(keylen + 8);
+ enctmp = malloc(keylen + 8);
if (!enctmp)
{
PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE);
err:
EVP_CIPHER_CTX_cleanup(&cctx);
if (enctmp && saltlen)
- OPENSSL_free(enctmp);
+ free(enctmp);
return ret;
}
if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen))
return 0;
buflen = (int) keylen + saltlen;
- buf = OPENSSL_malloc(buflen);
+ buf = malloc(buflen);
if (!buf)
{
PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE);
if (buf)
{
OPENSSL_cleanse(buf, buflen);
- OPENSSL_free(buf);
+ free(buf);
}
return ret;
}
p = *out;
else
{
- p = OPENSSL_malloc(outlen);
+ p = malloc(outlen);
if (!p)
{
PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE);
if (outlen < 0)
return -1;
wrlen = BIO_write(out, tmp, outlen);
- OPENSSL_free(tmp);
+ free(tmp);
if (wrlen == outlen)
{
PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE);
/* Encrypt/Decrypt a buffer based on password and algor, result in a
- * OPENSSL_malloc'ed buffer
+ * malloc'ed buffer
*/
unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
return NULL;
}
- if(!(out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) {
+ if(!(out = malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) {
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE);
goto err;
}
if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen))
{
- OPENSSL_free(out);
+ free(out);
out = NULL;
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB);
goto err;
outlen = i;
if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) {
- OPENSSL_free(out);
+ free(out);
out = NULL;
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR);
goto err;
ret = ASN1_item_d2i(NULL, &p, outlen, it);
if (zbuf) OPENSSL_cleanse(out, outlen);
if(!ret) PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,PKCS12_R_DECODE_ERROR);
- OPENSSL_free(out);
+ free(out);
return ret;
}
if (!PKCS12_pbe_crypt(algor, pass, passlen, in, inlen, &oct->data,
&oct->length, 1)) {
PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR);
- OPENSSL_free(in);
+ free(in);
return NULL;
}
if (zbuf) OPENSSL_cleanse(in, inlen);
- OPENSSL_free(in);
+ free(in);
return oct;
}
return 0;
if(unipass) {
OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */
- OPENSSL_free(unipass);
+ free(unipass);
}
return ret;
}
u = EVP_MD_size (md_type);
if (u < 0)
return 0;
- D = OPENSSL_malloc (v);
- Ai = OPENSSL_malloc (u);
- B = OPENSSL_malloc (v + 1);
+ D = malloc (v);
+ Ai = malloc (u);
+ B = malloc (v + 1);
Slen = v * ((saltlen+v-1)/v);
if(passlen) Plen = v * ((passlen+v-1)/v);
else Plen = 0;
Ilen = Slen + Plen;
- I = OPENSSL_malloc (Ilen);
+ I = malloc (Ilen);
Ij = BN_new();
Bpl1 = BN_new();
if (!D || !Ai || !B || !I || !Ij || !Bpl1)
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
end:
- OPENSSL_free (Ai);
- OPENSSL_free (B);
- OPENSSL_free (D);
- OPENSSL_free (I);
+ free (Ai);
+ free (B);
+ free (D);
+ free (I);
BN_free (Ij);
BN_free (Bpl1);
EVP_MD_CTX_cleanup(&ctx);
len = ASN1_STRING_to_UTF8(&data, fname);
if(len > 0) {
r = X509_alias_set1(x509, data, len);
- OPENSSL_free(data);
+ free(data);
if (!r)
{
X509_free(x509);
}
if (!saltlen) saltlen = PKCS12_SALT_LEN;
p12->mac->salt->length = saltlen;
- if (!(p12->mac->salt->data = OPENSSL_malloc (saltlen))) {
+ if (!(p12->mac->salt->data = malloc (saltlen))) {
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
unsigned char *unitmp;
if (asclen == -1) asclen = strlen(asc);
ulen = asclen*2 + 2;
- if (!(unitmp = OPENSSL_malloc(ulen))) return NULL;
+ if (!(unitmp = malloc(ulen))) return NULL;
for (i = 0; i < ulen - 2; i+=2) {
unitmp[i] = 0;
unitmp[i + 1] = asc[i>>1];
/* If no terminating zero allow for one */
if (!unilen || uni[unilen - 1]) asclen++;
uni++;
- if (!(asctmp = OPENSSL_malloc(asclen))) return NULL;
+ if (!(asctmp = malloc(asclen))) return NULL;
for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i];
asctmp[asclen - 1] = 0;
return asctmp;
{
BIO_BER_CTX *ctx;
- ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX));
+ ctx=(BIO_BER_CTX *)malloc(sizeof(BIO_BER_CTX));
if (ctx == NULL) return(0);
memset((char *)ctx,0,sizeof(BIO_BER_CTX));
if (a == NULL) return(0);
b=(BIO_BER_CTX *)a->ptr;
OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX));
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
ri->enc_key->data, ri->enc_key->length) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (*pek)
{
OPENSSL_cleanse(*pek, *peklen);
- OPENSSL_free(*pek);
+ free(*pek);
}
*pek = ek;
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
goto err;
/* Generate random key as MMA defence */
tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx);
- tkey = OPENSSL_malloc(tkeylen);
+ tkey = malloc(tkeylen);
if (!tkey)
goto err;
if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0)
{
/* Use random key as MMA defence */
OPENSSL_cleanse(ek, eklen);
- OPENSSL_free(ek);
+ free(ek);
ek = tkey;
eklen = tkeylen;
tkey = NULL;
if (ek)
{
OPENSSL_cleanse(ek,eklen);
- OPENSSL_free(ek);
+ free(ek);
ek = NULL;
}
if (tkey)
{
OPENSSL_cleanse(tkey,tkeylen);
- OPENSSL_free(tkey);
+ free(tkey);
tkey = NULL;
}
if (ek)
{
OPENSSL_cleanse(ek,eklen);
- OPENSSL_free(ek);
+ free(ek);
}
if (tkey)
{
OPENSSL_cleanse(tkey,tkeylen);
- OPENSSL_free(tkey);
+ free(tkey);
}
if (out != NULL) BIO_free_all(out);
if (btmp != NULL) BIO_free_all(btmp);
unsigned char *abuf = NULL;
unsigned int abuflen;
abuflen = EVP_PKEY_size(si->pkey);
- abuf = OPENSSL_malloc(abuflen);
+ abuf = malloc(abuflen);
if (!abuf)
goto err;
goto err;
if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0)
goto err;
- OPENSSL_free(abuf);
+ free(abuf);
if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0)
goto err;
- abuf = OPENSSL_malloc(siglen);
+ abuf = malloc(siglen);
if(!abuf)
goto err;
if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0)
err:
if (abuf)
- OPENSSL_free(abuf);
+ free(abuf);
EVP_MD_CTX_cleanup(&mctx);
return 0;
if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen))
goto err;
- OPENSSL_free(abuf);
+ free(abuf);
}
os=si->enc_digest;
pitem *
pitem_new(unsigned char *prio64be, void *data)
{
- pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem));
+ pitem *item = (pitem *) malloc(sizeof(pitem));
if (item == NULL) return NULL;
memcpy(item->priority,prio64be,sizeof(item->priority));
{
if (item == NULL) return;
- OPENSSL_free(item);
+ free(item);
}
pqueue_s *
pqueue_new()
{
- pqueue_s *pq = (pqueue_s *) OPENSSL_malloc(sizeof(pqueue_s));
+ pqueue_s *pq = (pqueue_s *) malloc(sizeof(pqueue_s));
if (pq == NULL) return NULL;
memset(pq, 0x00, sizeof(pqueue_s));
{
if (pq == NULL) return;
- OPENSSL_free(pq);
+ free(pq);
}
pitem *
V_ASN1_NULL, NULL, penc, penclen))
return 1;
- OPENSSL_free(penc);
+ free(penc);
return 0;
}
update_buflen(x->iqmp, &buf_len);
}
- m=(unsigned char *)OPENSSL_malloc(buf_len+10);
+ m=(unsigned char *)malloc(buf_len+10);
if (m == NULL)
{
RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE);
}
ret=1;
err:
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num=BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if (!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num = BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if(!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num = BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if(!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num=BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if(!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
{
RSA *ret;
- ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
+ ret=(RSA *)malloc(sizeof(RSA));
if (ret == NULL)
{
RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (!ENGINE_init(engine))
{
RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
ret->engine = engine;
RSAerr(RSA_F_RSA_NEW_METHOD,
ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
if (ret->engine)
ENGINE_finish(ret->engine);
#endif
- OPENSSL_free(ret);
+ free(ret);
return(NULL);
}
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding);
if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);
- OPENSSL_free(r);
+ free(r);
}
int RSA_up_ref(RSA *r)
20);
#endif
- dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH);
+ dbmask = malloc(emlen - SHA_DIGEST_LENGTH);
if (dbmask == NULL)
{
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
for (i = 0; i < SHA_DIGEST_LENGTH; i++)
seed[i] ^= seedmask[i];
- OPENSSL_free(dbmask);
+ free(dbmask);
return 1;
}
}
dblen = num - SHA_DIGEST_LENGTH;
- db = OPENSSL_malloc(dblen + num);
+ db = malloc(dblen + num);
if (db == NULL)
{
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
memcpy(to, db + i, mlen);
}
}
- OPENSSL_free(db);
+ free(db);
return mlen;
decoding_err:
/* to avoid chosen ciphertext attacks, the error message should not reveal
* which kind of decoding error happened */
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR);
- if (db != NULL) OPENSSL_free(db);
+ if (db != NULL) free(db);
return -1;
}
static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
{
RSA_PKEY_CTX *rctx;
- rctx = OPENSSL_malloc(sizeof(RSA_PKEY_CTX));
+ rctx = malloc(sizeof(RSA_PKEY_CTX));
if (!rctx)
return 0;
rctx->nbits = 1024;
{
if (ctx->tbuf)
return 1;
- ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey));
+ ctx->tbuf = malloc(EVP_PKEY_size(pk->pkey));
if (!ctx->tbuf)
return 0;
return 1;
if (rctx->pub_exp)
BN_free(rctx->pub_exp);
if (rctx->tbuf)
- OPENSSL_free(rctx->tbuf);
- OPENSSL_free(rctx);
+ free(rctx->tbuf);
+ free(rctx);
}
}
static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
}
maskedDBLen = emLen - hLen - 1;
H = EM + maskedDBLen;
- DB = OPENSSL_malloc(maskedDBLen);
+ DB = malloc(maskedDBLen);
if (!DB)
{
RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE);
err:
if (DB)
- OPENSSL_free(DB);
+ free(DB);
EVP_MD_CTX_cleanup(&ctx);
return ret;
}
if (sLen > 0)
{
- salt = OPENSSL_malloc(sLen);
+ salt = malloc(sLen);
if (!salt)
{
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE);
err:
if (salt)
- OPENSSL_free(salt);
+ free(salt);
return ret;
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return(0);
}
- s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
+ s=(unsigned char *)malloc((unsigned int)j+1);
if (s == NULL)
{
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
*siglen=i;
OPENSSL_cleanse(s,(unsigned int)j+1);
- OPENSSL_free(s);
+ free(s);
return(ret);
}
return(0);
}
- s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
+ s=(unsigned char *)malloc((unsigned int)siglen);
if (s == NULL)
{
RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
if (s != NULL)
{
OPENSSL_cleanse(s,(unsigned int)siglen);
- OPENSSL_free(s);
+ free(s);
}
return(ret);
}
return(0);
}
if(type != NID_md5_sha1) {
- tmps=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
+ tmps=(unsigned char *)malloc((unsigned int)j+1);
if (tmps == NULL)
{
RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE);
if(type != NID_md5_sha1) {
OPENSSL_cleanse(tmps,(unsigned int)j+1);
- OPENSSL_free(tmps);
+ free(tmps);
}
return(ret);
}
return 1;
}
- s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
+ s=(unsigned char *)malloc((unsigned int)siglen);
if (s == NULL)
{
RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
if (s != NULL)
{
OPENSSL_cleanse(s,(unsigned int)siglen);
- OPENSSL_free(s);
+ free(s);
}
return(ret);
}
int longg ;
int longN = BN_num_bytes(N);
- if ((tmp = OPENSSL_malloc(longN)) == NULL)
+ if ((tmp = malloc(longN)) == NULL)
return NULL;
BN_bn2bin(N,tmp) ;
/* use the zeros behind to pad on left */
EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg);
EVP_DigestUpdate(&ctxt, tmp, longg);
- OPENSSL_free(tmp);
+ free(tmp);
EVP_DigestFinal_ex(&ctxt, digest, NULL);
EVP_MD_CTX_cleanup(&ctxt);
longN= BN_num_bytes(N);
- if ((cAB = OPENSSL_malloc(2*longN)) == NULL)
+ if ((cAB = malloc(2*longN)) == NULL)
return NULL;
memset(cAB, 0, longN);
EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN);
EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN);
- OPENSSL_free(cAB);
+ free(cAB);
EVP_DigestFinal_ex(&ctxt, cu, NULL);
EVP_MD_CTX_cleanup(&ctxt);
(pass == NULL))
return NULL;
- if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL)
+ if ((cs = malloc(BN_num_bytes(s))) == NULL)
return NULL;
EVP_MD_CTX_init(&ctxt);
EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
BN_bn2bin(s,cs);
EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s));
- OPENSSL_free(cs);
+ free(cs);
EVP_DigestUpdate(&ctxt, dig, sizeof(dig));
EVP_DigestFinal_ex(&ctxt, dig, NULL);
EVP_MD_CTX_cleanup(&ctxt);
return;
BN_free(user_pwd->s);
BN_clear_free(user_pwd->v);
- OPENSSL_free(user_pwd->id);
- OPENSSL_free(user_pwd->info);
- OPENSSL_free(user_pwd);
+ free(user_pwd->id);
+ free(user_pwd->info);
+ free(user_pwd);
}
static SRP_user_pwd *SRP_user_pwd_new()
{
- SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd));
+ SRP_user_pwd *ret = malloc(sizeof(SRP_user_pwd));
if (ret == NULL)
return NULL;
ret->N = NULL;
SRP_VBASE *SRP_VBASE_new(char *seed_key)
{
- SRP_VBASE *vb = (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE));
+ SRP_VBASE *vb = (SRP_VBASE *) malloc(sizeof(SRP_VBASE));
if (vb == NULL)
return NULL;
if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) ||
!(vb->gN_cache = sk_SRP_gN_cache_new_null()))
{
- OPENSSL_free(vb);
+ free(vb);
return NULL;
}
vb->default_g = NULL;
{
sk_SRP_user_pwd_free(vb->users_pwd);
sk_SRP_gN_cache_free(vb->gN_cache);
- OPENSSL_free(vb);
+ free(vb);
return NULL;
}
return vb;
{
sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free);
sk_SRP_gN_cache_free(vb->gN_cache);
- OPENSSL_free(vb->seed_key);
- OPENSSL_free(vb);
+ free(vb->seed_key);
+ free(vb);
return 0;
}
unsigned char tmp[MAX_LEN];
int len;
- SRP_gN_cache *newgN = (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache));
+ SRP_gN_cache *newgN = (SRP_gN_cache *)malloc(sizeof(SRP_gN_cache));
if (newgN == NULL)
return NULL;
if ((newgN->bn = BN_bin2bn(tmp, len, NULL)))
return newgN;
- OPENSSL_free(newgN->b64_bn);
+ free(newgN->b64_bn);
err:
- OPENSSL_free(newgN);
+ free(newgN);
return NULL;
}
{
if (gN_cache == NULL)
return;
- OPENSSL_free(gN_cache->b64_bn);
+ free(gN_cache->b64_bn);
BN_free(gN_cache->bn);
- OPENSSL_free(gN_cache);
+ free(gN_cache);
}
static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
{
/*we add this couple in the internal Stack */
- if ((gN = (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) == NULL)
+ if ((gN = (SRP_gN *)malloc(sizeof(SRP_gN))) == NULL)
goto err;
if (!(gN->id = BUF_strdup(pp[DB_srpid]))
if (gN != NULL)
{
- OPENSSL_free(gN->id);
- OPENSSL_free(gN);
+ free(gN->id);
+ free(gN);
}
SRP_user_pwd_free(user_pwd);
if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err;
BN_bn2bin(v,tmp);
- if (((vf = OPENSSL_malloc(BN_num_bytes(v)*2)) == NULL))
+ if (((vf = malloc(BN_num_bytes(v)*2)) == NULL))
goto err;
t_tob64(vf, tmp, BN_num_bytes(v));
{
char *tmp_salt;
- if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL)
+ if ((tmp_salt = malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL)
{
- OPENSSL_free(vf);
+ free(vf);
goto err;
}
t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN);
char **s;
if ((ret=sk_new(sk->comp)) == NULL) goto err;
- s=(char **)OPENSSL_realloc((char *)ret->data,
+ s=(char **)realloc((char *)ret->data,
(unsigned int)sizeof(char *)*sk->num_alloc);
if (s == NULL) goto err;
ret->data=s;
_STACK *ret;
int i;
- if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL)
+ if ((ret=malloc(sizeof(_STACK))) == NULL)
goto err;
- if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)
+ if ((ret->data=malloc(sizeof(char *)*MIN_NODES)) == NULL)
goto err;
for (i=0; i<MIN_NODES; i++)
ret->data[i]=NULL;
return(ret);
err:
if(ret)
- OPENSSL_free(ret);
+ free(ret);
return(NULL);
}
if(st == NULL) return 0;
if (st->num_alloc <= st->num+1)
{
- s=OPENSSL_realloc((char *)st->data,
+ s=realloc((char *)st->data,
(unsigned int)sizeof(char *)*st->num_alloc*2);
if (s == NULL)
return(0);
void sk_free(_STACK *st)
{
if (st == NULL) return;
- if (st->data != NULL) OPENSSL_free(st->data);
- OPENSSL_free(st);
+ if (st->data != NULL) free(st->data);
+ free(st);
}
int sk_num(const _STACK *st)
return NULL;
}
- ret=(STORE *)OPENSSL_malloc(sizeof(STORE));
+ ret=(STORE *)malloc(sizeof(STORE));
if (ret == NULL)
{
STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (store->meth->clean)
store->meth->clean(store);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data);
- OPENSSL_free(store);
+ free(store);
}
int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void))
STORE_OBJECT *STORE_OBJECT_new(void)
{
- STORE_OBJECT *object = OPENSSL_malloc(sizeof(STORE_OBJECT));
+ STORE_OBJECT *object = malloc(sizeof(STORE_OBJECT));
if (object) memset(object, 0, sizeof(STORE_OBJECT));
return object;
}
BUF_MEM_free(data->data.arbitrary);
break;
}
- OPENSSL_free(data);
+ free(data);
}
IMPLEMENT_STACK_OF(STORE_OBJECT*)
STORE_ATTR_INFO *STORE_ATTR_INFO_new(void)
{
- return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO));
+ return (STORE_ATTR_INFO *)malloc(sizeof(STORE_ATTR_INFO));
}
static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs,
STORE_ATTR_TYPES code)
STORE_ATTR_TYPES i;
for(i = 0; i++ < STORE_ATTR_TYPE_NUM;)
STORE_ATTR_INFO_attr_free(attrs, i);
- OPENSSL_free(attrs);
+ free(attrs);
}
return 1;
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].cstring);
+ free(attrs->values[code].cstring);
attrs->values[code].cstring = NULL;
CLEAR_ATTRBIT(attrs, code);
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].sha1string);
+ free(attrs->values[code].sha1string);
attrs->values[code].sha1string = NULL;
CLEAR_ATTRBIT(attrs, code);
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].dn);
+ free(attrs->values[code].dn);
attrs->values[code].dn = NULL;
CLEAR_ATTRBIT(attrs, code);
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].number);
+ free(attrs->values[code].number);
attrs->values[code].number = NULL;
CLEAR_ATTRBIT(attrs, code);
}
if (attributes)
{
struct attr_list_ctx_st *context =
- (struct attr_list_ctx_st *)OPENSSL_malloc(sizeof(struct attr_list_ctx_st));
+ (struct attr_list_ctx_st *)malloc(sizeof(struct attr_list_ctx_st));
if (context)
context->attributes = attributes;
else
#if 0
OPENSSL_ITEM *attributes = context->attributes;
#endif
- OPENSSL_free(context);
+ free(context);
return 1;
}
STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER);
OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[])
{
struct mem_ctx_st *context =
- (struct mem_ctx_st *)OPENSSL_malloc(sizeof(struct mem_ctx_st));
+ (struct mem_ctx_st *)malloc(sizeof(struct mem_ctx_st));
void *attribute_context = NULL;
STORE_ATTR_INFO *attrs = NULL;
}
if (context && context->search_attributes)
sk_STORE_ATTR_INFO_free(context->search_attributes);
- if (context) OPENSSL_free(context);
+ if (context) free(context);
return 1;
}
static int mem_list_endp(STORE *s, void *handle)
STORE_METHOD *STORE_create_method(char *name)
{
- STORE_METHOD *store_method = (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD));
+ STORE_METHOD *store_method = (STORE_METHOD *)malloc(sizeof(STORE_METHOD));
if (store_method)
{
void STORE_destroy_method(STORE_METHOD *store_method)
{
if (!store_method) return;
- OPENSSL_free(store_method->name);
+ free(store_method->name);
store_method->name = NULL;
- OPENSSL_free(store_method);
+ free(store_method);
}
int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f)
{
result = BIO_write(bio, "0x", 2) > 0;
result = result && BIO_write(bio, hex, strlen(hex)) > 0;
- OPENSSL_free(hex);
+ free(hex);
}
BN_free(&num_bn);
{
TS_RESP_CTX *ctx;
- if (!(ctx = (TS_RESP_CTX *) OPENSSL_malloc(sizeof(TS_RESP_CTX))))
+ if (!(ctx = (TS_RESP_CTX *) malloc(sizeof(TS_RESP_CTX))))
{
TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
ASN1_INTEGER_free(ctx->seconds);
ASN1_INTEGER_free(ctx->millis);
ASN1_INTEGER_free(ctx->micros);
- OPENSSL_free(ctx);
+ free(ctx);
}
int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer)
int len;
len = i2d_ESS_SIGNING_CERT(sc, NULL);
- if (!(pp = (unsigned char *) OPENSSL_malloc(len)))
+ if (!(pp = (unsigned char *) malloc(len)))
{
TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
goto err;
TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
goto err;
}
- OPENSSL_free(pp); pp = NULL;
+ free(pp); pp = NULL;
return PKCS7_add_signed_attribute(si,
NID_id_smime_aa_signingCertificate,
V_ASN1_SEQUENCE, seq);
err:
ASN1_STRING_free(seq);
- OPENSSL_free(pp);
+ free(pp);
return 0;
}
err:
X509_free(signer);
X509_ALGOR_free(md_alg);
- OPENSSL_free(imprint);
+ free(imprint);
return ret;
}
", status text: ", embedded_status_text ?
embedded_status_text : "unspecified",
", failure codes: ", failure_text);
- OPENSSL_free(embedded_status_text);
+ free(embedded_status_text);
return 0;
}
length += 1; /* separator character */
}
/* Allocate memory (closing '\0' included). */
- if (!(result = OPENSSL_malloc(length)))
+ if (!(result = malloc(length)))
{
TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE);
return NULL;
if (length < 0)
goto err;
*imprint_len = length;
- if (!(*imprint = OPENSSL_malloc(*imprint_len)))
+ if (!(*imprint = malloc(*imprint_len)))
{
TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE);
goto err;
return 1;
err:
X509_ALGOR_free(*md_alg);
- OPENSSL_free(*imprint);
+ free(*imprint);
*imprint_len = 0;
return 0;
}
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
{
TS_VERIFY_CTX *ctx =
- (TS_VERIFY_CTX *) OPENSSL_malloc(sizeof(TS_VERIFY_CTX));
+ (TS_VERIFY_CTX *) malloc(sizeof(TS_VERIFY_CTX));
if (ctx)
memset(ctx, 0, sizeof(TS_VERIFY_CTX));
else
if (!ctx) return;
TS_VERIFY_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx)
ASN1_OBJECT_free(ctx->policy);
X509_ALGOR_free(ctx->md_alg);
- OPENSSL_free(ctx->imprint);
+ free(ctx->imprint);
BIO_free_all(ctx->data);
if (!(ret->md_alg = X509_ALGOR_dup(md_alg))) goto err;
msg = TS_MSG_IMPRINT_get_msg(imprint);
ret->imprint_len = ASN1_STRING_length(msg);
- if (!(ret->imprint = OPENSSL_malloc(ret->imprint_len))) goto err;
+ if (!(ret->imprint = malloc(ret->imprint_len))) goto err;
memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len);
/* Setting nonce. */
if ((buf=BUF_MEM_new()) == NULL) goto err;
if (!BUF_MEM_grow(buf,size)) goto err;
- if ((ret=OPENSSL_malloc(sizeof(TXT_DB))) == NULL)
+ if ((ret=malloc(sizeof(TXT_DB))) == NULL)
goto err;
ret->num_fields=num;
ret->index=NULL;
ret->qual=NULL;
if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL)
goto err;
- if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL)
+ if ((ret->index=malloc(sizeof(*ret->index)*num)) == NULL)
goto err;
- if ((ret->qual=OPENSSL_malloc(sizeof(*(ret->qual))*num)) == NULL)
+ if ((ret->qual=malloc(sizeof(*(ret->qual))*num)) == NULL)
goto err;
for (i=0; i<num; i++)
{
else
{
buf->data[offset-1]='\0'; /* blat the '\n' */
- if (!(p=OPENSSL_malloc(add+offset))) goto err;
+ if (!(p=malloc(add+offset))) goto err;
offset=0;
}
pp=(char **)p;
if (er)
{
#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
- if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n");
+ if (er == 1) fprintf(stderr,"malloc failure\n");
#endif
if (ret != NULL)
{
if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data);
- if (ret->index != NULL) OPENSSL_free(ret->index);
- if (ret->qual != NULL) OPENSSL_free(ret->qual);
- if (ret != NULL) OPENSSL_free(ret);
+ if (ret->index != NULL) free(ret->index);
+ if (ret->qual != NULL) free(ret->qual);
+ if (ret != NULL) free(ret);
}
return(NULL);
}
{
for (i=db->num_fields-1; i>=0; i--)
if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]);
- OPENSSL_free(db->index);
+ free(db->index);
}
if (db->qual != NULL)
- OPENSSL_free(db->qual);
+ free(db->qual);
if (db->data != NULL)
{
for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--)
if (max == NULL) /* new row */
{
for (n=0; n<db->num_fields; n++)
- if (p[n] != NULL) OPENSSL_free(p[n]);
+ if (p[n] != NULL) free(p[n]);
}
else
{
{
if (((p[n] < (char *)p) || (p[n] > max))
&& (p[n] != NULL))
- OPENSSL_free(p[n]);
+ free(p[n]);
}
}
- OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i));
+ free(sk_OPENSSL_PSTRING_value(db->data,i));
}
sk_OPENSSL_PSTRING_free(db->data);
}
- OPENSSL_free(db);
+ free(db);
}
and object_name is the name of the object (might be a card name or
a file name.
The returned string shall always be allocated on the heap with
- OPENSSL_malloc(), and need to be free'd with OPENSSL_free().
+ malloc(), and need to be free'd with free().
If the ui_method doesn't contain a pointer to a user-defined prompt
constructor, a default string is built, looking like this:
{
UI *ret;
- ret=(UI *)OPENSSL_malloc(sizeof(UI));
+ ret=(UI *)malloc(sizeof(UI));
if (ret == NULL)
{
UIerr(UI_F_UI_NEW_METHOD,ERR_R_MALLOC_FAILURE);
{
if (uis->flags & OUT_STRING_FREEABLE)
{
- OPENSSL_free((char *)uis->out_string);
+ free((char *)uis->out_string);
switch(uis->type)
{
case UIT_BOOLEAN:
- OPENSSL_free((char *)uis->_.boolean_data.action_desc);
- OPENSSL_free((char *)uis->_.boolean_data.ok_chars);
- OPENSSL_free((char *)uis->_.boolean_data.cancel_chars);
+ free((char *)uis->_.boolean_data.action_desc);
+ free((char *)uis->_.boolean_data.ok_chars);
+ free((char *)uis->_.boolean_data.cancel_chars);
break;
default:
break;
}
}
- OPENSSL_free(uis);
+ free(uis);
}
void UI_free(UI *ui)
return;
sk_UI_STRING_pop_free(ui->strings,free_string);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data);
- OPENSSL_free(ui);
+ free(ui);
}
static int allocate_string_stack(UI *ui)
{
UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER);
}
- else if ((ret = (UI_STRING *)OPENSSL_malloc(sizeof(UI_STRING))))
+ else if ((ret = (UI_STRING *)malloc(sizeof(UI_STRING))))
{
ret->out_string=prompt;
ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0;
ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags,
result_buf);
err:
- if (prompt_copy) OPENSSL_free(prompt_copy);
- if (action_desc_copy) OPENSSL_free(action_desc_copy);
- if (ok_chars_copy) OPENSSL_free(ok_chars_copy);
- if (cancel_chars_copy) OPENSSL_free(cancel_chars_copy);
+ if (prompt_copy) free(prompt_copy);
+ if (action_desc_copy) free(action_desc_copy);
+ if (ok_chars_copy) free(ok_chars_copy);
+ if (cancel_chars_copy) free(cancel_chars_copy);
return -1;
}
len += sizeof(prompt2) - 1 + strlen(object_name);
len += sizeof(prompt3) - 1;
- prompt = (char *)OPENSSL_malloc(len + 1);
+ prompt = (char *)malloc(len + 1);
BUF_strlcpy(prompt, prompt1, len + 1);
BUF_strlcat(prompt, object_desc, len + 1);
if (object_name)
UI_METHOD *UI_create_method(char *name)
{
- UI_METHOD *ui_method = (UI_METHOD *)OPENSSL_malloc(sizeof(UI_METHOD));
+ UI_METHOD *ui_method = (UI_METHOD *)malloc(sizeof(UI_METHOD));
if (ui_method)
{
anything Murphy can throw at you and more! You have been warned. */
void UI_destroy_method(UI_METHOD *ui_method)
{
- OPENSSL_free(ui_method->name);
+ free(ui_method->name);
ui_method->name = NULL;
- OPENSSL_free(ui_method);
+ free(ui_method);
}
int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui))
and object_name is the name of the object (might be a card name or
a file name.
The returned string shall always be allocated on the heap with
- OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). */
+ malloc(), and need to be free'd with free(). */
char *(*ui_construct_prompt)(UI *ui, const char *object_desc,
const char *object_name);
};
{
BY_DIR *a;
- if ((a = (BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL)
+ if ((a = (BY_DIR *)malloc(sizeof(BY_DIR))) == NULL)
return (0);
if ((a->buffer = BUF_MEM_new()) == NULL) {
- OPENSSL_free(a);
+ free(a);
return (0);
}
a->dirs = NULL;
static void
by_dir_hash_free(BY_DIR_HASH *hash)
{
- OPENSSL_free(hash);
+ free(hash);
}
static int
by_dir_entry_free(BY_DIR_ENTRY *ent)
{
if (ent->dir)
- OPENSSL_free(ent->dir);
+ free(ent->dir);
if (ent->hashes)
sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
- OPENSSL_free(ent);
+ free(ent);
}
static void
sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free);
if (a->buffer != NULL)
BUF_MEM_free(a->buffer);
- OPENSSL_free(a);
+ free(a);
}
static int
return 0;
}
}
- ent = OPENSSL_malloc(sizeof(BY_DIR_ENTRY));
+ ent = malloc(sizeof(BY_DIR_ENTRY));
if (!ent)
return 0;
ent->dir_type = type;
ent->hashes, idx);
}
if (!hent) {
- hent = OPENSSL_malloc(sizeof(BY_DIR_HASH));
+ hent = malloc(sizeof(BY_DIR_HASH));
hent->hash = h;
hent->suffix = k;
if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) {
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
- OPENSSL_free(hent);
+ free(hent);
ok = 0;
goto finish;
}
goto err;
if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f)))
goto err;
- OPENSSL_free(f);
+ free(f);
if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data,
(unsigned long)a->cert_info->serialNumber->length))
goto err;
{
X509_LOOKUP *ret;
- ret=(X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP));
+ ret=(X509_LOOKUP *)malloc(sizeof(X509_LOOKUP));
if (ret == NULL) return NULL;
ret->init=0;
ret->store_ctx=NULL;
if ((method->new_item != NULL) && !method->new_item(ret))
{
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
return ret;
if ( (ctx->method != NULL) &&
(ctx->method->free != NULL))
(*ctx->method->free)(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int X509_LOOKUP_init(X509_LOOKUP *ctx)
{
X509_STORE *ret;
- if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
+ if ((ret=(X509_STORE *)malloc(sizeof(X509_STORE))) == NULL)
return NULL;
ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
ret->cache=1;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data))
{
sk_X509_OBJECT_free(ret->objs);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
/* abort(); */
}
- OPENSSL_free(a);
+ free(a);
}
void X509_STORE_free(X509_STORE *vfy)
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data);
if (vfy->param)
X509_VERIFY_PARAM_free(vfy->param);
- OPENSSL_free(vfy);
+ free(vfy);
}
X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
int ret=1;
if (x == NULL) return 0;
- obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
+ obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT));
if (obj == NULL)
{
X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE);
if (X509_OBJECT_retrieve_match(ctx->objs, obj))
{
X509_OBJECT_free_contents(obj);
- OPENSSL_free(obj);
+ free(obj);
X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret=0;
}
int ret=1;
if (x == NULL) return 0;
- obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
+ obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT));
if (obj == NULL)
{
X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE);
if (X509_OBJECT_retrieve_match(ctx->objs, obj))
{
X509_OBJECT_free_contents(obj);
- OPENSSL_free(obj);
+ free(obj);
X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret=0;
}
if(b)
{
buf=b->data;
- OPENSSL_free(b);
+ free(b);
}
strlcpy(buf,"NO X509_NAME",len);
return buf;
if (b != NULL)
{
p=b->data;
- OPENSSL_free(b);
+ free(b);
}
else
p=buf;
ri=ret->req_info;
ri->version->length=1;
- ri->version->data=(unsigned char *)OPENSSL_malloc(1);
+ ri->version->data=(unsigned char *)malloc(1);
if (ri->version->data == NULL) goto err;
ri->version->data[0]=0; /* version == 0 */
idx = X509_TRUST_get_by_id(id);
/* Need a new entry */
if(idx == -1) {
- if(!(trtmp = OPENSSL_malloc(sizeof(X509_TRUST)))) {
+ if(!(trtmp = malloc(sizeof(X509_TRUST)))) {
X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE);
return 0;
}
trtmp->flags = X509_TRUST_DYNAMIC;
} else trtmp = X509_TRUST_get0(idx);
- /* OPENSSL_free existing name if dynamic */
- if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name);
+ /* free existing name if dynamic */
+ if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) free(trtmp->name);
/* dup supplied name */
if(!(trtmp->name = BUF_strdup(name))) {
X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE);
if (p->flags & X509_TRUST_DYNAMIC)
{
if (p->flags & X509_TRUST_DYNAMIC_NAME)
- OPENSSL_free(p->name);
- OPENSSL_free(p);
+ free(p->name);
+ free(p);
}
}
X509_STORE_CTX *X509_STORE_CTX_new(void)
{
X509_STORE_CTX *ctx;
- ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX));
+ ctx = (X509_STORE_CTX *)malloc(sizeof(X509_STORE_CTX));
if (!ctx)
{
X509err(X509_F_X509_STORE_CTX_NEW,ERR_R_MALLOC_FAILURE);
void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
{
X509_STORE_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx,
&(ctx->ex_data)))
{
- OPENSSL_free(ctx);
+ free(ctx);
X509err(X509_F_X509_STORE_CTX_INIT,ERR_R_MALLOC_FAILURE);
return 0;
}
X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
{
X509_VERIFY_PARAM *param;
- param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
+ param = malloc(sizeof(X509_VERIFY_PARAM));
memset(param, 0, sizeof(X509_VERIFY_PARAM));
x509_verify_param_zero(param);
return param;
void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
{
x509_verify_param_zero(param);
- OPENSSL_free(param);
+ free(param);
}
/* This function determines how parameters are "inherited" from one structure
int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name)
{
if (param->name)
- OPENSSL_free(param->name);
+ free(param->name);
param->name = BUF_strdup(name);
if (param->name)
return 1;
int spki_len;
NETSCAPE_SPKI *spki;
if(len <= 0) len = strlen(str);
- if (!(spki_der = OPENSSL_malloc(len + 1))) {
+ if (!(spki_der = malloc(len + 1))) {
X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE);
return NULL;
}
if(spki_len < 0) {
X509err(X509_F_NETSCAPE_SPKI_B64_DECODE,
X509_R_BASE64_DECODE_ERROR);
- OPENSSL_free(spki_der);
+ free(spki_der);
return NULL;
}
p = spki_der;
spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len);
- OPENSSL_free(spki_der);
+ free(spki_der);
return spki;
}
char *b64_str;
int der_len;
der_len = i2d_NETSCAPE_SPKI(spki, NULL);
- der_spki = OPENSSL_malloc(der_len);
- b64_str = OPENSSL_malloc(der_len * 2);
+ der_spki = malloc(der_len);
+ b64_str = malloc(der_len * 2);
if(!der_spki || !b64_str) {
X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE);
return NULL;
p = der_spki;
i2d_NETSCAPE_SPKI(spki, &p);
EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len);
- OPENSSL_free(der_spki);
+ free(der_spki);
return b64_str;
}
CERTIFICATEPOLICIES *ext_cpols = NULL;
POLICY_MAPPINGS *ext_pmaps = NULL;
int i;
- cache = OPENSSL_malloc(sizeof(X509_POLICY_CACHE));
+ cache = malloc(sizeof(X509_POLICY_CACHE));
if (!cache)
return 0;
cache->anyPolicy = NULL;
policy_data_free(cache->anyPolicy);
if (cache->data)
sk_X509_POLICY_DATA_pop_free(cache->data, policy_data_free);
- OPENSSL_free(cache);
+ free(cache);
}
const X509_POLICY_CACHE *policy_cache_set(X509 *x)
sk_POLICYQUALINFO_pop_free(data->qualifier_set,
POLICYQUALINFO_free);
sk_ASN1_OBJECT_pop_free(data->expected_policy_set, ASN1_OBJECT_free);
- OPENSSL_free(data);
+ free(data);
}
/* Create a data based on an existing policy. If 'id' is NULL use the
}
else
id = NULL;
- ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA));
+ ret = malloc(sizeof(X509_POLICY_DATA));
if (!ret)
return NULL;
ret->expected_policy_set = sk_ASN1_OBJECT_new_null();
if (!ret->expected_policy_set)
{
- OPENSSL_free(ret);
+ free(ret);
if (id)
ASN1_OBJECT_free(id);
return NULL;
X509_POLICY_TREE *tree)
{
X509_POLICY_NODE *node;
- node = OPENSSL_malloc(sizeof(X509_POLICY_NODE));
+ node = malloc(sizeof(X509_POLICY_NODE));
if (!node)
return NULL;
node->data = data;
void policy_node_free(X509_POLICY_NODE *node)
{
- OPENSSL_free(node);
+ free(node);
}
/* See if a policy node matches a policy OID. If mapping enabled look through
/* If we get this far initialize the tree */
- tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE));
+ tree = malloc(sizeof(X509_POLICY_TREE));
if (!tree)
return 0;
tree->flags = 0;
- tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n);
+ tree->levels = malloc(sizeof(X509_POLICY_LEVEL) * n);
tree->nlevel = 0;
tree->extra_data = NULL;
tree->auth_policies = NULL;
if (!tree->levels)
{
- OPENSSL_free(tree);
+ free(tree);
return 0;
}
if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK)
{
node->parent->nchild--;
- OPENSSL_free(node);
+ free(node);
(void)sk_X509_POLICY_NODE_delete(nodes,i);
}
}
if (node->nchild == 0)
{
node->parent->nchild--;
- OPENSSL_free(node);
+ free(node);
(void)sk_X509_POLICY_NODE_delete(nodes, i);
}
}
{
if (curr->anyPolicy->parent)
curr->anyPolicy->parent->nchild--;
- OPENSSL_free(curr->anyPolicy);
+ free(curr->anyPolicy);
curr->anyPolicy = NULL;
}
if (curr == tree->levels)
static void exnode_free(X509_POLICY_NODE *node)
{
if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE))
- OPENSSL_free(node);
+ free(node);
}
sk_X509_POLICY_DATA_pop_free(tree->extra_data,
policy_data_free);
- OPENSSL_free(tree->levels);
- OPENSSL_free(tree);
+ free(tree->levels);
+ free(tree);
}
X509V3_conf_err(val);
goto err;
}
- OPENSSL_free(s);
+ free(s);
s = NULL;
continue;
}
goto err;
}
- OPENSSL_free(s);
+ free(s);
s = NULL;
}
return addr;
err:
- OPENSSL_free(s);
+ free(s);
sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free);
return NULL;
}
if(akeyid->keyid) {
tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length);
X509V3_add_value("keyid", tmp, &extlist);
- OPENSSL_free(tmp);
+ free(tmp);
}
if(akeyid->issuer)
extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
tmp = hex_to_string(akeyid->serial->data,
akeyid->serial->length);
X509V3_add_value("serial", tmp, &extlist);
- OPENSSL_free(tmp);
+ free(tmp);
}
return extlist;
}
if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx)))
return 0;
objlen = p - value;
- objtmp = OPENSSL_malloc(objlen + 1);
+ objtmp = malloc(objlen + 1);
if (objtmp) {
strlcpy(objtmp, value, objlen + 1);
gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0);
- OPENSSL_free(objtmp);
+ free(objtmp);
} else
gen->d.otherName->type_id = NULL;
if (!gen->d.otherName->type_id)
if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL)
return 0;
BIO_printf(out, "%*s%s\n", indent + 2, "", s);
- OPENSSL_free(s);
+ free(s);
break;
case ASIdOrRange_range:
if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL)
return 0;
BIO_printf(out, "%*s%s-", indent + 2, "", s);
- OPENSSL_free(s);
+ free(s);
if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL)
return 0;
BIO_printf(out, "%s\n", s);
- OPENSSL_free(s);
+ free(s);
break;
default:
return 0;
ASRange *r;
switch (a->type) {
case ASIdOrRange_id:
- if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) {
+ if ((r = malloc(sizeof(ASRange))) == NULL) {
X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
ERR_R_MALLOC_FAILURE);
goto done;
s[i1] = '\0';
min = s2i_ASN1_INTEGER(NULL, s);
max = s2i_ASN1_INTEGER(NULL, s + i2);
- OPENSSL_free(s);
+ free(s);
if (min == NULL || max == NULL) {
X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
goto err;
{
unsigned char *p;
ext_len = method->i2d(ext_struc, NULL);
- if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr;
+ if(!(ext_der = malloc(ext_len))) goto merr;
p = ext_der;
method->i2d(ext_struc, &p);
}
err:
ASN1_OBJECT_free(obj);
M_ASN1_OCTET_STRING_free(oct);
- if(ext_der) OPENSSL_free(ext_der);
+ if(ext_der) free(ext_der);
return extension;
}
if(i) BIO_puts(out, ", ");
tmp = i2s_ASN1_INTEGER(NULL, num);
BIO_puts(out, tmp);
- OPENSSL_free(tmp);
+ free(tmp);
}
BIO_puts(out, "\n");
}
{
char *tmp;
if(!ia5 || !ia5->length) return NULL;
- if(!(tmp = OPENSSL_malloc(ia5->length + 1))) {
+ if(!(tmp = malloc(ia5->length + 1))) {
X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE);
return NULL;
}
vtmp = sk_CONF_VALUE_value(ret, i);
i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method);
nlen = strlen(objtmp) + strlen(vtmp->name) + 5;
- ntmp = OPENSSL_malloc(nlen);
+ ntmp = malloc(nlen);
if(!ntmp) {
X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS,
ERR_R_MALLOC_FAILURE);
BUF_strlcpy(ntmp, objtmp, nlen);
BUF_strlcat(ntmp, " - ", nlen);
BUF_strlcat(ntmp, vtmp->name, nlen);
- OPENSSL_free(vtmp->name);
+ free(vtmp->name);
vtmp->name = ntmp;
}
ctmp.value = cnf->value;
if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0))
goto err;
- if(!(objtmp = OPENSSL_malloc(objlen + 1))) {
+ if(!(objtmp = malloc(objlen + 1))) {
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE);
goto err;
}
if(!acc->method) {
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT);
ERR_add_error_data(2, "value=", objtmp);
- OPENSSL_free(objtmp);
+ free(objtmp);
goto err;
}
- OPENSSL_free(objtmp);
+ free(objtmp);
}
return ainfo;
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
return 0;
}
- if(!(tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) {
+ if(!(tmpext = (X509V3_EXT_METHOD *)malloc(sizeof(X509V3_EXT_METHOD)))) {
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);
return 0;
}
static void ext_list_free(X509V3_EXT_METHOD *ext)
{
- if(ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext);
+ if(ext->ext_flags & X509V3_EXT_DYNAMIC) free(ext);
}
/* Legacy function: we don't need to add standard extensions
goto err;
}
- tmp_data = OPENSSL_realloc((*policy)->data,
+ tmp_data = realloc((*policy)->data,
(*policy)->length + val_len + 1);
if (tmp_data)
{
}
else
{
- OPENSSL_free(tmp_data2);
+ free(tmp_data2);
/* realloc failure implies the original data space is b0rked too! */
(*policy)->data = NULL;
(*policy)->length = 0;
X509V3_conf_err(val);
goto err;
}
- OPENSSL_free(tmp_data2);
+ free(tmp_data2);
}
else if (strncmp(val->value, "file:", 5) == 0)
{
{
if (!n) continue;
- tmp_data = OPENSSL_realloc((*policy)->data,
+ tmp_data = realloc((*policy)->data,
(*policy)->length + n + 1);
if (!tmp_data)
else if (strncmp(val->value, "text:", 5) == 0)
{
val_len = strlen(val->value + 5);
- tmp_data = OPENSSL_realloc((*policy)->data,
+ tmp_data = realloc((*policy)->data,
(*policy)->length + val_len + 1);
if (tmp_data)
{
err:
sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
- if(value) OPENSSL_free(value);
+ if(value) free(value);
if(method->it) ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it));
else method->ext_free(ext_str);
return ok;
idx = X509_PURPOSE_get_by_id(id);
/* Need a new entry */
if(idx == -1) {
- if(!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) {
+ if(!(ptmp = malloc(sizeof(X509_PURPOSE)))) {
X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE);
return 0;
}
ptmp->flags = X509_PURPOSE_DYNAMIC;
} else ptmp = X509_PURPOSE_get0(idx);
- /* OPENSSL_free existing name if dynamic */
+ /* free existing name if dynamic */
if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) {
- OPENSSL_free(ptmp->name);
- OPENSSL_free(ptmp->sname);
+ free(ptmp->name);
+ free(ptmp->sname);
}
/* dup supplied name */
ptmp->name = BUF_strdup(name);
if (p->flags & X509_PURPOSE_DYNAMIC)
{
if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
- OPENSSL_free(p->name);
- OPENSSL_free(p->sname);
+ free(p->name);
+ free(p->sname);
}
- OPENSSL_free(p);
+ free(p);
}
}
id = sk_SXNETID_value(sx->ids, i);
tmp = i2s_ASN1_INTEGER(NULL, id->zone);
BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
- OPENSSL_free(tmp);
+ free(tmp);
M_ASN1_OCTET_STRING_print(out, id->user);
}
return 1;
char *tname = NULL, *tvalue = NULL;
if(name && !(tname = BUF_strdup(name))) goto err;
if(value && !(tvalue = BUF_strdup(value))) goto err;
- if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err;
+ if(!(vtmp = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) goto err;
if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err;
vtmp->section = NULL;
vtmp->name = tname;
return 1;
err:
X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE);
- if(vtmp) OPENSSL_free(vtmp);
- if(tname) OPENSSL_free(tname);
- if(tvalue) OPENSSL_free(tvalue);
+ if(vtmp) free(vtmp);
+ if(tname) free(tname);
+ if(tvalue) free(tvalue);
return 0;
}
void X509V3_conf_free(CONF_VALUE *conf)
{
if(!conf) return;
- if(conf->name) OPENSSL_free(conf->name);
- if(conf->value) OPENSSL_free(conf->value);
- if(conf->section) OPENSSL_free(conf->section);
- OPENSSL_free(conf);
+ if(conf->name) free(conf->name);
+ if(conf->value) free(conf->value);
+ if(conf->section) free(conf->section);
+ free(conf);
}
int X509V3_add_value_bool(const char *name, int asn1_bool,
if(!aint) return 1;
if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0;
ret = X509V3_add_value(name, strtmp, extlist);
- OPENSSL_free(strtmp);
+ free(strtmp);
return ret;
}
}
X509V3_add_value(ntmp, NULL, &values);
}
-OPENSSL_free(linebuf);
+free(linebuf);
return values;
err:
-OPENSSL_free(linebuf);
+free(linebuf);
sk_CONF_VALUE_pop_free(values, X509V3_conf_free);
return NULL;
/* hex string utilities */
-/* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its
+/* Given a buffer of length 'len' return a malloc'ed string with its
* hex representation
* @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines)
*/
int i;
const static char hexdig[] = "0123456789ABCDEF";
if(!buffer || !len) return NULL;
- if(!(tmp = OPENSSL_malloc(len * 3 + 1))) {
+ if(!(tmp = malloc(len * 3 + 1))) {
X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE);
return NULL;
}
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT);
return NULL;
}
- if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err;
+ if(!(hexbuf = malloc(strlen(str) >> 1))) goto err;
for(p = (unsigned char *)str, q = hexbuf; *p;) {
ch = *p++;
if(ch == ':') continue;
cl = *p++;
if(!cl) {
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS);
- OPENSSL_free(hexbuf);
+ free(hexbuf);
return NULL;
}
if(isupper(ch)) ch = tolower(ch);
return hexbuf;
err:
- if(hexbuf) OPENSSL_free(hexbuf);
+ if(hexbuf) free(hexbuf);
X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE);
return NULL;
badhex:
- OPENSSL_free(hexbuf);
+ free(hexbuf);
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT);
return NULL;
static void str_free(OPENSSL_STRING str)
{
- OPENSSL_free(str);
+ free(str);
}
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email)
iplen2 = a2i_ipadd(ipout + iplen1, p);
- OPENSSL_free(iptmp);
+ free(iptmp);
iptmp = NULL;
if (!iplen2 || (iplen1 != iplen2))
err:
if (iptmp)
- OPENSSL_free(iptmp);
+ free(iptmp);
if (ret)
ASN1_OCTET_STRING_free(ret);
return NULL;
{
BIO_SSL *bs;
- bs = (BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL));
+ bs = (BIO_SSL *)malloc(sizeof(BIO_SSL));
if (bs == NULL) {
BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return (0);
a->flags = 0;
}
if (a->ptr != NULL)
- OPENSSL_free(a->ptr);
+ free(a->ptr);
return (1);
}
unsigned char *buf = NULL;
unsigned char *bitmask = NULL;
- frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
+ frag = (hm_fragment *)malloc(sizeof(hm_fragment));
if (frag == NULL)
return NULL;
if (frag_len) {
- buf = (unsigned char *)OPENSSL_malloc(frag_len);
+ buf = (unsigned char *)malloc(frag_len);
if (buf == NULL) {
- OPENSSL_free(frag);
+ free(frag);
return NULL;
}
}
/* Initialize reassembly bitmask if necessary */
if (reassembly) {
- bitmask = (unsigned char *)OPENSSL_malloc(RSMBLY_BITMASK_SIZE(frag_len));
+ bitmask = (unsigned char *)malloc(RSMBLY_BITMASK_SIZE(frag_len));
if (bitmask == NULL) {
if (buf != NULL)
- OPENSSL_free(buf);
- OPENSSL_free(frag);
+ free(buf);
+ free(frag);
return NULL;
}
memset(bitmask, 0, RSMBLY_BITMASK_SIZE(frag_len));
EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash);
}
if (frag->fragment)
- OPENSSL_free(frag->fragment);
+ free(frag->fragment);
if (frag->reassembly)
- OPENSSL_free(frag->reassembly);
- OPENSSL_free(frag);
+ free(frag->reassembly);
+ free(frag);
}
/* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */
is_complete);
if (is_complete) {
- OPENSSL_free(frag->reassembly);
+ free(frag->reassembly);
frag->reassembly = NULL;
}
if (frag != NULL)
dtls1_hm_fragment_free(frag);
if (item != NULL)
- OPENSSL_free(item);
+ free(item);
*ok = 0;
return i;
}
if (frag != NULL)
dtls1_hm_fragment_free(frag);
if (item != NULL)
- OPENSSL_free(item);
+ free(item);
*ok = 0;
return i;
}
NULL, 0, NULL);
encodedPoint = (unsigned char *)
- OPENSSL_malloc(encoded_pt_len *
+ malloc(encoded_pt_len *
sizeof(unsigned char));
bn_ctx = BN_CTX_new();
/* Free allocated memory */
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
s2n(psk_len, t);
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint);
if (s->ctx->psk_identity_hint != NULL &&
s->session->psk_identity_hint == NULL) {
}
if (s->session->psk_identity != NULL)
- OPENSSL_free(s->session->psk_identity);
+ free(s->session->psk_identity);
s->session->psk_identity = BUF_strdup(identity);
if (s->session->psk_identity == NULL) {
SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
#ifndef OPENSSL_NO_ECDH
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
if (!ssl3_new(s))
return (0);
- if ((d1 = OPENSSL_malloc(sizeof *d1)) == NULL) return (0);
+ if ((d1 = malloc(sizeof *d1)) == NULL) return (0);
memset(d1, 0, sizeof *d1);
/* d1->handshake_epoch=0; */
pqueue_free(d1->sent_messages);
if (d1->buffered_app_data.q)
pqueue_free(d1->buffered_app_data.q);
- OPENSSL_free(d1);
+ free(d1);
return (0);
}
while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf) {
- OPENSSL_free(rdata->rbuf.buf);
+ free(rdata->rbuf.buf);
}
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf) {
- OPENSSL_free(rdata->rbuf.buf);
+ free(rdata->rbuf.buf);
}
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) {
frag = (hm_fragment *)item->data;
- OPENSSL_free(frag->fragment);
- OPENSSL_free(frag);
+ free(frag->fragment);
+ free(frag);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) {
frag = (hm_fragment *)item->data;
- OPENSSL_free(frag->fragment);
- OPENSSL_free(frag);
+ free(frag->fragment);
+ free(frag);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) {
frag = (hm_fragment *)item->data;
- OPENSSL_free(frag->fragment);
- OPENSSL_free(frag);
+ free(frag->fragment);
+ free(frag);
pitem_free(item);
}
}
pqueue_free(s->d1->sent_messages);
pqueue_free(s->d1->buffered_app_data.q);
- OPENSSL_free(s->d1);
+ free(s->d1);
s->d1 = NULL;
}
rdata = (DTLS1_RECORD_DATA *)item->data;
if (s->s3->rbuf.buf != NULL)
- OPENSSL_free(s->s3->rbuf.buf);
+ free(s->s3->rbuf.buf);
s->packet = rdata->packet;
s->packet_length = rdata->packet_length;
if (pqueue_size(queue->q) >= 100)
return 0;
- rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA));
+ rdata = malloc(sizeof(DTLS1_RECORD_DATA));
item = pitem_new(priority, rdata);
if (rdata == NULL || item == NULL) {
if (rdata != NULL)
- OPENSSL_free(rdata);
+ free(rdata);
if (item != NULL)
pitem_free(item);
/* insert should not fail, since duplicates are dropped */
if (pqueue_insert(queue->q, item) == NULL) {
- OPENSSL_free(rdata);
+ free(rdata);
pitem_free(item);
return (0);
}
if (!ssl3_setup_buffers(s)) {
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
- OPENSSL_free(rdata);
+ free(rdata);
pitem_free(item);
return (0);
}
if (item) {
dtls1_copy_record(s, item);
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
return (1);
rdata = (DTLS1_RECORD_DATA *)item->data;
if (s->s3->rbuf.buf != NULL)
- OPENSSL_free(s->s3->rbuf.buf);
+ free(s->s3->rbuf.buf);
s->packet = rdata->packet;
s->packet_length = rdata->packet_length;
memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER));
memcpy(&(s->s3->rrec), &(rdata->rrec), sizeof(SSL3_RECORD));
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
/* s->d1->next_expected_seq_num++; */
dtls1_copy_record(s, item);
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
}
}
NULL, 0, NULL);
encodedPoint = (unsigned char *)
- OPENSSL_malloc(encodedlen*sizeof(unsigned char));
+ malloc(encodedlen*sizeof(unsigned char));
bn_ctx = BN_CTX_new();
if ((encodedPoint == NULL) || (bn_ctx == NULL)) {
memcpy((unsigned char*)p,
(unsigned char *)encodedPoint,
encodedlen);
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
p += encodedlen;
}
#endif
err:
#ifndef OPENSSL_NO_ECDH
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
BN_CTX_free(bn_ctx);
#endif
EVP_MD_CTX_cleanup(&md_ctx);
DTLS1_HM_HEADER_LENGTH + 22 + EVP_MAX_IV_LENGTH +
EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen))
return -1;
- senc = OPENSSL_malloc(slen);
+ senc = malloc(slen);
if (!senc)
return -1;
p = senc;
if (tctx->tlsext_ticket_key_cb) {
if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
&hctx, 1) < 0) {
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
} else {
s->init_num = len;
s->state = SSL3_ST_SW_SESSION_TICKET_B;
s->init_off = 0;
- OPENSSL_free(senc);
+ free(senc);
/* XDTLS: set message header ? */
msg_len = s->init_num - DTLS1_HM_HEADER_LENGTH;
s->init_num = 0;
if (buf != buf_space)
- OPENSSL_free(buf);
+ free(buf);
return (SSL_accept(s));
err:
if (buf != buf_space)
- OPENSSL_free(buf);
+ free(buf);
return (-1);
}
if (!(s->options & SSL_OP_NO_COMPRESSION))
len += SSL3_RT_MAX_COMPRESSED_OVERHEAD;
#endif
- if ((p = OPENSSL_malloc(len)) == NULL)
+ if ((p = malloc(len)) == NULL)
goto err;
s->s3->rbuf.buf = p;
s->s3->rbuf.len = len;
len += headerlen + align +
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD;
- if ((p = OPENSSL_malloc(len)) == NULL)
+ if ((p = malloc(len)) == NULL)
goto err;
s->s3->wbuf.buf = p;
s->s3->wbuf.len = len;
ssl3_release_write_buffer(SSL *s)
{
if (s->s3->wbuf.buf != NULL) {
- OPENSSL_free(s->s3->wbuf.buf);
+ free(s->s3->wbuf.buf);
s->s3->wbuf.buf = NULL;
}
return 1;
ssl3_release_read_buffer(SSL *s)
{
if (s->s3->rbuf.buf != NULL) {
- OPENSSL_free(s->s3->rbuf.buf);
+ free(s->s3->rbuf.buf);
s->s3->rbuf.buf = NULL;
}
return 1;
if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) {
s->session->sess_cert = ssl_sess_cert_new();
if (s->ctx->psk_identity_hint)
- OPENSSL_free(s->ctx->psk_identity_hint);
+ free(s->ctx->psk_identity_hint);
s->ctx->psk_identity_hint = NULL;
}
#endif
memcpy(tmp_id_hint, p, i);
memset(tmp_id_hint + i, 0, PSK_MAX_IDENTITY_LEN + 1 - i);
if (s->ctx->psk_identity_hint != NULL)
- OPENSSL_free(s->ctx->psk_identity_hint);
+ free(s->ctx->psk_identity_hint);
s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint);
if (s->ctx->psk_identity_hint == NULL) {
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE);
goto f_err;
}
if (s->session->tlsext_tick) {
- OPENSSL_free(s->session->tlsext_tick);
+ free(s->session->tlsext_tick);
s->session->tlsext_ticklen = 0;
}
- s->session->tlsext_tick = OPENSSL_malloc(ticklen);
+ s->session->tlsext_tick = malloc(ticklen);
if (!s->session->tlsext_tick) {
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE);
goto err;
goto f_err;
}
if (s->tlsext_ocsp_resp)
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = BUF_memdup(p, resplen);
if (!s->tlsext_ocsp_resp) {
al = SSL_AD_INTERNAL_ERROR;
NULL, 0, NULL);
encodedPoint =
- (unsigned char *)OPENSSL_malloc(
+ (unsigned char *)malloc(
encoded_pt_len * sizeof(unsigned char));
bn_ctx = BN_CTX_new();
/* Free allocated memory */
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
goto err;
}
if (s->session->srp_username != NULL)
- OPENSSL_free(s->session->srp_username);
+ free(s->session->srp_username);
s->session->srp_username = BUF_strdup(s->srp_ctx.login);
if (s->session->srp_username == NULL) {
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
s2n(psk_len, t);
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint);
if (s->ctx->psk_identity_hint != NULL &&
s->session->psk_identity_hint == NULL) {
}
if (s->session->psk_identity != NULL)
- OPENSSL_free(s->session->psk_identity);
+ free(s->session->psk_identity);
s->session->psk_identity = BUF_strdup(identity);
if (s->session->psk_identity == NULL) {
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
#ifndef OPENSSL_NO_ECDH
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
{
SSL3_STATE *s3;
- if ((s3 = OPENSSL_malloc(sizeof *s3)) == NULL) goto err;
+ if ((s3 = malloc(sizeof *s3)) == NULL) goto err;
memset(s3, 0, sizeof *s3);
memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num));
memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num));
#ifdef TLSEXT_TYPE_opaque_prf_input
if (s->s3->client_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
if (s->s3->server_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
#endif
ssl3_cleanup_key_block(s);
if (s->s3->wbuf.buf != NULL)
ssl3_release_write_buffer(s);
if (s->s3->rrec.comp != NULL)
- OPENSSL_free(s->s3->rrec.comp);
+ free(s->s3->rrec.comp);
#ifndef OPENSSL_NO_DH
if (s->s3->tmp.dh != NULL)
DH_free(s->s3->tmp.dh);
SSL_SRP_CTX_free(s);
#endif
OPENSSL_cleanse(s->s3, sizeof *s->s3);
- OPENSSL_free(s->s3);
+ free(s->s3);
s->s3 = NULL;
}
#ifdef TLSEXT_TYPE_opaque_prf_input
if (s->s3->client_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
s->s3->client_opaque_prf_input = NULL;
if (s->s3->server_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
s->s3->server_opaque_prf_input = NULL;
#endif
sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
if (s->s3->rrec.comp != NULL) {
- OPENSSL_free(s->s3->rrec.comp);
+ free(s->s3->rrec.comp);
s->s3->rrec.comp = NULL;
}
#ifndef OPENSSL_NO_DH
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (s->next_proto_negotiated) {
- OPENSSL_free(s->next_proto_negotiated);
+ free(s->next_proto_negotiated);
s->next_proto_negotiated = NULL;
s->next_proto_negotiated_len = 0;
}
case SSL_CTRL_SET_TLSEXT_HOSTNAME:
if (larg == TLSEXT_NAMETYPE_host_name) {
if (s->tlsext_hostname != NULL)
- OPENSSL_free(s->tlsext_hostname);
+ free(s->tlsext_hostname);
s->tlsext_hostname = NULL;
ret = 1;
break;
}
if (s->tlsext_opaque_prf_input != NULL)
- OPENSSL_free(s->tlsext_opaque_prf_input);
+ free(s->tlsext_opaque_prf_input);
if ((size_t)larg == 0)
- s->tlsext_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->tlsext_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg);
if (s->tlsext_opaque_prf_input != NULL) {
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP:
if (s->tlsext_ocsp_resp)
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = parg;
s->tlsext_ocsp_resplen = larg;
ret = 1;
case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
ctx->srp_ctx.srp_Mask|=SSL_kSRP;
if (ctx->srp_ctx.login != NULL)
- OPENSSL_free(ctx->srp_ctx.login);
+ free(ctx->srp_ctx.login);
ctx->srp_ctx.login = NULL;
if (parg == NULL)
break;
NULL, 0, NULL);
encodedPoint = (unsigned char *)
- OPENSSL_malloc(encodedlen*sizeof(unsigned char));
+ malloc(encodedlen*sizeof(unsigned char));
bn_ctx = BN_CTX_new();
if ((encodedPoint == NULL) || (bn_ctx == NULL)) {
p += 1;
memcpy((unsigned char*)p,
(unsigned char *)encodedPoint, encodedlen);
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
encodedPoint = NULL;
p += encodedlen;
}
err:
#ifndef OPENSSL_NO_ECDH
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
BN_CTX_free(bn_ctx);
#endif
EVP_MD_CTX_cleanup(&md_ctx);
s2n(psk_len, t);
if (s->session->psk_identity != NULL)
- OPENSSL_free(s->session->psk_identity);
+ free(s->session->psk_identity);
s->session->psk_identity = BUF_strdup((char *)p);
if (s->session->psk_identity == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
}
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint);
if (s->ctx->psk_identity_hint != NULL &&
s->session->psk_identity_hint == NULL) {
goto err;
}
if (s->session->srp_username != NULL)
- OPENSSL_free(s->session->srp_username);
+ free(s->session->srp_username);
s->session->srp_username = BUF_strdup(s->srp_ctx.login);
if (s->session->srp_username == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
*/
if (slen_full > 0xFF00)
return -1;
- senc = OPENSSL_malloc(slen_full);
+ senc = malloc(slen_full);
if (!senc)
return -1;
p = senc;
const_p = senc;
sess = d2i_SSL_SESSION(NULL, &const_p, slen_full);
if (sess == NULL) {
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
slen = i2d_SSL_SESSION(sess, NULL);
if (slen > slen_full) {
/* shouldn't ever happen */
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
p = senc;
if (tctx->tlsext_ticket_key_cb) {
if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
&hctx, 1) < 0) {
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
} else {
s->init_num = len;
s->state = SSL3_ST_SW_SESSION_TICKET_B;
s->init_off = 0;
- OPENSSL_free(senc);
+ free(senc);
}
/* SSL3_ST_SW_SESSION_TICKET_B */
if (proto_len + padding_len + 2 != s->init_num)
return 0;
- s->next_proto_negotiated = OPENSSL_malloc(proto_len);
+ s->next_proto_negotiated = malloc(proto_len);
if (!s->next_proto_negotiated) {
SSLerr(SSL_F_SSL3_GET_NEXT_PROTO, ERR_R_MALLOC_FAILURE);
return 0;
i = 0;
if (arg->count == 0) {
arg->count = 20;
- arg->data = (char **)OPENSSL_malloc(sizeof(char *)*arg->count);
+ arg->data = (char **)malloc(sizeof(char *)*arg->count);
}
for (i = 0; i < arg->count; i++)
arg->data[i] = NULL;
if (num >= arg->count) {
char **tmp_p;
int tlen = arg->count + 20;
- tmp_p = (char **)OPENSSL_realloc(arg->data,
+ tmp_p = (char **)realloc(arg->data,
sizeof(char *)*tlen);
if (tmp_p == NULL)
return 0;
p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0);
BIO_puts(out, "subject=");
BIO_puts(out, p);
- OPENSSL_free(p);
+ free(p);
p = X509_NAME_oneline(X509_get_issuer_name(x), NULL, 0);
BIO_puts(out, "\nissuer=");
BIO_puts(out, p);
BIO_puts(out, "\n");
- OPENSSL_free(p);
+ free(p);
return 0;
}
ok = UI_add_input_string(ui, prompt, ui_flags, buf,
PW_MIN_LENGTH, bufsiz - 1);
if (ok >= 0 && verify) {
- buff = (char *)OPENSSL_malloc(bufsiz);
+ buff = (char *)malloc(bufsiz);
ok = UI_add_verify_string(ui, prompt, ui_flags, buff,
PW_MIN_LENGTH, bufsiz - 1, buf);
}
if (buff) {
OPENSSL_cleanse(buff, (unsigned int)bufsiz);
- OPENSSL_free(buff);
+ free(buff);
}
if (ok >= 0)
res = 0;
}
UI_free(ui);
- OPENSSL_free(prompt);
+ free(prompt);
}
return res;
}
buf = X509_NAME_oneline(nm, 0, 0);
BIO_puts(out, buf);
BIO_puts(out, "\n");
- OPENSSL_free(buf);
+ free(buf);
} else {
if (mline)
BIO_puts(out, "\n");
char *p;
len = strlen(t) + strlen(OPENSSL_CONF) + 2;
- p = OPENSSL_malloc(len);
+ p = malloc(len);
BUF_strlcpy(p, t, len);
BUF_strlcat(p, "/", len);
BUF_strlcat(p, OPENSSL_CONF, len);
}
}
- if ((retdb = OPENSSL_malloc(sizeof(CA_DB))) == NULL) {
+ if ((retdb = malloc(sizeof(CA_DB))) == NULL) {
fprintf(stderr, "Out of memory\n");
goto err;
}
if (db) {
if (db->db)
TXT_DB_free(db->db);
- OPENSSL_free(db);
+ free(db);
}
}
parse_name(char *subject, long chtype, int multirdn)
{
size_t buflen = strlen(subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */
- char *buf = OPENSSL_malloc(buflen);
+ char *buf = malloc(buflen);
size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */
- char **ne_types = OPENSSL_malloc(max_ne * sizeof (char *));
- char **ne_values = OPENSSL_malloc(max_ne * sizeof (char *));
- int *mval = OPENSSL_malloc (max_ne * sizeof (int));
+ char **ne_types = malloc(max_ne * sizeof (char *));
+ char **ne_values = malloc(max_ne * sizeof (char *));
+ int *mval = malloc (max_ne * sizeof (int));
char *sp = subject, *bp = buf;
int i, ne_num = 0;
goto error;
}
- OPENSSL_free(ne_values);
- OPENSSL_free(ne_types);
- OPENSSL_free(buf);
- OPENSSL_free(mval);
+ free(ne_values);
+ free(ne_types);
+ free(buf);
+ free(mval);
return n;
error:
X509_NAME_free(n);
if (ne_values)
- OPENSSL_free(ne_values);
+ free(ne_values);
if (ne_types)
- OPENSSL_free(ne_types);
+ free(ne_types);
if (mval)
- OPENSSL_free(mval);
+ free(mval);
if (buf)
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
vtmp++;
}
rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
- OPENSSL_free(stmp);
+ free(stmp);
return rv;
}
if (len >= 65535)
return NULL;
- out = OPENSSL_malloc(strlen(in) + 1);
+ out = malloc(strlen(in) + 1);
if (!out)
return NULL;
for (i = 0; i <= len; ++i) {
if (i == len || in[i] == ',') {
if (i - start > 255) {
- OPENSSL_free(out);
+ free(out);
return NULL;
}
out[start] = i - start;
size_t len;
len = strlen(s) + sizeof(CONFIG_FILE) + 1;
- tofree = OPENSSL_malloc(len);
+ tofree = malloc(len);
BUF_strlcpy(tofree, s, len);
BUF_strlcat(tofree, "/", len);
BUF_strlcat(tofree, CONFIG_FILE, len);
goto err;
}
if (tofree) {
- OPENSSL_free(tofree);
+ free(tofree);
tofree = NULL;
}
if ((f = BN_bn2hex(serial)) == NULL)
goto err;
BIO_printf(bio_err, "next serial number is %s\n", f);
- OPENSSL_free(f);
+ free(f);
}
}
ret = 0;
err:
if (tofree)
- OPENSSL_free(tofree);
+ free(tofree);
BIO_free_all(Cout);
BIO_free_all(Sout);
BIO_free_all(out);
ERR_print_errors(bio_err);
app_RAND_write_file(randfile, bio_err);
if (free_key && key)
- OPENSSL_free(key);
+ free(key);
BN_free(serial);
BN_free(crlnumber);
free_index(db);
goto err;
/* We now just add it to the database */
- row[DB_type] = (char *)OPENSSL_malloc(2);
+ row[DB_type] = (char *)malloc(2);
tm = X509_get_notAfter(ret);
- row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1);
+ row[DB_exp_date] = (char *)malloc(tm->length + 1);
memcpy(row[DB_exp_date], tm->data, tm->length);
row[DB_exp_date][tm->length] = '\0';
row[DB_rev_date] = NULL;
/* row[DB_serial] done already */
- row[DB_file] = (char *)OPENSSL_malloc(8);
+ row[DB_file] = (char *)malloc(8);
row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0);
if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) ||
row[DB_type][0] = 'V';
row[DB_type][1] = '\0';
- if ((irow = (char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) {
+ if ((irow = (char **)malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto err;
}
err:
for (i = 0; i < DB_NUMBER; i++)
if (row[i] != NULL)
- OPENSSL_free(row[i]);
+ free(row[i]);
if (CAname != NULL)
X509_NAME_free(CAname);
BIO_printf(bio_err, "Adding Entry with serial number %s to DB for %s\n", row[DB_serial], row[DB_name]);
/* We now just add it to the database */
- row[DB_type] = (char *)OPENSSL_malloc(2);
+ row[DB_type] = (char *)malloc(2);
tm = X509_get_notAfter(x509);
- row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1);
+ row[DB_exp_date] = (char *)malloc(tm->length + 1);
memcpy(row[DB_exp_date], tm->data, tm->length);
row[DB_exp_date][tm->length] = '\0';
row[DB_rev_date] = NULL;
/* row[DB_serial] done already */
- row[DB_file] = (char *)OPENSSL_malloc(8);
+ row[DB_file] = (char *)malloc(8);
/* row[DB_name] done already */
row[DB_type][0] = 'V';
row[DB_type][1] = '\0';
- if ((irow = (char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) {
+ if ((irow = (char **)malloc(sizeof(char *)*(DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto err;
}
err:
for (i = 0; i < DB_NUMBER; i++) {
if (row[i] != NULL)
- OPENSSL_free(row[i]);
+ free(row[i]);
}
return (ok);
}
row[i] = NULL;
/* Malloc needed char spaces */
- row[DB_serial] = OPENSSL_malloc(strlen(serial) + 2);
+ row[DB_serial] = malloc(strlen(serial) + 2);
if (row[DB_serial] == NULL) {
BIO_printf(bio_err, "Malloc failure\n");
goto err;
err:
for (i = 0; i < DB_NUMBER; i++) {
if (row[i] != NULL)
- OPENSSL_free(row[i]);
+ free(row[i]);
}
return (ok);
}
/* get actual time and make a string */
a_tm = X509_gmtime_adj(a_tm, 0);
- a_tm_s = (char *) OPENSSL_malloc(a_tm->length + 1);
+ a_tm_s = (char *) malloc(a_tm->length + 1);
if (a_tm_s == NULL) {
cnt = -1;
goto err;
err:
ASN1_UTCTIME_free(a_tm);
- OPENSSL_free(a_tm_s);
+ free(a_tm_s);
return (cnt);
}
if (other) i += strlen(other)
+ 1;
- str = OPENSSL_malloc(i);
+ str = malloc(i);
if (!str)
return NULL;
err:
if (tmp)
- OPENSSL_free(tmp);
+ free(tmp);
ASN1_OBJECT_free(hold);
ASN1_GENERALIZEDTIME_free(comp_time);
ASN1_ENUMERATED_free(rtmp);
err:
if (tmp)
- OPENSSL_free(tmp);
+ free(tmp);
if (!phold)
ASN1_OBJECT_free(hold);
if (!pinvtm)
if (skkeys)
sk_OPENSSL_STRING_free(skkeys);
if (secret_key)
- OPENSSL_free(secret_key);
+ free(secret_key);
if (secret_keyid)
- OPENSSL_free(secret_keyid);
+ free(secret_keyid);
if (pwri_tmp)
- OPENSSL_free(pwri_tmp);
+ free(pwri_tmp);
if (econtent_type)
ASN1_OBJECT_free(econtent_type);
if (rr)
BIO_free(indata);
BIO_free_all(out);
if (passin)
- OPENSSL_free(passin);
+ free(passin);
return (ret);
}
p7s->crl = crl_stack;
if (crl != NULL) {
sk_X509_CRL_push(crl_stack, crl);
- crl=NULL; /* now part of p7 for OPENSSL_freeing */
+ crl=NULL; /* now part of p7 for freeing */
}
if ((cert_stack = sk_X509_new_null()) == NULL)
ret = count;
end:
- /* never need to OPENSSL_free x */
+ /* never need to free x */
if (in != NULL)
BIO_free(in);
if (sk != NULL)
apps_startup();
- if ((buf = (unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL) {
+ if ((buf = (unsigned char *)malloc(BUFSIZE)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
goto end;
}
BIO *sigbio;
sigbio = BIO_new_file(sigfile, "rb");
siglen = EVP_PKEY_size(sigkey);
- sigbuf = OPENSSL_malloc(siglen);
+ sigbuf = malloc(siglen);
if (!sigbio) {
BIO_printf(bio_err, "Error opening signature file %s\n",
sigfile);
end:
if (buf != NULL) {
OPENSSL_cleanse(buf, BUFSIZE);
- OPENSSL_free(buf);
+ free(buf);
}
if (in != NULL)
BIO_free(in);
if (passin)
- OPENSSL_free(passin);
+ free(passin);
BIO_free_all(out);
EVP_PKEY_free(sigkey);
if (sigopts)
sk_OPENSSL_STRING_free(sigopts);
if (macopts)
sk_OPENSSL_STRING_free(macopts);
- if (sigbuf) OPENSSL_free(sigbuf);
+ if (sigbuf) free(sigbuf);
if (bmd != NULL)
BIO_free(bmd);
apps_shutdown();
len = BN_num_bytes(dh->p);
bits = BN_num_bits(dh->p);
- data = (unsigned char *)OPENSSL_malloc(len);
+ data = (unsigned char *)malloc(len);
if (data == NULL) {
- perror("OPENSSL_malloc");
+ perror("malloc");
goto end;
}
l = BN_bn2bin(dh->p, data);
printf("\tif ((dh->p == NULL) || (dh->g == NULL))\n");
printf("\t\treturn(NULL);\n");
printf("\treturn(dh);\n\t}\n");
- OPENSSL_free(data);
+ free(data);
}
if (!noout) {
len = BN_num_bytes(dh->p);
bits = BN_num_bits(dh->p);
- data = (unsigned char *)OPENSSL_malloc(len);
+ data = (unsigned char *)malloc(len);
if (data == NULL) {
- perror("OPENSSL_malloc");
+ perror("malloc");
goto end;
}
printf("#ifndef HEADER_DH_H\n"
if (dh->length)
printf("\tdh->length = %ld;\n", dh->length);
printf("\treturn(dh);\n\t}\n");
- OPENSSL_free(data);
+ free(data);
}
if (!noout) {
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa);
- if (passin) OPENSSL_free(passin);
- if (passout) OPENSSL_free(passout);
+ if (passin) free(passin);
+ if (passout) free(passout);
apps_shutdown();
OPENSSL_EXIT(ret);
}
len = BN_num_bytes(dsa->p);
bits_p = BN_num_bits(dsa->p);
- data = (unsigned char *)OPENSSL_malloc(len + 20);
+ data = (unsigned char *)malloc(len + 20);
if (data == NULL) {
- perror("OPENSSL_malloc");
+ perror("malloc");
goto end;
}
l = BN_bn2bin(dsa->p, data);
if (eckey)
EC_KEY_free(eckey);
if (passin)
- OPENSSL_free(passin);
+ free(passin);
if (passout)
- OPENSSL_free(passout);
+ free(passout);
apps_shutdown();
OPENSSL_EXIT(ret);
}
crv_len = EC_get_builtin_curves(NULL, 0);
- curves = OPENSSL_malloc((int)(sizeof(EC_builtin_curve) * crv_len));
+ curves = malloc((int)(sizeof(EC_builtin_curve) * crv_len));
if (curves == NULL)
goto end;
if (!EC_get_builtin_curves(curves, crv_len))
{
- OPENSSL_free(curves);
+ free(curves);
goto end;
}
BIO_printf(out, "%s\n", comment);
}
- OPENSSL_free(curves);
+ free(curves);
ret = 0;
goto end;
}
(ec_order = BN_new()) == NULL ||
(ec_cofactor = BN_new()) == NULL )
{
- perror("OPENSSL_malloc");
+ perror("malloc");
goto end;
}
if ((tmp_len = (size_t)BN_num_bytes(ec_cofactor)) > buf_len)
buf_len = tmp_len;
- buffer = (unsigned char *)OPENSSL_malloc(buf_len);
+ buffer = (unsigned char *)malloc(buf_len);
if (buffer == NULL)
{
- perror("OPENSSL_malloc");
+ perror("malloc");
goto end;
}
if (ec_cofactor)
BN_free(ec_cofactor);
if (buffer)
- OPENSSL_free(buffer);
+ free(buffer);
if (in != NULL)
BIO_free(in);
if (out != NULL)
if (verbose) BIO_printf(bio_err,"bufsize=%d\n",bsize);
}
- strbuf=OPENSSL_malloc(SIZE);
- buff=(unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
+ strbuf=malloc(SIZE);
+ buff=(unsigned char *)malloc(EVP_ENCODE_LENGTH(bsize));
if ((buff == NULL) || (strbuf == NULL))
{
- BIO_printf(bio_err,"OPENSSL_malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize));
+ BIO_printf(bio_err,"malloc failure %ld\n",(long)EVP_ENCODE_LENGTH(bsize));
goto end;
}
}
end:
ERR_print_errors(bio_err);
- if (strbuf != NULL) OPENSSL_free(strbuf);
- if (buff != NULL) OPENSSL_free(buff);
+ if (strbuf != NULL) free(strbuf);
+ if (buff != NULL) free(buff);
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free_all(out);
if (benc != NULL) BIO_free(benc);
#ifdef ZLIB
if (bzl != NULL) BIO_free(bzl);
#endif
- if(pass) OPENSSL_free(pass);
+ if(pass) free(pass);
apps_shutdown();
OPENSSL_EXIT(ret);
}
if (*buf == NULL)
{
*size = step;
- *buf = OPENSSL_malloc(*size);
+ *buf = malloc(*size);
if (*buf == NULL)
return 0;
**buf = '\0';
if (strlen(*buf) + strlen(s) >= (unsigned int)*size)
{
*size += step;
- *buf = OPENSSL_realloc(*buf, *size);
+ *buf = realloc(*buf, *size);
}
if (*buf == NULL)
if((len = ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_LEN_FROM_CMD, num,
NULL, NULL)) <= 0)
goto err;
- if((name = OPENSSL_malloc(len + 1)) == NULL)
+ if((name = malloc(len + 1)) == NULL)
goto err;
if(ENGINE_ctrl(e, ENGINE_CTRL_GET_NAME_FROM_CMD, num, name,
NULL) <= 0)
goto err;
if(len > 0)
{
- if((desc = OPENSSL_malloc(len + 1)) == NULL)
+ if((desc = malloc(len + 1)) == NULL)
goto err;
if(ENGINE_ctrl(e, ENGINE_CTRL_GET_DESC_FROM_CMD, num, desc,
NULL) <= 0)
xpos = 0;
}
}
- OPENSSL_free(name); name = NULL;
- if(desc) { OPENSSL_free(desc); desc = NULL; }
+ free(name); name = NULL;
+ if(desc) { free(desc); desc = NULL; }
/* Move to the next command */
num = ENGINE_ctrl(e, ENGINE_CTRL_GET_NEXT_CMD_TYPE,
num, NULL, NULL);
ret = 1;
err:
if(cmds) sk_OPENSSL_STRING_pop_free(cmds, identity);
- if(name) OPENSSL_free(name);
- if(desc) OPENSSL_free(desc);
+ if(name) free(name);
+ if(desc) free(desc);
return ret;
}
if (cap_buf && (*cap_buf != '\0'))
BIO_printf(bio_out, " [%s]\n", cap_buf);
- OPENSSL_free(cap_buf);
+ free(cap_buf);
}
if(test_avail)
{
if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa);
- if(passout) OPENSSL_free(passout);
+ if(passout) free(passout);
apps_shutdown();
OPENSSL_EXIT(ret);
}
BIO_free_all(out);
BIO_free(in);
if (pass)
- OPENSSL_free(pass);
+ free(pass);
return ret;
}
if (bn) BN_free(bn);
if (rsa) RSA_free(rsa);
if (out) BIO_free_all(out);
- if(passout) OPENSSL_free(passout);
+ if(passout) free(passout);
if (ret != 0)
ERR_print_errors(bio_err);
apps_shutdown();
if (use_ssl != -1)
{
- OPENSSL_free(host);
- OPENSSL_free(port);
- OPENSSL_free(path);
+ free(host);
+ free(port);
+ free(path);
}
OPENSSL_EXIT(ret);
row[DB_serial] = itmp;
BN_free(bn);
rrow=TXT_DB_get_by_index(db->db,DB_serial,row);
- OPENSSL_free(itmp);
+ free(itmp);
return rrow;
}
ret=1;
end:
if (to_free)
- OPENSSL_free(to_free);
+ free(to_free);
if (config != NULL)
{
NCONF_free(config);
config=NULL;
}
if (prog != NULL) lh_FUNCTION_free(prog);
- if (arg.data != NULL) OPENSSL_free(arg.data);
+ if (arg.data != NULL) free(arg.data);
apps_shutdown();
passwd_malloc_size = pw_maxlen + 2;
/* longer than necessary so that we can warn about truncation */
- passwd = passwd_malloc = OPENSSL_malloc(passwd_malloc_size);
+ passwd = passwd_malloc = malloc(passwd_malloc_size);
if (passwd_malloc == NULL)
goto err;
}
err:
ERR_print_errors(bio_err);
if (salt_malloc)
- OPENSSL_free(salt_malloc);
+ free(salt_malloc);
if (passwd_malloc)
- OPENSSL_free(passwd_malloc);
+ free(passwd_malloc);
if (in)
BIO_free(in);
if (out)
{
if (*salt_malloc_p == NULL)
{
- *salt_p = *salt_malloc_p = OPENSSL_malloc(3);
+ *salt_p = *salt_malloc_p = malloc(3);
if (*salt_malloc_p == NULL)
goto err;
}
if (*salt_malloc_p == NULL)
{
- *salt_p = *salt_malloc_p = OPENSSL_malloc(9);
+ *salt_p = *salt_malloc_p = malloc(9);
if (*salt_malloc_p == NULL)
goto err;
}
BIO_free(in);
BIO_free_all(out);
if (canames) sk_OPENSSL_STRING_free(canames);
- if(passin) OPENSSL_free(passin);
- if(passout) OPENSSL_free(passout);
+ if(passin) free(passin);
+ if(passout) free(passout);
apps_shutdown();
OPENSSL_EXIT(ret);
}
value = OPENSSL_uni2asc(av->value.bmpstring->data,
av->value.bmpstring->length);
BIO_printf(out, "%s\n", value);
- OPENSSL_free(value);
+ free(value);
break;
case V_ASN1_OCTET_STRING:
BIO_free_all(out);
BIO_free(in);
if (passin)
- OPENSSL_free(passin);
+ free(passin);
if (passout)
- OPENSSL_free(passout);
+ free(passout);
return ret;
}
BIO_free_all(out);
BIO_free(in);
if (passin)
- OPENSSL_free(passin);
+ free(passin);
if (passout)
- OPENSSL_free(passout);
+ free(passout);
return ret;
}
buf_in, (size_t)buf_inlen);
if (rv > 0)
{
- buf_out = OPENSSL_malloc(buf_outlen);
+ buf_out = malloc(buf_outlen);
if (!buf_out)
rv = -1;
else
BIO_free(in);
BIO_free_all(out);
if (buf_in)
- OPENSSL_free(buf_in);
+ free(buf_in);
if (buf_out)
- OPENSSL_free(buf_out);
+ free(buf_out);
if (sig)
- OPENSSL_free(sig);
+ free(sig);
return ret;
}
end:
if (passin)
- OPENSSL_free(passin);
+ free(passin);
return ctx;
BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL);
s=hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
BIO_printf(bio_out,"%s\n",s);
- OPENSSL_free(s);
+ free(s);
}
else
{
end:
#ifndef MONOLITH
if(to_free)
- OPENSSL_free(to_free);
+ free(to_free);
#endif
if (ex)
{
ENGINE_free(gen_eng);
#endif
if (keyalgstr)
- OPENSSL_free(keyalgstr);
+ free(keyalgstr);
X509_REQ_free(req);
X509_free(x509ss);
ASN1_INTEGER_free(serial);
- if(passargin && passin) OPENSSL_free(passin);
- if(passargout && passout) OPENSSL_free(passout);
+ if(passargin && passin) free(passin);
+ if(passargout && passout) free(passout);
OBJ_cleanup();
apps_shutdown();
OPENSSL_EXIT(ex);
i=1;
size=i2d_RSA_NET(rsa,NULL,NULL, sgckey);
- if ((p=(unsigned char *)OPENSSL_malloc(size)) == NULL)
+ if ((p=(unsigned char *)malloc(size)) == NULL)
{
BIO_printf(bio_err,"Memory allocation failure\n");
goto end;
pp=p;
i2d_RSA_NET(rsa,&p,NULL, sgckey);
BIO_write(out,(char *)pp,size);
- OPENSSL_free(pp);
+ free(pp);
}
#endif
else if (outformat == FORMAT_PEM) {
end:
if(out != NULL) BIO_free_all(out);
if(rsa != NULL) RSA_free(rsa);
- if(passin) OPENSSL_free(passin);
- if(passout) OPENSSL_free(passout);
+ if(passin) free(passin);
+ if(passout) free(passout);
apps_shutdown();
OPENSSL_EXIT(ret);
}
keysize = RSA_size(rsa);
- rsa_in = OPENSSL_malloc(keysize * 2);
- rsa_out = OPENSSL_malloc(keysize);
+ rsa_in = malloc(keysize * 2);
+ rsa_out = malloc(keysize);
/* Read the input data */
rsa_inlen = BIO_read(in, rsa_in, keysize * 2);
RSA_free(rsa);
BIO_free(in);
BIO_free_all(out);
- if(rsa_in) OPENSSL_free(rsa_in);
- if(rsa_out) OPENSSL_free(rsa_out);
- if(passin) OPENSSL_free(passin);
+ if(rsa_in) free(rsa_in);
+ if(rsa_out) free(rsa_out);
+ if(passin) free(passin);
return ret;
}
OPENSSL_assert(0);
break;
}
- buffer = OPENSSL_malloc(length);
+ buffer = malloc(length);
if (buffer == NULL)
{
/* Calculate HMAC of buffer using the secret */
HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
buffer, length, result, &resultlength);
- OPENSSL_free(buffer);
+ free(buffer);
memcpy(cookie, result, resultlength);
*cookie_len = resultlength;
OPENSSL_assert(0);
break;
}
- buffer = OPENSSL_malloc(length);
+ buffer = malloc(length);
if (buffer == NULL)
{
/* Calculate HMAC of buffer using the secret */
HMAC(EVP_sha1(), cookie_secret, COOKIE_SECRET_LENGTH,
buffer, length, result, &resultlength);
- OPENSSL_free(buffer);
+ free(buffer);
if (cookie_len == resultlength && memcmp(result, cookie, resultlength) == 0)
return 1;
static char * ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
{
SRP_ARG *srp_arg = (SRP_ARG *)arg;
- char *pass = (char *)OPENSSL_malloc(PWD_STRLEN+1);
+ char *pass = (char *)malloc(PWD_STRLEN+1);
PW_CB_DATA cb_tmp;
int l;
if ((l = password_callback(pass, PWD_STRLEN, 0, &cb_tmp))<0)
{
BIO_printf (bio_err, "Can't read Password\n");
- OPENSSL_free(pass);
+ free(pass);
return NULL;
}
*(pass+l)= '\0';
if (!load_config(bio_err, NULL))
goto end;
- if ( ((cbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
- ((sbuf=OPENSSL_malloc(BUFSIZZ)) == NULL) ||
- ((mbuf=OPENSSL_malloc(BUFSIZZ + 1)) == NULL)) /* NUL byte */
+ if ( ((cbuf=malloc(BUFSIZZ)) == NULL) ||
+ ((sbuf=malloc(BUFSIZZ)) == NULL) ||
+ ((mbuf=malloc(BUFSIZZ + 1)) == NULL)) /* NUL byte */
{
BIO_printf(bio_err,"out of memory\n");
goto end;
}
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (next_proto.data)
- OPENSSL_free(next_proto.data);
+ free(next_proto.data);
#endif
if (ctx != NULL) SSL_CTX_free(ctx);
if (cert)
if (key)
EVP_PKEY_free(key);
if (pass)
- OPENSSL_free(pass);
+ free(pass);
if (vpm)
X509_VERIFY_PARAM_free(vpm);
- if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); OPENSSL_free(cbuf); }
- if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); OPENSSL_free(sbuf); }
- if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); OPENSSL_free(mbuf); }
+ if (cbuf != NULL) { OPENSSL_cleanse(cbuf,BUFSIZZ); free(cbuf); }
+ if (sbuf != NULL) { OPENSSL_cleanse(sbuf,BUFSIZZ); free(sbuf); }
+ if (mbuf != NULL) { OPENSSL_cleanse(mbuf,BUFSIZZ); free(mbuf); }
if (bio_c_out != NULL)
{
BIO_free(bio_c_out);
BIO_printf(bio, "Keying material exporter:\n");
BIO_printf(bio, " Label: '%s'\n", keymatexportlabel);
BIO_printf(bio, " Length: %i bytes\n", keymatexportlen);
- exportedkeymat = OPENSSL_malloc(keymatexportlen);
+ exportedkeymat = malloc(keymatexportlen);
if (exportedkeymat != NULL)
{
if (!SSL_export_keying_material(s, exportedkeymat,
exportedkeymat[i]);
BIO_printf(bio, "\n");
}
- OPENSSL_free(exportedkeymat);
+ free(exportedkeymat);
}
}
BIO_printf(bio,"---\n");
ERR_print_errors(err);
if (aia)
{
- OPENSSL_free(host);
- OPENSSL_free(path);
- OPENSSL_free(port);
+ free(host);
+ free(path);
+ free(port);
X509_email_free(aia);
}
if (id)
if (s_dkey)
EVP_PKEY_free(s_dkey);
if (pass)
- OPENSSL_free(pass);
+ free(pass);
if (dpass)
- OPENSSL_free(dpass);
+ free(dpass);
if (vpm)
X509_VERIFY_PARAM_free(vpm);
#ifndef OPENSSL_NO_TLSEXT
if (tlscstatp.host)
- OPENSSL_free(tlscstatp.host);
+ free(tlscstatp.host);
if (tlscstatp.port)
- OPENSSL_free(tlscstatp.port);
+ free(tlscstatp.port);
if (tlscstatp.path)
- OPENSSL_free(tlscstatp.path);
+ free(tlscstatp.path);
if (ctx2 != NULL) SSL_CTX_free(ctx2);
if (s_cert2)
X509_free(s_cert2);
struct timeval *timeoutp;
#endif
- if ((buf=OPENSSL_malloc(bufsize)) == NULL)
+ if ((buf=malloc(bufsize)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto err;
if (buf != NULL)
{
OPENSSL_cleanse(buf,bufsize);
- OPENSSL_free(buf);
+ free(buf);
}
if (ret >= 0)
BIO_printf(bio_s_out,"ACCEPT\n");
BIO_printf(bio_s_out, " Label: '%s'\n", keymatexportlabel);
BIO_printf(bio_s_out, " Length: %i bytes\n",
keymatexportlen);
- exportedkeymat = OPENSSL_malloc(keymatexportlen);
+ exportedkeymat = malloc(keymatexportlen);
if (exportedkeymat != NULL)
{
if (!SSL_export_keying_material(con, exportedkeymat,
exportedkeymat[i]);
BIO_printf(bio_s_out, "\n");
}
- OPENSSL_free(exportedkeymat);
+ free(exportedkeymat);
}
}
KSSL_CTX *kctx;
#endif
- buf=OPENSSL_malloc(bufsize);
+ buf=malloc(bufsize);
if (buf == NULL) return(0);
io=BIO_new(BIO_f_buffer());
ssl_bio=BIO_new(BIO_f_ssl());
if (ret >= 0)
BIO_printf(bio_s_out,"ACCEPT\n");
- if (buf != NULL) OPENSSL_free(buf);
+ if (buf != NULL) free(buf);
if (io != NULL) BIO_free_all(io);
/* if (ssl_bio != NULL) BIO_free(ssl_bio);*/
return(ret);
else
sock = accept_socket;
i=(*cb)(name,sock, context);
- if (name != NULL) OPENSSL_free(name);
+ if (name != NULL) free(name);
if (type==SOCK_STREAM) {
shutdown(sock, SHUT_RDWR);
close(sock);
}
else
{
- if ((*host=(char *)OPENSSL_malloc(strlen(h1->h_name)+1)) == NULL)
+ if ((*host=(char *)malloc(strlen(h1->h_name)+1)) == NULL)
{
- perror("OPENSSL_malloc");
+ perror("malloc");
return(0);
}
BUF_strlcpy(*host,h1->h_name,strlen(h1->h_name)+1);
BIO_free(in);
BIO_free(indata);
BIO_free_all(out);
- if (passin) OPENSSL_free(passin);
+ if (passin) free(passin);
return (ret);
}
rsa_key[i]=NULL;
#endif
- if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
+ if ((buf=(unsigned char *)malloc((int)BUFSIZE)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto end;
}
- if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
+ if ((buf2=(unsigned char *)malloc((int)BUFSIZE)) == NULL)
{
BIO_printf(bio_err,"out of memory\n");
goto end;
end:
ERR_print_errors(bio_err);
- if (buf != NULL) OPENSSL_free(buf);
- if (buf2 != NULL) OPENSSL_free(buf2);
+ if (buf != NULL) free(buf);
+ if (buf2 != NULL) free(buf2);
#ifndef OPENSSL_NO_RSA
for (i=0; i<RSA_NUM; i++)
if (rsa_key[i] != NULL)
goto end;
}
BIO_printf(out, "SPKAC=%s\n", spkstr);
- OPENSSL_free(spkstr);
+ free(spkstr);
ret = 0;
goto end;
}
BIO_free(in);
BIO_free_all(out);
EVP_PKEY_free(pkey);
- if(passin) OPENSSL_free(passin);
+ if(passin) free(passin);
apps_shutdown();
OPENSSL_EXIT(ret);
}
char ** irow;
int i;
- if ((irow=(char **)OPENSSL_malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
+ if ((irow=(char **)malloc(sizeof(char *)*(DB_NUMBER+1))) == NULL)
{
BIO_printf(bio_err,"Memory allocation failure\n");
return 0;
{
BIO_printf(bio,"failed to update srpvfile\n");
BIO_printf(bio,"TXT_DB error number %ld\n",db->db->error);
- OPENSSL_free(irow);
+ free(irow);
return 0;
}
return 1;
{
if (strcmp(verifier, srp_verifier))
gNid = NULL;
- OPENSSL_free(verifier);
+ free(verifier);
}
}
return gNid;
size_t len;
len = strlen(s)+sizeof(CONFIG_FILE)+1;
- tofree=OPENSSL_malloc(len);
+ tofree=malloc(len);
BUF_strlcpy(tofree,s,len);
BUF_strlcat(tofree,"/",len);
BUF_strlcat(tofree,CONFIG_FILE,len);
}
if(tofree)
{
- OPENSSL_free(tofree);
+ free(tofree);
tofree = NULL;
}
(userinfo && (!(row[DB_srpinfo] = BUF_strdup(userinfo)))) ||
!update_index(db, bio_err, row))
{
- if (row[DB_srpid]) OPENSSL_free(row[DB_srpid]);
- if (row[DB_srpgN]) OPENSSL_free(row[DB_srpgN]);
- if (row[DB_srpinfo]) OPENSSL_free(row[DB_srpinfo]);
- if (row[DB_srptype]) OPENSSL_free(row[DB_srptype]);
- if (row[DB_srpverifier]) OPENSSL_free(row[DB_srpverifier]);
- if (row[DB_srpsalt]) OPENSSL_free(row[DB_srpsalt]);
+ if (row[DB_srpid]) free(row[DB_srpid]);
+ if (row[DB_srpgN]) free(row[DB_srpgN]);
+ if (row[DB_srpinfo]) free(row[DB_srpinfo]);
+ if (row[DB_srptype]) free(row[DB_srptype]);
+ if (row[DB_srpverifier]) free(row[DB_srpverifier]);
+ if (row[DB_srpsalt]) free(row[DB_srpsalt]);
goto err;
}
doupdatedb = 1;
VERBOSE BIO_printf(bio_err,"SRP terminating with code %d.\n",ret);
if(tofree)
- OPENSSL_free(tofree);
+ free(tofree);
if (ret) ERR_print_errors(bio_err);
if (randfile) app_RAND_write_file(randfile, bio_err);
if (conf) NCONF_free(conf);
/* Clean up. */
app_RAND_write_file(NULL, bio_err);
NCONF_free(conf);
- OPENSSL_free(password);
+ free(password);
OBJ_cleanup();
if (free_bio_err)
{
}
TS_MSG_IMPRINT_free(msg_imprint);
X509_ALGOR_free(algo);
- OPENSSL_free(data);
+ free(data);
ASN1_OBJECT_free(policy_obj);
ASN1_INTEGER_free(nonce_asn1);
return ts_req;
unsigned char buffer[4096];
int length;
- *md_value = OPENSSL_malloc(md_value_len);
+ *md_value = malloc(md_value_len);
if (*md_value == 0) goto err;
EVP_DigestInit(&md_ctx, md);
*md_value = string_to_hex(digest, &digest_len);
if (!*md_value || md_value_len != digest_len)
{
- OPENSSL_free(*md_value);
+ free(*md_value);
*md_value = NULL;
BIO_printf(bio_err, "bad digest, %d bytes "
"must be specified\n", md_value_len);
/* Find the first non-zero byte and creating ASN1_INTEGER object. */
for (i = 0; i < len && !buf[i]; ++i);
if (!(nonce = ASN1_INTEGER_new())) goto err;
- OPENSSL_free(nonce->data);
+ free(nonce->data);
/* Allocate at least one byte. */
nonce->length = len - i;
- if (!(nonce->data = OPENSSL_malloc(nonce->length + 1))) goto err;
+ if (!(nonce->data = malloc(nonce->length + 1))) goto err;
memcpy(nonce->data, buf + i, nonce->length);
return nonce;
BIO_printf(STDout,"/* issuer :%s */\n",buf);
z=i2d_X509(x,NULL);
- m=OPENSSL_malloc(z);
+ m=malloc(z);
d=(unsigned char *)m;
z=i2d_X509_NAME(X509_get_subject_name(x),&d);
if (y%16 != 0) BIO_printf(STDout,"\n");
BIO_printf(STDout,"};\n");
- OPENSSL_free(m);
+ free(m);
}
else if (text == i)
{
ASN1_INTEGER_free(sno);
sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free);
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
- if (passin) OPENSSL_free(passin);
+ if (passin) free(passin);
apps_shutdown();
OPENSSL_EXIT(ret);
}
len = ((serialfile == NULL)
?(strlen(CAfile)+strlen(POSTFIX)+1)
:(strlen(serialfile)))+1;
- buf=OPENSSL_malloc(len);
+ buf=malloc(len);
if (buf == NULL) { BIO_printf(bio_err,"out of mem\n"); goto end; }
if (serialfile == NULL)
{
if (!save_serial(buf, NULL, serial, &bs)) goto end;
end:
- if (buf) OPENSSL_free(buf);
+ if (buf) free(buf);
BN_free(serial);
return bs;
}
unsigned char *otmp = NULL, *ptmp = NULL;
int r, ret = 0;
AES_KEY wctx;
- otmp = OPENSSL_malloc(keylen + 8);
- ptmp = OPENSSL_malloc(keylen);
+ otmp = malloc(keylen + 8);
+ ptmp = malloc(keylen);
if (!otmp || !ptmp)
return 0;
if (AES_set_encrypt_key(kek, keybits, &wctx))
err:
if (otmp)
- OPENSSL_free(otmp);
+ free(otmp);
if (ptmp)
- OPENSSL_free(ptmp);
+ free(ptmp);
return ret;
}
if (len-- > 1) /* using one because of the bits left byte */
{
- s=(unsigned char *)OPENSSL_malloc((int)len);
+ s=(unsigned char *)malloc((int)len);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
s=NULL;
ret->length=(int)len;
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->data=s;
ret->type=V_ASN1_BIT_STRING;
if (a != NULL) (*a)=ret;
{
if (!value) return(1); /* Don't need to set */
if (a->data == NULL)
- c=(unsigned char *)OPENSSL_malloc(w+1);
+ c=(unsigned char *)malloc(w+1);
else
c=(unsigned char *)OPENSSL_realloc_clean(a->data,
a->length,
if (len != 0)
{
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=(unsigned char *)malloc((int)len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
else
s=NULL;
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->length=(int)len;
ret->data=s;
ret->type=tag;
{
if ((ret->length < len) || (ret->data == NULL))
{
- if (ret->data != NULL) OPENSSL_free(ret->data);
- s=(unsigned char *)OPENSSL_malloc((int)len + 1);
+ if (ret->data != NULL) free(ret->data);
+ s=(unsigned char *)malloc((int)len + 1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
else
{
s=NULL;
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
}
ret->length=(int)len;
if (!asn1_const_Finish(c)) goto err;
a->length=num;
- if (a->data != NULL) OPENSSL_free(a->data);
+ if (a->data != NULL) free(a->data);
a->data=(unsigned char *)b.data;
if (os != NULL) ASN1_STRING_free(os);
return(1);
err:
ASN1err(ASN1_F_ASN1_COLLATE_PRIMITIVE,c->error);
if (os != NULL) ASN1_STRING_free(os);
- if (b.data != NULL) OPENSSL_free(b.data);
+ if (b.data != NULL) free(b.data);
return(0);
}
if (!EVP_Digest(str, i, md, len, type, NULL))
return 0;
- OPENSSL_free(str);
+ free(str);
return(1);
}
if (x == NULL) return(NULL);
i=i2d(x,NULL);
- b=OPENSSL_malloc(i+10);
+ b=malloc(i+10);
if (b == NULL)
{ ASN1err(ASN1_F_ASN1_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
p= b;
i=i2d(x,&p);
p2= b;
ret=d2i(NULL,&p2,i);
- OPENSSL_free(b);
+ free(b);
return(ret);
}
{ ASN1err(ASN1_F_ASN1_ITEM_DUP,ERR_R_MALLOC_FAILURE); return(NULL); }
p= b;
ret=ASN1_item_d2i(NULL,&p,i, it);
- OPENSSL_free(b);
+ free(b);
return(ret);
}
if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
- OPENSSL_free(a->data);
- if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL)
+ free(a->data);
+ if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL)
memset((char *)a->data,0,sizeof(long)+1);
}
if (a->data == NULL)
len=((j == 0)?0:((j/8)+1));
if (ret->length < len+4)
{
- unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
+ unsigned char *new_data=realloc(ret->data, len+4);
if (!new_data)
{
ASN1err(ASN1_F_BN_TO_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
- p=OPENSSL_malloc(len);
+ p=malloc(len);
if (p == NULL)
{
ASN1err(ASN1_F_ASN1_GENERALIZEDTIME_ADJ,
return(NULL);
}
if (s->data != NULL)
- OPENSSL_free(s->data);
+ free(s->data);
s->data=(unsigned char *)p;
}
int i,j=0,n,ret=1;
n=i2d(x,NULL);
- b=(char *)OPENSSL_malloc(n);
+ b=(char *)malloc(n);
if (b == NULL)
{
ASN1err(ASN1_F_ASN1_I2D_BIO,ERR_R_MALLOC_FAILURE);
j+=i;
n-=i;
}
- OPENSSL_free(b);
+ free(b);
return(ret);
}
j+=i;
n-=i;
}
- OPENSSL_free(b);
+ free(b);
return(ret);
}
p= *pp;
pend = p + len;
- /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
+ /* We must malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=(unsigned char *)malloc((int)len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
memcpy(s,p,(int)len);
}
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
goto err;
}
- /* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it
+ /* We must malloc stuff, even for 0 bytes otherwise it
* signifies a missing NULL parameter. */
- s=(unsigned char *)OPENSSL_malloc((int)len+1);
+ s=(unsigned char *)malloc((int)len+1);
if (s == NULL)
{
i=ERR_R_MALLOC_FAILURE;
p+=len;
}
- if (ret->data != NULL) OPENSSL_free(ret->data);
+ if (ret->data != NULL) free(ret->data);
ret->data=s;
ret->length=(int)len;
if (a != NULL) (*a)=ret;
if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
- OPENSSL_free(a->data);
- if ((a->data=(unsigned char *)OPENSSL_malloc(sizeof(long)+1)) != NULL)
+ free(a->data);
+ if ((a->data=(unsigned char *)malloc(sizeof(long)+1)) != NULL)
memset((char *)a->data,0,sizeof(long)+1);
}
if (a->data == NULL)
len=((j == 0)?0:((j/8)+1));
if (ret->length < len+4)
{
- unsigned char *new_data=OPENSSL_realloc(ret->data, len+4);
+ unsigned char *new_data=realloc(ret->data, len+4);
if (!new_data)
{
ASN1err(ASN1_F_BN_TO_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
dest = *out;
if(dest->data) {
dest->length = 0;
- OPENSSL_free(dest->data);
+ free(dest->data);
dest->data = NULL;
}
dest->type = str_type;
cpyfunc = cpy_utf8;
break;
}
- if(!(p = OPENSSL_malloc(outlen + 1))) {
+ if(!(p = malloc(outlen + 1))) {
if(free_out) ASN1_STRING_free(dest);
ASN1err(ASN1_F_ASN1_MBSTRING_NCOPY,ERR_R_MALLOC_FAILURE);
return -1;
if (blsize > tmpsize)
{
if (tmp != ftmp)
- OPENSSL_free(tmp);
+ free(tmp);
tmpsize = blsize + 32;
- tmp = OPENSSL_malloc(tmpsize);
+ tmp = malloc(tmpsize);
if (!tmp)
goto err;
}
len+=i;
}
if (tmp != ftmp)
- OPENSSL_free(tmp);
+ free(tmp);
if (bl)
BN_free(bl);
return(len);
err:
if (tmp != ftmp)
- OPENSSL_free(tmp);
+ free(tmp);
if (bl)
BN_free(bl);
return(0);
i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
if (i > (int)(sizeof(buf) - 1))
{
- p = OPENSSL_malloc(i + 1);
+ p = malloc(i + 1);
if (!p)
return -1;
i2t_ASN1_OBJECT(p,i + 1,a);
return BIO_write(bp, "<INVALID>", 9);
BIO_write(bp,p,i);
if (p != buf)
- OPENSSL_free(p);
+ free(p);
return(i);
}
if ((data == NULL) || (ret->length < len))
{
ret->length=0;
- if (data != NULL) OPENSSL_free(data);
- data=(unsigned char *)OPENSSL_malloc(len ? (int)len : 1);
+ if (data != NULL) free(data);
+ data=(unsigned char *)malloc(len ? (int)len : 1);
if (data == NULL)
{ i=ERR_R_MALLOC_FAILURE; goto err; }
ret->flags|=ASN1_OBJECT_FLAG_DYNAMIC_DATA;
{
ASN1_OBJECT *ret;
- ret=(ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT));
+ ret=(ASN1_OBJECT *)malloc(sizeof(ASN1_OBJECT));
if (ret == NULL)
{
ASN1err(ASN1_F_ASN1_OBJECT_NEW,ERR_R_MALLOC_FAILURE);
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_STRINGS)
{
#ifndef CONST_STRICT /* disable purely for compile-time strict const checking. Doing this on a "real" compile will cause memory leaks */
- if (a->sn != NULL) OPENSSL_free((void *)a->sn);
- if (a->ln != NULL) OPENSSL_free((void *)a->ln);
+ if (a->sn != NULL) free((void *)a->sn);
+ if (a->ln != NULL) free((void *)a->ln);
#endif
a->sn=a->ln=NULL;
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC_DATA)
{
- if (a->data != NULL) OPENSSL_free((void *)a->data);
+ if (a->data != NULL) free((void *)a->data);
a->data=NULL;
a->length=0;
}
if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
- OPENSSL_free(a);
+ free(a);
}
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
inl=ASN1_item_i2d(asn,&buf_in, it);
outll=outl=EVP_PKEY_size(pkey);
- buf_out=OPENSSL_malloc((unsigned int)outl);
+ buf_out=malloc((unsigned int)outl);
if ((buf_in == NULL) || (buf_out == NULL))
{
outl=0;
ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX,ERR_R_EVP_LIB);
goto err;
}
- if (signature->data != NULL) OPENSSL_free(signature->data);
+ if (signature->data != NULL) free(signature->data);
signature->data=buf_out;
buf_out=NULL;
signature->length=outl;
err:
EVP_MD_CTX_cleanup(ctx);
if (buf_in != NULL)
- { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); OPENSSL_free(buf_in); }
+ { OPENSSL_cleanse((char *)buf_in,(unsigned int)inl); free(buf_in); }
if (buf_out != NULL)
- { OPENSSL_cleanse((char *)buf_out,outll); OPENSSL_free(buf_out); }
+ { OPENSSL_cleanse((char *)buf_out,outll); free(buf_out); }
return(outl);
}
t.type = str->type;
t.value.ptr = (char *)str;
der_len = i2d_ASN1_TYPE(&t, NULL);
- der_buf = OPENSSL_malloc(der_len);
+ der_buf = malloc(der_len);
if(!der_buf) return -1;
p = der_buf;
i2d_ASN1_TYPE(&t, &p);
outlen = do_hex_dump(io_ch, arg, der_buf, der_len);
- OPENSSL_free(der_buf);
+ free(der_buf);
if(outlen < 0) return -1;
return outlen + 1;
}
return 0;
}
if(!(tmp = ASN1_STRING_TABLE_get(nid))) {
- tmp = OPENSSL_malloc(sizeof(ASN1_STRING_TABLE));
+ tmp = malloc(sizeof(ASN1_STRING_TABLE));
if(!tmp) {
ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD,
ERR_R_MALLOC_FAILURE);
static void st_free(ASN1_STRING_TABLE *tbl)
{
- if(tbl->flags & STABLE_FLAGS_MALLOC) OPENSSL_free(tbl);
+ if(tbl->flags & STABLE_FLAGS_MALLOC) free(tbl);
}
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
- p=OPENSSL_malloc(len);
+ p=malloc(len);
if (p == NULL)
{
ASN1err(ASN1_F_ASN1_UTCTIME_ADJ,ERR_R_MALLOC_FAILURE);
return(NULL);
}
if (s->data != NULL)
- OPENSSL_free(s->data);
+ free(s->data);
s->data=(unsigned char *)p;
}
}
OPENSSL_cleanse(buf_in,(unsigned int)inl);
- OPENSSL_free(buf_in);
+ free(buf_in);
if (EVP_DigestVerifyFinal(&ctx,signature->data,
(size_t)signature->length) <= 0)
const char *pem_str, const char *info)
{
EVP_PKEY_ASN1_METHOD *ameth;
- ameth = OPENSSL_malloc(sizeof(EVP_PKEY_ASN1_METHOD));
+ ameth = malloc(sizeof(EVP_PKEY_ASN1_METHOD));
if (!ameth)
return NULL;
if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC))
{
if (ameth->pem_str)
- OPENSSL_free(ameth->pem_str);
+ free(ameth->pem_str);
if (ameth->info)
- OPENSSL_free(ameth->info);
- OPENSSL_free(ameth);
+ free(ameth->info);
+ free(ameth);
}
}
/* Allocate buffer for new encoding */
- new_der = OPENSSL_malloc(len);
+ new_der = malloc(len);
if (!new_der)
goto err;
err:
if (orig_der)
- OPENSSL_free(orig_der);
+ free(orig_der);
if (new_der)
- OPENSSL_free(new_der);
+ free(new_der);
return ret;
bad:
if (der)
- OPENSSL_free(der);
+ free(der);
if (sk)
sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free);
{
c=str->data;
if (c == NULL)
- str->data=OPENSSL_malloc(len+1);
+ str->data=malloc(len+1);
else
- str->data=OPENSSL_realloc(c,len+1);
+ str->data=realloc(c,len+1);
if (str->data == NULL)
{
void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
{
if (str->data)
- OPENSSL_free(str->data);
+ free(str->data);
str->data = data;
str->length = len;
}
{
ASN1_STRING *ret;
- ret=(ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING));
+ ret=(ASN1_STRING *)malloc(sizeof(ASN1_STRING));
if (ret == NULL)
{
ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE);
{
if (a == NULL) return;
if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
- OPENSSL_free(a->data);
- OPENSSL_free(a);
+ free(a->data);
+ free(a);
}
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
/* New macros */
#define M_ASN1_New_Malloc(ret,type) \
- if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
+ if ((ret=(type *)malloc(sizeof(type))) == NULL) \
{ c.line=__LINE__; goto err2; }
#define M_ASN1_New(arg,func) \
if (rv > 0)
{
BIO_puts(out, micstr);
- OPENSSL_free(micstr);
+ free(micstr);
continue;
}
if (rv != -2)
}
}
} else tmpval = NULL;
- mhdr = (MIME_HEADER *) OPENSSL_malloc(sizeof(MIME_HEADER));
+ mhdr = (MIME_HEADER *) malloc(sizeof(MIME_HEADER));
if(!mhdr) return NULL;
mhdr->name = tmpname;
mhdr->value = tmpval;
if(!tmpval) return 0;
} else tmpval = NULL;
/* Parameter values are case sensitive so leave as is */
- mparam = (MIME_PARAM *) OPENSSL_malloc(sizeof(MIME_PARAM));
+ mparam = (MIME_PARAM *) malloc(sizeof(MIME_PARAM));
if(!mparam) return 0;
mparam->param_name = tmpname;
mparam->param_value = tmpval;
static void mime_hdr_free(MIME_HEADER *hdr)
{
- if(hdr->name) OPENSSL_free(hdr->name);
- if(hdr->value) OPENSSL_free(hdr->value);
+ if(hdr->name) free(hdr->name);
+ if(hdr->value) free(hdr->value);
if(hdr->params) sk_MIME_PARAM_pop_free(hdr->params, mime_param_free);
- OPENSSL_free(hdr);
+ free(hdr);
}
static void mime_param_free(MIME_PARAM *param)
{
- if(param->param_name) OPENSSL_free(param->param_name);
- if(param->param_value) OPENSSL_free(param->param_value);
- OPENSSL_free(param);
+ if(param->param_name) free(param->param_name);
+ if(param->param_value) free(param->param_value);
+ free(param);
}
/* Check for a multipart boundary. Returns:
p--;
}
p++;
- lntmp = OPENSSL_malloc((p - ln) + 1);
+ lntmp = malloc((p - ln) + 1);
if (lntmp == NULL)
return 0;
memcpy(lntmp, ln, p - ln);
} else octmp = *oct;
if(octmp->data) {
- OPENSSL_free(octmp->data);
+ free(octmp->data);
octmp->data = NULL;
}
static int asn1_bio_new(BIO *b)
{
BIO_ASN1_BUF_CTX *ctx;
- ctx = OPENSSL_malloc(sizeof(BIO_ASN1_BUF_CTX));
+ ctx = malloc(sizeof(BIO_ASN1_BUF_CTX));
if (!ctx)
return 0;
if (!asn1_bio_init(ctx, DEFAULT_ASN1_BUF_SIZE))
static int asn1_bio_init(BIO_ASN1_BUF_CTX *ctx, int size)
{
- ctx->buf = OPENSSL_malloc(size);
+ ctx->buf = malloc(size);
if (!ctx->buf)
return 0;
ctx->bufsize = size;
if (ctx == NULL)
return 0;
if (ctx->buf)
- OPENSSL_free(ctx->buf);
- OPENSSL_free(ctx);
+ free(ctx->buf);
+ free(ctx);
b->init = 0;
b->ptr = NULL;
b->flags = 0;
ASN1err(ASN1_F_BIO_NEW_NDEF, ASN1_R_STREAMING_NOT_SUPPORTED);
return NULL;
}
- ndef_aux = OPENSSL_malloc(sizeof(NDEF_SUPPORT));
+ ndef_aux = malloc(sizeof(NDEF_SUPPORT));
asn_bio = BIO_new(BIO_f_asn1());
/* ASN1 bio needs to be next to output BIO */
if (asn_bio)
BIO_free(asn_bio);
if (ndef_aux)
- OPENSSL_free(ndef_aux);
+ free(ndef_aux);
return NULL;
}
ndef_aux = *(NDEF_SUPPORT **)parg;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
- p = OPENSSL_malloc(derlen);
+ p = malloc(derlen);
ndef_aux->derbuf = p;
*pbuf = p;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
ndef_aux = *(NDEF_SUPPORT **)parg;
if (ndef_aux->derbuf)
- OPENSSL_free(ndef_aux->derbuf);
+ free(ndef_aux->derbuf);
ndef_aux->derbuf = NULL;
*pbuf = NULL;
NDEF_SUPPORT **pndef_aux = (NDEF_SUPPORT **)parg;
if (!ndef_prefix_free(b, pbuf, plen, parg))
return 0;
- OPENSSL_free(*pndef_aux);
+ free(*pndef_aux);
*pndef_aux = NULL;
return 1;
}
return 0;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, NULL, ndef_aux->it);
- p = OPENSSL_malloc(derlen);
+ p = malloc(derlen);
ndef_aux->derbuf = p;
*pbuf = p;
derlen = ASN1_item_ndef_i2d(ndef_aux->val, &p, ndef_aux->it);
if (num+i > slen)
{
if (s == NULL)
- sp=(unsigned char *)OPENSSL_malloc(
+ sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
- sp=(unsigned char *)OPENSSL_realloc(s,
+ sp=(unsigned char *)realloc(s,
(unsigned int)num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED,ERR_R_MALLOC_FAILURE);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
goto err;
}
s=sp;
if (num+i > slen)
{
if (s == NULL)
- sp=(unsigned char *)OPENSSL_malloc(
+ sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
sp=OPENSSL_realloc_clean(s,slen,num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_INTEGER,ERR_R_MALLOC_FAILURE);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
goto err;
}
s=sp;
if (num+i > slen)
{
if (s == NULL)
- sp=(unsigned char *)OPENSSL_malloc(
+ sp=(unsigned char *)malloc(
(unsigned int)num+i*2);
else
- sp=(unsigned char *)OPENSSL_realloc(s,
+ sp=(unsigned char *)realloc(s,
(unsigned int)num+i*2);
if (sp == NULL)
{
ASN1err(ASN1_F_A2I_ASN1_STRING,ERR_R_MALLOC_FAILURE);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
goto err;
}
s=sp;
/* Since its RC4 encrypted length is actual length */
- if ((zz=(unsigned char *)OPENSSL_malloc(rsalen)) == NULL)
+ if ((zz=(unsigned char *)malloc(rsalen)) == NULL)
{
ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE);
goto err;
/* Write out private key encoding */
i2d_RSAPrivateKey(a,&zz);
- if ((zz=OPENSSL_malloc(pkeylen)) == NULL)
+ if ((zz=malloc(pkeylen)) == NULL)
{
ASN1err(ASN1_F_I2D_RSA_NET,ERR_R_MALLOC_FAILURE);
goto err;
if (!saltlen)
saltlen = PKCS5_SALT_LEN;
- if (!(osalt->data = OPENSSL_malloc (saltlen)))
+ if (!(osalt->data = malloc (saltlen)))
goto merr;
osalt->length = saltlen;
X509_signature_print(out, x->sig_alg, NULL);
p=X509_NAME_oneline(X509_CRL_get_issuer(x),NULL,0);
BIO_printf(out,"%8sIssuer: %s\n","",p);
- OPENSSL_free(p);
+ free(p);
BIO_printf(out,"%8sLast Update: ","");
ASN1_TIME_print(out,X509_CRL_get_lastUpdate(x));
BIO_printf(out,"\n%8sNext Update: ","");
}
ret=1;
err:
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
if (BIO_printf(bp," Subject OCSP hash: ") <= 0)
goto err;
derlen = i2d_X509_NAME(x->cert_info->subject, NULL);
- if ((der = dertmp = (unsigned char *)OPENSSL_malloc (derlen)) == NULL)
+ if ((der = dertmp = (unsigned char *)malloc (derlen)) == NULL)
goto err;
i2d_X509_NAME(x->cert_info->subject, &dertmp);
{
if (BIO_printf(bp,"%02X",SHA1md[i]) <= 0) goto err;
}
- OPENSSL_free (der);
+ free (der);
der=NULL;
/* display the hash of the public key as it would appear
return (1);
err:
- if (der != NULL) OPENSSL_free(der);
+ if (der != NULL) free(der);
return(0);
}
b=X509_NAME_oneline(name,NULL,0);
if (!*b)
{
- OPENSSL_free(b);
+ free(b);
return 1;
}
s=b+1; /* skip the first slash */
err:
X509err(X509_F_X509_NAME_PRINT,ERR_R_BUF_LIB);
}
- OPENSSL_free(b);
+ free(b);
return(ret);
}
*in = p;
ret = 1;
err:
- if (free_cont && buf.data) OPENSSL_free(buf.data);
+ if (free_cont && buf.data) free(buf.data);
return ret;
}
if (*free_cont)
{
if (stmp->data)
- OPENSSL_free(stmp->data);
+ free(stmp->data);
stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */
stmp->length = len;
*free_cont = 0;
len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);
if (len <= 0)
return len;
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (!buf)
return -1;
p = buf;
do_sort = 0;
else
{
- derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk)
+ derlst = malloc(sk_ASN1_VALUE_num(sk)
* sizeof(*derlst));
- tmpdat = OPENSSL_malloc(skcontlen);
+ tmpdat = malloc(skcontlen);
if (!derlst || !tmpdat)
return 0;
}
i++, tder++)
(void)sk_ASN1_VALUE_set(sk, i, tder->field);
}
- OPENSSL_free(derlst);
- OPENSSL_free(tmpdat);
+ free(derlst);
+ free(tmpdat);
return 1;
}
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
if (!combine)
{
- OPENSSL_free(*pval);
+ free(*pval);
*pval = NULL;
}
break;
asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
if (!combine)
{
- OPENSSL_free(*pval);
+ free(*pval);
*pval = NULL;
}
break;
case V_ASN1_ANY:
ASN1_primitive_free(pval, NULL);
- OPENSSL_free(*pval);
+ free(*pval);
break;
default:
}
if (!combine)
{
- *pval = OPENSSL_malloc(it->size);
+ *pval = malloc(it->size);
if (!*pval)
goto memerr;
memset(*pval, 0, it->size);
}
if (!combine)
{
- *pval = OPENSSL_malloc(it->size);
+ *pval = malloc(it->size);
if (!*pval)
goto memerr;
memset(*pval, 0, it->size);
return 1;
case V_ASN1_ANY:
- typ = OPENSSL_malloc(sizeof(ASN1_TYPE));
+ typ = malloc(sizeof(ASN1_TYPE));
if (!typ)
return 0;
typ->value.ptr = NULL;
ASN1_PCTX *ASN1_PCTX_new(void)
{
ASN1_PCTX *ret;
- ret = OPENSSL_malloc(sizeof(ASN1_PCTX));
+ ret = malloc(sizeof(ASN1_PCTX));
if (ret == NULL)
{
ASN1err(ASN1_F_ASN1_PCTX_NEW, ERR_R_MALLOC_FAILURE);
void ASN1_PCTX_free(ASN1_PCTX *p)
{
- OPENSSL_free(p);
+ free(p);
}
unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p)
s = i2s_ASN1_INTEGER(NULL, str);
if (BIO_puts(out, s) <= 0)
ret = 0;
- OPENSSL_free(s);
+ free(s);
return ret;
}
if (enc)
{
if (enc->enc)
- OPENSSL_free(enc->enc);
+ free(enc->enc);
enc->enc = NULL;
enc->len = 0;
enc->modified = 1;
return 1;
if (enc->enc)
- OPENSSL_free(enc->enc);
- enc->enc = OPENSSL_malloc(inlen);
+ free(enc->enc);
+ enc->enc = malloc(inlen);
if (!enc->enc)
return 0;
memcpy(enc->enc, in, inlen);
int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk))
{
X509_CRL_METHOD *m;
- m = OPENSSL_malloc(sizeof(X509_CRL_METHOD));
+ m = malloc(sizeof(X509_CRL_METHOD));
if (!m)
return NULL;
m->crl_init = crl_init;
{
if (!(m->flags & X509_CRL_METHOD_DYNAMIC))
return;
- OPENSSL_free(m);
+ free(m);
}
void X509_CRL_set_meth_data(X509_CRL *crl, void *dat)
{
X509_INFO *ret=NULL;
- ret=(X509_INFO *)OPENSSL_malloc(sizeof(X509_INFO));
+ ret=(X509_INFO *)malloc(sizeof(X509_INFO));
if (ret == NULL)
{
ASN1err(ASN1_F_X509_INFO_NEW,ERR_R_MALLOC_FAILURE);
if (x->x509 != NULL) X509_free(x->x509);
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) OPENSSL_free(x->enc_data);
- OPENSSL_free(x);
+ if (x->enc_data != NULL) free(x->enc_data);
+ free(x);
}
IMPLEMENT_STACK_OF(X509_INFO)
static int x509_name_ex_new(ASN1_VALUE **val, const ASN1_ITEM *it)
{
X509_NAME *ret = NULL;
- ret = OPENSSL_malloc(sizeof(X509_NAME));
+ ret = malloc(sizeof(X509_NAME));
if(!ret) goto memerr;
if ((ret->entries=sk_X509_NAME_ENTRY_new_null()) == NULL)
goto memerr;
{
if (ret->entries)
sk_X509_NAME_ENTRY_free(ret->entries);
- OPENSSL_free(ret);
+ free(ret);
}
return 0;
}
BUF_MEM_free(a->bytes);
sk_X509_NAME_ENTRY_pop_free(a->entries,X509_NAME_ENTRY_free);
if (a->canon_enc)
- OPENSSL_free(a->canon_enc);
- OPENSSL_free(a);
+ free(a->canon_enc);
+ free(a);
*pval = NULL;
}
if (a->canon_enc)
{
- OPENSSL_free(a->canon_enc);
+ free(a->canon_enc);
a->canon_enc = NULL;
}
/* Special case: empty X509_NAME => null encoding */
a->canon_enclen = i2d_name_canon(intname, NULL);
- p = OPENSSL_malloc(a->canon_enclen);
+ p = malloc(a->canon_enclen);
if (!p)
goto err;
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)) OPENSSL_free(x->key_data);
- OPENSSL_free(x);
+ if ((x->key_data != NULL) && (x->key_free)) free(x->key_data);
+ free(x);
}
if (penc)
{
if (pub->public_key->data)
- OPENSSL_free(pub->public_key->data);
+ free(pub->public_key->data);
pub->public_key->data = penc;
pub->public_key->length = penclen;
/* Set number of unused bits to zero */
break;
case ASN1_OP_D2I_POST:
- if (ret->name != NULL) OPENSSL_free(ret->name);
+ if (ret->name != NULL) free(ret->name);
ret->name=X509_NAME_oneline(ret->cert_info->subject,NULL,0);
break;
ASIdentifiers_free(ret->rfc3779_asid);
#endif
- if (ret->name != NULL) OPENSSL_free(ret->name);
+ if (ret->name != NULL) free(ret->name);
break;
}
if (*buffer == NULL) {
if (*maxlen == 0)
*maxlen = 1024;
- *buffer = OPENSSL_malloc(*maxlen);
+ *buffer = malloc(*maxlen);
if (*currlen > 0) {
assert(*sbuffer != NULL);
memcpy(*buffer, *sbuffer, *currlen);
*sbuffer = NULL;
} else {
*maxlen += 1024;
- *buffer = OPENSSL_realloc(*buffer, *maxlen);
+ *buffer = realloc(*buffer, *maxlen);
}
}
/* What to do if *buffer is NULL? */
format, args);
if (dynbuf) {
ret = BIO_write(bio, dynbuf, (int)retlen);
- OPENSSL_free(dynbuf);
+ free(dynbuf);
} else {
ret = BIO_write(bio, hugebuf, (int)retlen);
}
ret = 1;
err:
if (str != NULL)
- OPENSSL_free(str);
+ free(str);
if ((ret == 0) && (s != -1)) {
close(s);
s = -1;
p = *addr;
if (p) {
*p = '\0';
- p = OPENSSL_realloc(p, nl);
+ p = realloc(p, nl);
} else {
- p = OPENSSL_malloc(nl);
+ p = malloc(nl);
}
if (p == NULL) {
BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
l = ntohl(sa.from.sa_in.sin_addr.s_addr);
port = ntohs(sa.from.sa_in.sin_port);
if (*addr == NULL) {
- if ((p = OPENSSL_malloc(24)) == NULL) {
+ if ((p = malloc(24)) == NULL) {
BIOerr(BIO_F_BIO_ACCEPT, ERR_R_MALLOC_FAILURE);
goto end;
}
{
BIO_F_BUFFER_CTX *ctx;
- ctx = (BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX));
+ ctx = (BIO_F_BUFFER_CTX *)malloc(sizeof(BIO_F_BUFFER_CTX));
if (ctx == NULL)
return (0);
- ctx->ibuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+ ctx->ibuf = (char *)malloc(DEFAULT_BUFFER_SIZE);
if (ctx->ibuf == NULL) {
- OPENSSL_free(ctx);
+ free(ctx);
return (0);
}
- ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+ ctx->obuf = (char *)malloc(DEFAULT_BUFFER_SIZE);
if (ctx->obuf == NULL) {
- OPENSSL_free(ctx->ibuf);
- OPENSSL_free(ctx);
+ free(ctx->ibuf);
+ free(ctx);
return (0);
}
ctx->ibuf_size = DEFAULT_BUFFER_SIZE;
return (0);
b = (BIO_F_BUFFER_CTX *)a->ptr;
if (b->ibuf != NULL)
- OPENSSL_free(b->ibuf);
+ free(b->ibuf);
if (b->obuf != NULL)
- OPENSSL_free(b->obuf);
- OPENSSL_free(a->ptr);
+ free(b->obuf);
+ free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
break;
case BIO_C_SET_BUFF_READ_DATA:
if (num > ctx->ibuf_size) {
- p1 = OPENSSL_malloc((int)num);
+ p1 = malloc((int)num);
if (p1 == NULL)
goto malloc_error;
if (ctx->ibuf != NULL)
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
ctx->ibuf = p1;
}
ctx->ibuf_off = 0;
p1 = ctx->ibuf;
p2 = ctx->obuf;
if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) {
- p1 = (char *)OPENSSL_malloc((int)num);
+ p1 = (char *)malloc((int)num);
if (p1 == NULL)
goto malloc_error;
}
if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) {
- p2 = (char *)OPENSSL_malloc((int)num);
+ p2 = (char *)malloc((int)num);
if (p2 == NULL) {
if (p1 != ctx->ibuf)
- OPENSSL_free(p1);
+ free(p1);
goto malloc_error;
}
}
if (ctx->ibuf != p1) {
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
ctx->ibuf = p1;
ctx->ibuf_off = 0;
ctx->ibuf_len = 0;
ctx->ibuf_size = ibs;
}
if (ctx->obuf != p2) {
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
ctx->obuf = p2;
ctx->obuf_off = 0;
ctx->obuf_len = 0;
{
BIO_LINEBUFFER_CTX *ctx;
- ctx = (BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX));
+ ctx = (BIO_LINEBUFFER_CTX *)malloc(sizeof(BIO_LINEBUFFER_CTX));
if (ctx == NULL)
return (0);
- ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
+ ctx->obuf = (char *)malloc(DEFAULT_LINEBUFFER_SIZE);
if (ctx->obuf == NULL) {
- OPENSSL_free(ctx);
+ free(ctx);
return (0);
}
ctx->obuf_size = DEFAULT_LINEBUFFER_SIZE;
return (0);
b = (BIO_LINEBUFFER_CTX *)a->ptr;
if (b->obuf != NULL)
- OPENSSL_free(b->obuf);
- OPENSSL_free(a->ptr);
+ free(b->obuf);
+ free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
obs = (int)num;
p = ctx->obuf;
if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) {
- p = (char *)OPENSSL_malloc((int)num);
+ p = (char *)malloc((int)num);
if (p == NULL)
goto malloc_error;
}
ctx->obuf_len = obs;
}
memcpy(p, ctx->obuf, ctx->obuf_len);
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
ctx->obuf = p;
ctx->obuf_size = obs;
}
{
NBIO_TEST *nt;
- if (!(nt = (NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST))))
+ if (!(nt = (NBIO_TEST *)malloc(sizeof(NBIO_TEST))))
return (0);
nt->lrn = -1;
nt->lwn = -1;
if (a == NULL)
return (0);
if (a->ptr != NULL)
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr = NULL;
a->init = 0;
a->flags = 0;
{
BIO *ret = NULL;
- ret = (BIO *)OPENSSL_malloc(sizeof(BIO));
+ ret = (BIO *)malloc(sizeof(BIO));
if (ret == NULL) {
BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
if (!BIO_set(ret, method)) {
- OPENSSL_free(ret);
+ free(ret);
ret = NULL;
}
return (ret);
if ((a->method == NULL) || (a->method->destroy == NULL))
return (1);
a->method->destroy(a);
- OPENSSL_free(a);
+ free(a);
return (1);
}
{
BIO_ACCEPT *ret;
- if ((ret = (BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL)
+ if ((ret = (BIO_ACCEPT *)malloc(sizeof(BIO_ACCEPT))) == NULL)
return (NULL);
memset(ret, 0, sizeof(BIO_ACCEPT));
return;
if (a->param_addr != NULL)
- OPENSSL_free(a->param_addr);
+ free(a->param_addr);
if (a->addr != NULL)
- OPENSSL_free(a->addr);
+ free(a->addr);
if (a->bio_chain != NULL)
BIO_free(a->bio_chain);
- OPENSSL_free(a);
+ free(a);
}
static void
if (num == 0) {
b->init = 1;
if (data->param_addr != NULL)
- OPENSSL_free(data->param_addr);
+ free(data->param_addr);
data->param_addr = BUF_strdup(ptr);
} else if (num == 1) {
data->accept_nbio = (ptr != NULL);
{
struct bio_bio_st *b;
- b = OPENSSL_malloc(sizeof *b);
+ b = malloc(sizeof *b);
if (b == NULL)
return 0;
bio_destroy_pair(bio);
if (b->buf != NULL) {
- OPENSSL_free(b->buf);
+ free(b->buf);
}
- OPENSSL_free(b);
+ free(b);
return 1;
}
if (b->size != new_size) {
if (b->buf) {
- OPENSSL_free(b->buf);
+ free(b->buf);
b->buf = NULL;
}
b->size = new_size;
}
if (b1->buf == NULL) {
- b1->buf = OPENSSL_malloc(b1->size);
+ b1->buf = malloc(b1->size);
if (b1->buf == NULL) {
BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE);
return 0;
}
if (b2->buf == NULL) {
- b2->buf = OPENSSL_malloc(b2->size);
+ b2->buf = malloc(b2->size);
if (b2->buf == NULL) {
BIOerr(BIO_F_BIO_MAKE_PAIR, ERR_R_MALLOC_FAILURE);
return 0;
break;
}
if (c->param_port != NULL)
- OPENSSL_free(c->param_port);
+ free(c->param_port);
c->param_port = BUF_strdup(p);
}
}
{
BIO_CONNECT *ret;
- if ((ret = (BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL)
+ if ((ret = (BIO_CONNECT *)malloc(sizeof(BIO_CONNECT))) == NULL)
return (NULL);
ret->state = BIO_CONN_S_BEFORE;
ret->param_hostname = NULL;
return;
if (a->param_hostname != NULL)
- OPENSSL_free(a->param_hostname);
+ free(a->param_hostname);
if (a->param_port != NULL)
- OPENSSL_free(a->param_port);
- OPENSSL_free(a);
+ free(a->param_port);
+ free(a);
}
BIO_METHOD
b->init = 1;
if (num == 0) {
if (data->param_hostname != NULL)
- OPENSSL_free(data->param_hostname);
+ free(data->param_hostname);
data->param_hostname = BUF_strdup(ptr);
} else if (num == 1) {
if (data->param_port != NULL)
- OPENSSL_free(data->param_port);
+ free(data->param_port);
data->param_port = BUF_strdup(ptr);
} else if (num == 2) {
char buf[16];
(void) snprintf(buf, sizeof buf, "%d.%d.%d.%d",
p[0], p[1], p[2], p[3]);
if (data->param_hostname != NULL)
- OPENSSL_free(data->param_hostname);
+ free(data->param_hostname);
data->param_hostname = BUF_strdup(buf);
memcpy(&(data->ip[0]), ptr, 4);
} else if (num == 3) {
(void) snprintf(buf, sizeof buf, "%d",
*(int *)ptr);
if (data->param_port != NULL)
- OPENSSL_free(data->param_port);
+ free(data->param_port);
data->param_port = BUF_strdup(buf);
data->port= *(int *)ptr;
}
bi->init = 0;
bi->num = 0;
- data = OPENSSL_malloc(sizeof(bio_dgram_data));
+ data = malloc(sizeof(bio_dgram_data));
if (data == NULL)
return 0;
memset(data, 0x00, sizeof(bio_dgram_data));
data = (bio_dgram_data *)a->ptr;
if (data != NULL)
- OPENSSL_free(data);
+ free(data);
return (1);
}
* SCTP-AUTH has to be activated for the listening socket
* already, otherwise the connected socket won't use it. */
sockopt_len = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
- authchunks = OPENSSL_malloc(sockopt_len);
+ authchunks = malloc(sockopt_len);
memset(authchunks, 0, sizeof(sockopt_len));
ret = getsockopt(fd, IPPROTO_SCTP, SCTP_LOCAL_AUTH_CHUNKS, authchunks, &sockopt_len);
OPENSSL_assert(ret >= 0);
auth_forward = 1;
}
- OPENSSL_free(authchunks);
+ free(authchunks);
OPENSSL_assert(auth_data);
OPENSSL_assert(auth_forward);
bi->init = 0;
bi->num = 0;
- data = OPENSSL_malloc(sizeof(bio_dgram_sctp_data));
+ data = malloc(sizeof(bio_dgram_sctp_data));
if (data == NULL)
return 0;
memset(data, 0x00, sizeof(bio_dgram_sctp_data));
data = (bio_dgram_sctp_data *)a->ptr;
if (data != NULL)
- OPENSSL_free(data);
+ free(data);
return (1);
}
if (data->saved_message.length > 0) {
dgram_sctp_write(data->saved_message.bio, data->saved_message.data,
data->saved_message.length);
- OPENSSL_free(data->saved_message.data);
+ free(data->saved_message.data);
data->saved_message.length = 0;
}
struct sctp_authchunks *authchunks;
optlen = (socklen_t)(sizeof(sctp_assoc_t) + 256 * sizeof(uint8_t));
- authchunks = OPENSSL_malloc(optlen);
+ authchunks = malloc(optlen);
memset(authchunks, 0, sizeof(optlen));
ii = getsockopt(b->num, IPPROTO_SCTP, SCTP_PEER_AUTH_CHUNKS, authchunks, &optlen);
OPENSSL_assert(ii >= 0);
auth_forward = 1;
}
- OPENSSL_free(authchunks);
+ free(authchunks);
if (!auth_data || !auth_forward) {
BIOerr(BIO_F_DGRAM_SCTP_READ, BIO_R_CONNECT_ERROR);
if (data->save_shutdown && !BIO_dgram_sctp_wait_for_dry(b)) {
data->saved_message.bio = b;
data->saved_message.length = inl;
- data->saved_message.data = OPENSSL_malloc(inl);
+ data->saved_message.data = malloc(inl);
memcpy(data->saved_message.data, in, inl);
return inl;
}
/* Add new key */
sockopt_len = sizeof(struct sctp_authkey) + 64 * sizeof(uint8_t);
- authkey = OPENSSL_malloc(sockopt_len);
+ authkey = malloc(sockopt_len);
memset(authkey, 0x00, sockopt_len);
authkey->sca_keynumber = authkeyid.scact_keynumber + 1;
#ifndef __FreeBSD__
{ 0, "", LOG_ERR } /* The default */
};
- if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) {
+ if ((buf = (char *)malloc(inl + 1)) == NULL) {
return (0);
}
strlcpy(buf, in, inl + 1);
xsyslog(b, priority, pp);
- OPENSSL_free(buf);
+ free(buf);
return (ret);
}
bn_check_top(mod);
- if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL)
+ if ((ret=(BN_BLINDING *)malloc(sizeof(BN_BLINDING))) == NULL)
{
BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
if (r->Ai != NULL) BN_free(r->Ai);
if (r->e != NULL) BN_free(r->e );
if (r->mod != NULL) BN_free(r->mod);
- OPENSSL_free(r);
+ free(r);
}
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
BN_CTX *BN_CTX_new(void)
{
- BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX));
+ BN_CTX *ret = malloc(sizeof(BN_CTX));
if(!ret)
{
BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
#endif
BN_STACK_finish(&ctx->stack);
BN_POOL_finish(&ctx->pool);
- OPENSSL_free(ctx);
+ free(ctx);
}
void BN_CTX_start(BN_CTX *ctx)
static void BN_STACK_finish(BN_STACK *st)
{
- if(st->size) OPENSSL_free(st->indexes);
+ if(st->size) free(st->indexes);
}
#ifndef OPENSSL_NO_DEPRECATED
{
unsigned int newsize = (st->size ?
(st->size * 3 / 2) : BN_CTX_START_FRAMES);
- unsigned int *newitems = OPENSSL_malloc(newsize *
+ unsigned int *newitems = malloc(newsize *
sizeof(unsigned int));
if(!newitems) return 0;
if(st->depth)
memcpy(newitems, st->indexes, st->depth *
sizeof(unsigned int));
- if(st->size) OPENSSL_free(st->indexes);
+ if(st->size) free(st->indexes);
st->indexes = newitems;
st->size = newsize;
}
bn++;
}
p->current = p->head->next;
- OPENSSL_free(p->head);
+ free(p->head);
p->head = p->current;
}
}
{
BIGNUM *bn;
unsigned int loop = 0;
- BN_POOL_ITEM *item = OPENSSL_malloc(sizeof(BN_POOL_ITEM));
+ BN_POOL_ITEM *item = malloc(sizeof(BN_POOL_ITEM));
if(!item) return NULL;
/* Initialise the structure */
bn = item->vals;
powerbufFree = alloca(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH);
else
#endif
- if ((powerbufFree=(unsigned char*)OPENSSL_malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
+ if ((powerbufFree=(unsigned char*)malloc(powerbufLen+MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
goto err;
powerbuf = MOD_EXP_CTIME_ALIGN(powerbufFree);
if (powerbuf!=NULL)
{
OPENSSL_cleanse(powerbuf,powerbufLen);
- if (powerbufFree) OPENSSL_free(powerbufFree);
+ if (powerbufFree) free(powerbufFree);
}
BN_CTX_end(ctx);
return(ret);
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_exp_arr(r, a, b, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
int *arr=NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL) goto err;
+ if ((arr = (int *)malloc(sizeof(int) * max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
{
ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
int *arr=NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) *
+ if ((arr = (int *)malloc(sizeof(int) *
max)) == NULL) goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max)
ret = BN_GF2m_mod_solve_quad_arr(r, a, arr, ctx);
bn_check_top(r);
err:
- if (arr) OPENSSL_free(arr);
+ if (arr) free(arr);
return ret;
}
{
OPENSSL_cleanse(a->d,a->dmax*sizeof(a->d[0]));
if (!(BN_get_flags(a,BN_FLG_STATIC_DATA)))
- OPENSSL_free(a->d);
+ free(a->d);
}
i=BN_get_flags(a,BN_FLG_MALLOCED);
OPENSSL_cleanse(a,sizeof(BIGNUM));
if (i)
- OPENSSL_free(a);
+ free(a);
}
void BN_free(BIGNUM *a)
if (a == NULL) return;
bn_check_top(a);
if ((a->d != NULL) && !(BN_get_flags(a,BN_FLG_STATIC_DATA)))
- OPENSSL_free(a->d);
+ free(a->d);
if (a->flags & BN_FLG_MALLOCED)
- OPENSSL_free(a);
+ free(a);
else
{
#ifndef OPENSSL_NO_DEPRECATED
{
BIGNUM *ret;
- if ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
+ if ((ret=(BIGNUM *)malloc(sizeof(BIGNUM))) == NULL)
{
BNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
BNerr(BN_F_BN_EXPAND_INTERNAL,BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return(NULL);
}
- a=A=(BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG)*words);
+ a=A=(BN_ULONG *)malloc(sizeof(BN_ULONG)*words);
if (A == NULL)
{
BNerr(BN_F_BN_EXPAND_INTERNAL,ERR_R_MALLOC_FAILURE);
else
{
/* r == NULL, BN_new failure */
- OPENSSL_free(a);
+ free(a);
}
}
/* If a == NULL, there was an error in allocation in
{
BN_ULONG *a = bn_expand_internal(b, words);
if(!a) return NULL;
- if(b->d) OPENSSL_free(b->d);
+ if(b->d) free(b->d);
b->d=a;
b->dmax=words;
}
{
BN_MONT_CTX *ret;
- if ((ret=(BN_MONT_CTX *)OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL)
+ if ((ret=(BN_MONT_CTX *)malloc(sizeof(BN_MONT_CTX))) == NULL)
return(NULL);
BN_MONT_CTX_init(ret);
BN_free(&(mont->N));
BN_free(&(mont->Ni));
if (mont->flags & BN_FLG_MALLOCED)
- OPENSSL_free(mont);
+ free(mont);
}
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
static const char Hex[]="0123456789ABCDEF";
-/* Must 'OPENSSL_free' the returned data */
+/* Must 'free' the returned data */
char *BN_bn2hex(const BIGNUM *a)
{
int i,j,v,z=0;
char *buf;
char *p;
- buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2);
+ buf=(char *)malloc(a->top*BN_BYTES*2+2);
if (buf == NULL)
{
BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE);
return(buf);
}
-/* Must 'OPENSSL_free' the returned data */
+/* Must 'free' the returned data */
char *BN_bn2dec(const BIGNUM *a)
{
int i=0,num, ok = 0;
*/
i=BN_num_bits(a)*3;
num=(i/10+i/1000+1)+1;
- bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
- buf=(char *)OPENSSL_malloc(num+3);
+ bn_data=(BN_ULONG *)malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG));
+ buf=(char *)malloc(num+3);
if ((buf == NULL) || (bn_data == NULL))
{
BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE);
}
ok = 1;
err:
- if (bn_data != NULL) OPENSSL_free(bn_data);
+ if (bn_data != NULL) free(bn_data);
if (t != NULL) BN_free(t);
if (!ok && buf)
{
- OPENSSL_free(buf);
+ free(buf);
buf = NULL;
}
bit=(bits-1)%8;
mask=0xff<<(bit+1);
- buf=(unsigned char *)OPENSSL_malloc(bytes);
+ buf=(unsigned char *)malloc(bytes);
if (buf == NULL)
{
BNerr(BN_F_BNRAND,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,bytes);
- OPENSSL_free(buf);
+ free(buf);
}
bn_check_top(rnd);
return(ret);
{
BN_RECP_CTX *ret;
- if ((ret=(BN_RECP_CTX *)OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL)
+ if ((ret=(BN_RECP_CTX *)malloc(sizeof(BN_RECP_CTX))) == NULL)
return(NULL);
BN_RECP_CTX_init(ret);
BN_free(&(recp->N));
BN_free(&(recp->Nr));
if (recp->flags & BN_FLG_MALLOCED)
- OPENSSL_free(recp);
+ free(recp);
}
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx)
if (str == NULL) return(NULL);
- ret=OPENSSL_malloc(siz+1);
+ ret=malloc(siz+1);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
if (data == NULL) return(NULL);
- ret=OPENSSL_malloc(siz);
+ ret=malloc(siz);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE);
{
BUF_MEM *ret;
- ret=OPENSSL_malloc(sizeof(BUF_MEM));
+ ret=malloc(sizeof(BUF_MEM));
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
if (a->data != NULL)
{
memset(a->data,0,(unsigned int)a->max);
- OPENSSL_free(a->data);
+ free(a->data);
}
- OPENSSL_free(a);
+ free(a);
}
int BUF_MEM_grow(BUF_MEM *str, size_t len)
}
n=(len+3)/3*4;
if (str->data == NULL)
- ret=OPENSSL_malloc(n);
+ ret=malloc(n);
else
- ret=OPENSSL_realloc(str->data,n);
+ ret=realloc(str->data,n);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
}
n=(len+3)/3*4;
if (str->data == NULL)
- ret=OPENSSL_malloc(n);
+ ret=malloc(n);
else
ret=OPENSSL_realloc_clean(str->data,str->max,n);
if (ret == NULL)
if (!key)
return 0;
r = pkey_cmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key);
- OPENSSL_free(key);
+ free(key);
return r;
}
return -2;
CMAC_CTX *CMAC_CTX_new(void)
{
CMAC_CTX *ctx;
- ctx = OPENSSL_malloc(sizeof(CMAC_CTX));
+ ctx = malloc(sizeof(CMAC_CTX));
if (!ctx)
return NULL;
EVP_CIPHER_CTX_init(&ctx->cctx);
void CMAC_CTX_free(CMAC_CTX *ctx)
{
CMAC_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in)
if (kekri->key)
{
OPENSSL_cleanse(kekri->key, kekri->keylen);
- OPENSSL_free(kekri->key);
+ free(kekri->key);
}
}
else if (ri->type == CMS_RECIPINFO_PASS)
if (pwri->pass)
{
OPENSSL_cleanse(pwri->pass, pwri->passlen);
- OPENSSL_free(pwri->pass);
+ free(pwri->pass);
}
}
}
/* Generate random session key */
if (!enc || !ec->key)
{
- tkey = OPENSSL_malloc(tkeylen);
+ tkey = malloc(tkeylen);
if (!tkey)
{
CMSerr(CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO,
{
/* Use random key */
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
ec->key = tkey;
ec->keylen = tkeylen;
tkey = NULL;
if (ec->key && !keep_key)
{
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
ec->key = NULL;
}
if (tkey)
{
OPENSSL_cleanse(tkey, tkeylen);
- OPENSSL_free(tkey);
+ free(tkey);
}
if (ok)
return b;
ec->cipher = cipher;
if (key)
{
- ec->key = OPENSSL_malloc(keylen);
+ ec->key = malloc(keylen);
if (!ec->key)
return 0;
memcpy(ec->key, key, keylen);
if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
ktri->encryptedKey->length) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (ec->key)
{
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
}
ec->key = ek;
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
goto err;
}
- wkey = OPENSSL_malloc(ec->keylen + 8);
+ wkey = malloc(ec->keylen + 8);
if (!wkey)
{
err:
if (!r && wkey)
- OPENSSL_free(wkey);
+ free(wkey);
OPENSSL_cleanse(&actx, sizeof(actx));
return r;
goto err;
}
- ukey = OPENSSL_malloc(kekri->encryptedKey->length - 8);
+ ukey = malloc(kekri->encryptedKey->length - 8);
if (!ukey)
{
err:
if (!r && ukey)
- OPENSSL_free(ukey);
+ free(ukey);
OPENSSL_cleanse(&actx, sizeof(actx));
return r;
if (ec->key)
{
OPENSSL_cleanse(ec->key, ec->keylen);
- OPENSSL_free(ec->key);
+ free(ec->key);
ec->key = NULL;
ec->keylen = 0;
}
CMSerr(CMS_F_CMS_ADD1_RECEIPTREQUEST, ERR_R_MALLOC_FAILURE);
if (rrder)
- OPENSSL_free(rrder);
+ free(rrder);
return r;
/* Invalid size */
return 0;
}
- tmp = OPENSSL_malloc(inlen);
+ tmp = malloc(inlen);
/* setup IV by decrypting last two blocks */
EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2);
rv = 1;
err:
OPENSSL_cleanse(tmp, inlen);
- OPENSSL_free(tmp);
+ free(tmp);
return rv;
}
if (!kek_wrap_key(NULL, &keylen, ec->key, ec->keylen, &kekctx))
goto err;
- key = OPENSSL_malloc(keylen);
+ key = malloc(keylen);
if (!key)
goto err;
}
else
{
- key = OPENSSL_malloc(pwri->encryptedKey->length);
+ key = malloc(pwri->encryptedKey->length);
if (!key)
{
EVP_CIPHER_CTX_cleanup(&kekctx);
if (!r && key)
- OPENSSL_free(key);
+ free(key);
X509_ALGOR_free(kekalg);
return r;
{
unsigned char *sig;
unsigned int siglen;
- sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey));
+ sig = malloc(EVP_PKEY_size(si->pkey));
if (!sig)
{
CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,
{
CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,
CMS_R_SIGNFINAL_ERROR);
- OPENSSL_free(sig);
+ free(sig);
goto err;
}
ASN1_STRING_set0(si->signature, sig, siglen);
goto err;
if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0)
goto err;
- OPENSSL_free(abuf);
- abuf = OPENSSL_malloc(siglen);
+ free(abuf);
+ abuf = malloc(siglen);
if(!abuf)
goto err;
if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0)
err:
if (abuf)
- OPENSSL_free(abuf);
+ free(abuf);
EVP_MD_CTX_cleanup(&mctx);
return 0;
if(!abuf)
goto err;
r = EVP_DigestVerifyUpdate(&mctx, abuf, alen);
- OPENSSL_free(abuf);
+ free(abuf);
if (r <= 0)
{
r = -1;
return 0;
r = CMS_signed_add1_attr_by_NID(si, NID_SMIMECapabilities,
V_ASN1_SEQUENCE, smder, smderlen);
- OPENSSL_free(smder);
+ free(smder);
return r;
}
{
void *p;
- p=OPENSSL_malloc(no*size);
+ p=malloc(no*size);
if (p)
memset(p, 0, no*size);
return p;
static void zlib_zfree(void* opaque, void* address)
{
- OPENSSL_free(address);
+ free(address);
}
#if 0
{
int err;
struct zlib_state *state =
- (struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state));
+ (struct zlib_state *)malloc(sizeof(struct zlib_state));
if (state == NULL)
goto err;
CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state);
return 1;
err:
- if (state) OPENSSL_free(state);
+ if (state) free(state);
return 0;
}
zlib_stateful_ex_idx);
inflateEnd(&state->istream);
deflateEnd(&state->ostream);
- OPENSSL_free(state);
+ free(state);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data);
}
return 0;
}
#endif
- ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX));
+ ctx = malloc(sizeof(BIO_ZLIB_CTX));
if(!ctx)
{
COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE);
{
/* Destroy decompress context */
inflateEnd(&ctx->zin);
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
}
if(ctx->obuf)
{
/* Destroy compress context */
deflateEnd(&ctx->zout);
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
}
- OPENSSL_free(ctx);
+ free(ctx);
bi->ptr = NULL;
bi->init = 0;
bi->flags = 0;
BIO_clear_retry_flags(b);
if(!ctx->ibuf)
{
- ctx->ibuf = OPENSSL_malloc(ctx->ibufsize);
+ ctx->ibuf = malloc(ctx->ibufsize);
if(!ctx->ibuf)
{
COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE);
BIO_clear_retry_flags(b);
if(!ctx->obuf)
{
- ctx->obuf = OPENSSL_malloc(ctx->obufsize);
+ ctx->obuf = malloc(ctx->obufsize);
/* Need error here */
if(!ctx->obuf)
{
{
if (ctx->ibuf)
{
- OPENSSL_free(ctx->ibuf);
+ free(ctx->ibuf);
ctx->ibuf = NULL;
}
ctx->ibufsize = ibs;
{
if (ctx->obuf)
{
- OPENSSL_free(ctx->obuf);
+ free(ctx->obuf);
ctx->obuf = NULL;
}
ctx->obufsize = obs;
{
COMP_CTX *ret;
- if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL)
+ if ((ret=(COMP_CTX *)malloc(sizeof(COMP_CTX))) == NULL)
{
/* ZZZZZZZZZZZZZZZZ */
return(NULL);
ret->meth=meth;
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
if (ctx->meth->finish != NULL)
ctx->meth->finish(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
if (v != NULL)
{
(void)sk_CONF_VALUE_delete_ptr(ts,v);
- OPENSSL_free(v->name);
- OPENSSL_free(v->value);
- OPENSSL_free(v);
+ free(v->name);
+ free(v->value);
+ free(v);
}
return 1;
}
if (conf == NULL || conf->data == NULL) return;
lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make
- * sure the 'OPENSSL_free()' works as
+ * sure the 'free()' works as
* expected */
lh_CONF_VALUE_doall_arg(conf->data,
LHASH_DOALL_ARG_FN(value_free_hash),
for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--)
{
vv=sk_CONF_VALUE_value(sk,i);
- OPENSSL_free(vv->value);
- OPENSSL_free(vv->name);
- OPENSSL_free(vv);
+ free(vv->value);
+ free(vv->name);
+ free(vv);
}
if (sk != NULL) sk_CONF_VALUE_free(sk);
- OPENSSL_free(a->section);
- OPENSSL_free(a);
+ free(a->section);
+ free(a);
}
/* Up until OpenSSL 0.9.5a, this was new_section */
if ((sk=sk_CONF_VALUE_new_null()) == NULL)
goto err;
- if ((v=OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL)
+ if ((v=malloc(sizeof(CONF_VALUE))) == NULL)
goto err;
i=strlen(section)+1;
- if ((v->section=OPENSSL_malloc(i)) == NULL)
+ if ((v->section=malloc(i)) == NULL)
goto err;
memcpy(v->section,section,i);
if (!ok)
{
if (sk != NULL) sk_CONF_VALUE_free(sk);
- if (v != NULL) OPENSSL_free(v);
+ if (v != NULL) free(v);
v=NULL;
}
return(v);
{
CONF *ret;
- ret = OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
+ ret = malloc(sizeof(CONF) + sizeof(unsigned short *));
if (ret)
if (meth->init(ret) == 0)
{
- OPENSSL_free(ret);
+ free(ret);
ret = NULL;
}
return ret;
{
if (def_destroy_data(conf))
{
- OPENSSL_free(conf);
+ free(conf);
return 1;
}
return 0;
goto err;
}
- section=(char *)OPENSSL_malloc(10);
+ section=(char *)malloc(10);
if (section == NULL)
{
CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
p++;
*p='\0';
- if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
+ if (!(v=(CONF_VALUE *)malloc(sizeof(CONF_VALUE))))
{
CONFerr(CONF_F_DEF_LOAD_BIO,
ERR_R_MALLOC_FAILURE);
goto err;
}
if (psection == NULL) psection=section;
- v->name=(char *)OPENSSL_malloc(strlen(pname)+1);
+ v->name=(char *)malloc(strlen(pname)+1);
v->value=NULL;
if (v->name == NULL)
{
if (vv != NULL)
{
sk_CONF_VALUE_delete_ptr(ts,vv);
- OPENSSL_free(vv->name);
- OPENSSL_free(vv->value);
- OPENSSL_free(vv);
+ free(vv->name);
+ free(vv->value);
+ free(vv);
}
#endif
v=NULL;
}
}
if (buff != NULL) BUF_MEM_free(buff);
- if (section != NULL) OPENSSL_free(section);
+ if (section != NULL) free(section);
return(1);
err:
if (buff != NULL) BUF_MEM_free(buff);
- if (section != NULL) OPENSSL_free(section);
+ if (section != NULL) free(section);
if (line != NULL) *line=eline;
(void) snprintf(btmp,sizeof btmp,"%ld",eline);
ERR_add_error_data(2,"line ",btmp);
}
if (v != NULL)
{
- if (v->name != NULL) OPENSSL_free(v->name);
- if (v->value != NULL) OPENSSL_free(v->value);
- if (v != NULL) OPENSSL_free(v);
+ if (v->name != NULL) free(v->name);
+ if (v->value != NULL) free(v->value);
+ if (v != NULL) free(v);
}
return(0);
}
buf->data[to++]= *(from++);
}
buf->data[to]='\0';
- if (*pto != NULL) OPENSSL_free(*pto);
+ if (*pto != NULL) free(*pto);
*pto=buf->data;
- OPENSSL_free(buf);
+ free(buf);
return(1);
err:
if (buf != NULL) BUF_MEM_free(buf);
err:
if (filename == NULL)
- OPENSSL_free(file);
+ free(file);
NCONF_free(conf);
return ret;
supported_modules = sk_CONF_MODULE_new_null();
if (supported_modules == NULL)
return NULL;
- tmod = OPENSSL_malloc(sizeof(CONF_MODULE));
+ tmod = malloc(sizeof(CONF_MODULE));
if (tmod == NULL)
return NULL;
if (!sk_CONF_MODULE_push(supported_modules, tmod))
{
- OPENSSL_free(tmod);
+ free(tmod);
return NULL;
}
CONF_IMODULE *imod = NULL;
/* Otherwise add initialized module to list */
- imod = OPENSSL_malloc(sizeof(CONF_IMODULE));
+ imod = malloc(sizeof(CONF_IMODULE));
if (!imod)
goto err;
if (imod)
{
if (imod->name)
- OPENSSL_free(imod->name);
+ free(imod->name);
if (imod->value)
- OPENSSL_free(imod->value);
- OPENSSL_free(imod);
+ free(imod->value);
+ free(imod);
}
return -1;
{
if (md->dso)
DSO_free(md->dso);
- OPENSSL_free(md->name);
- OPENSSL_free(md);
+ free(md->name);
+ free(md);
}
/* finish and free up all modules instances */
if (imod->pmod->finish)
imod->pmod->finish(imod);
imod->pmod->links--;
- OPENSSL_free(imod->name);
- OPENSSL_free(imod->value);
- OPENSSL_free(imod);
+ free(imod->name);
+ free(imod->value);
+ free(imod);
}
/* Add a static module to OpenSSL */
#endif
len += strlen(OPENSSL_CONF);
- file = OPENSSL_malloc(len + 1);
+ file = malloc(len + 1);
if (!file)
return NULL;
}
i = sk_OPENSSL_STRING_push(app_locks, str);
if (!i)
- OPENSSL_free(str);
+ free(str);
else
i += CRYPTO_NUM_LOCKS; /* gap of one :-) */
return (i);
}
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
- pointer = (CRYPTO_dynlock *)OPENSSL_malloc(sizeof(CRYPTO_dynlock));
+ pointer = (CRYPTO_dynlock *)malloc(sizeof(CRYPTO_dynlock));
if (pointer == NULL) {
CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
return (0);
pointer->references = 1;
pointer->data = dynlock_create_callback(__FILE__, __LINE__);
if (pointer->data == NULL) {
- OPENSSL_free(pointer);
+ free(pointer);
CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
return (0);
}
if (i == -1) {
dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
- OPENSSL_free(pointer);
+ free(pointer);
} else
i += 1; /* to avoid 0 */
return - i;
if (pointer) {
dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
- OPENSSL_free(pointer);
+ free(pointer);
}
}
if (tmpbuf == NULL)
{
- tmpbuf=OPENSSL_malloc(BSIZE);
+ tmpbuf=malloc(BSIZE);
if (tmpbuf == NULL) return(-1);
}
if (net == NULL)
{
- net=OPENSSL_malloc(BSIZE);
+ net=malloc(BSIZE);
if (net == NULL) return(-1);
}
if (unnet == NULL)
{
- unnet=OPENSSL_malloc(BSIZE);
+ unnet=malloc(BSIZE);
if (unnet == NULL) return(-1);
}
/* left over data from last decrypt */
if (outbuf == NULL)
{
- outbuf=OPENSSL_malloc(BSIZE+HDRSIZE);
+ outbuf=malloc(BSIZE+HDRSIZE);
if (outbuf == NULL) return(-1);
}
/* If we are sending less than 8 bytes, the same char will look
err:
if (penc)
- OPENSSL_free(penc);
+ free(penc);
if (pval)
ASN1_STRING_free(pval);
err:
if (dp != NULL)
- OPENSSL_free(dp);
+ free(dp);
if (params != NULL)
ASN1_STRING_free(params);
if (prkey != NULL)
else
ktype = "PKCS#3 DH Parameters";
- m= OPENSSL_malloc(buf_len+10);
+ m= malloc(buf_len+10);
if (m == NULL)
{
reason=ERR_R_MALLOC_FAILURE;
err:
DHerr(DH_F_DO_DH_PRINT,reason);
}
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
{
DH *ret;
- ret=(DH *)OPENSSL_malloc(sizeof(DH));
+ ret=(DH *)malloc(sizeof(DH));
if (ret == NULL)
{
DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (!ENGINE_init(engine))
{
DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
ret->engine = engine;
{
DHerr(DH_F_DH_NEW_METHOD,ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
if (r->g != NULL) BN_clear_free(r->g);
if (r->q != NULL) BN_clear_free(r->q);
if (r->j != NULL) BN_clear_free(r->j);
- if (r->seed) OPENSSL_free(r->seed);
+ if (r->seed) free(r->seed);
if (r->counter != NULL) BN_clear_free(r->counter);
if (r->pub_key != NULL) BN_clear_free(r->pub_key);
if (r->priv_key != NULL) BN_clear_free(r->priv_key);
- OPENSSL_free(r);
+ free(r);
}
int DH_up_ref(DH *r)
static int pkey_dh_init(EVP_PKEY_CTX *ctx)
{
DH_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(DH_PKEY_CTX));
+ dctx = malloc(sizeof(DH_PKEY_CTX));
if (!dctx)
return 0;
dctx->prime_len = 1024;
{
DH_PKEY_CTX *dctx = ctx->data;
if (dctx)
- OPENSSL_free(dctx);
+ free(dctx);
}
static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
err:
if (penc)
- OPENSSL_free(penc);
+ free(penc);
if (pval)
ASN1_STRING_free(pval);
err:
if (dp != NULL)
- OPENSSL_free(dp);
+ free(dp);
if (params != NULL)
ASN1_STRING_free(params);
if (prkey != NULL)
update_buflen(priv_key, &buf_len);
update_buflen(pub_key, &buf_len);
- m=(unsigned char *)OPENSSL_malloc(buf_len+10);
+ m=(unsigned char *)malloc(buf_len+10);
if (m == NULL)
{
DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);
if (!ASN1_bn_print(bp,"G: ",x->g,m,off)) goto err;
ret=1;
err:
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
unsigned char *m=NULL;
update_buflen(dsa_sig->r, &buf_len);
update_buflen(dsa_sig->s, &buf_len);
- m = OPENSSL_malloc(buf_len+10);
+ m = malloc(buf_len+10);
if (m == NULL)
{
DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE);
rv = 1;
err:
if (m)
- OPENSSL_free(m);
+ free(m);
DSA_SIG_free(dsa_sig);
return rv;
}
{
if(operation == ASN1_OP_NEW_PRE) {
DSA_SIG *sig;
- sig = OPENSSL_malloc(sizeof(DSA_SIG));
+ sig = malloc(sizeof(DSA_SIG));
if (!sig)
{
DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE);
{
DSA *ret;
- ret=(DSA *)OPENSSL_malloc(sizeof(DSA));
+ ret=(DSA *)malloc(sizeof(DSA));
if (ret == NULL)
{
DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (!ENGINE_init(engine))
{
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
ret->engine = engine;
DSAerr(DSA_F_DSA_NEW_METHOD,
ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
if (r->priv_key != NULL) BN_clear_free(r->priv_key);
if (r->kinv != NULL) BN_clear_free(r->kinv);
if (r->r != NULL) BN_clear_free(r->r);
- OPENSSL_free(r);
+ free(r);
}
int DSA_up_ref(DSA *r)
static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
{
DSA_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(DSA_PKEY_CTX));
+ dctx = malloc(sizeof(DSA_PKEY_CTX));
if (!dctx)
return 0;
dctx->nbits = 1024;
{
DSA_PKEY_CTX *dctx = ctx->data;
if (dctx)
- OPENSSL_free(dctx);
+ free(dctx);
}
static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
DSA_SIG *DSA_SIG_new(void)
{
DSA_SIG *sig;
- sig = OPENSSL_malloc(sizeof(DSA_SIG));
+ sig = malloc(sizeof(DSA_SIG));
if (!sig)
return NULL;
sig->r = NULL;
BN_free(sig->r);
if (sig->s)
BN_free(sig->s);
- OPENSSL_free(sig);
+ free(sig);
}
}
* (or NULL if they are to be used independantly of a DSO object) and a
* filename to transform. They should either return NULL (if there is an error
* condition) or a newly allocated string containing the transformed form that
- * the caller will need to free with OPENSSL_free() when done. */
+ * the caller will need to free with free() when done. */
typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
/* The function prototype used for method functions (or caller-provided
* callbacks) that merge two file specifications. They are passed a
* a DSO object) and two file specifications to merge. They should
* either return NULL (if there is an error condition) or a newly allocated
* string containing the result of merging that the caller will need
- * to free with OPENSSL_free() when done.
+ * to free with free() when done.
* Here, merging means that bits and pieces are taken from each of the
* file specifications and added together in whatever fashion that is
* sensible for the DSO method in question. The only rule that really
const char *name;
/* Loads a shared library, NB: new DSO_METHODs must ensure that a
* successful load populates the loaded_filename field, and likewise a
- * successful unload OPENSSL_frees and NULLs it out. */
+ * successful unload frees and NULLs it out. */
int (*dso_load)(DSO *dso);
/* Unloads a shared library */
int (*dso_unload)(DSO *dso);
* simply duplicated. NB: This function is usually called from within a
* DSO_METHOD during the processing of a DSO_load() call, and is exposed so that
* caller-created DSO_METHODs can do the same thing. A non-NULL return value
- * will need to be OPENSSL_free()'d. */
+ * will need to be free()'d. */
char *DSO_convert_filename(DSO *dso, const char *filename);
/* This function will invoke the DSO's merger callback to merge two file
* specifications, or if the callback isn't set it will instead use the
* DSO_METHOD's merger. A non-NULL return value will need to be
- * OPENSSL_free()'d. */
+ * free()'d. */
char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
/* If the DSO is currently loaded, this returns the filename that it was loaded
* under, otherwise it returns NULL. So it is also useful as a test as to
err:
/* Cleanup! */
if(filename != NULL)
- OPENSSL_free(filename);
+ free(filename);
if(ptr != NULL)
dlclose(ptr);
return(0);
if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/'))
{
len = strlen(filespec1) + 1;
- merged = OPENSSL_malloc(len);
+ merged = malloc(len);
if(!merged)
{
DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
else if (!filespec1)
{
len = strlen(filespec2) + 1;
- merged = OPENSSL_malloc(strlen(filespec2) + 1);
+ merged = malloc(strlen(filespec2) + 1);
if(!merged)
{
DSOerr(DSO_F_DLFCN_MERGER,
spec2len--;
len--;
}
- merged = OPENSSL_malloc(len + 2);
+ merged = malloc(len + 2);
if(!merged)
{
DSOerr(DSO_F_DLFCN_MERGER,
if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
rsize += 3; /* The length of "lib" */
}
- translated = OPENSSL_malloc(rsize);
+ translated = malloc(rsize);
if(translated == NULL)
{
DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
* to stealing the "best available" method. Will fallback
* to DSO_METH_null() in the worst case. */
default_DSO_meth = DSO_METHOD_openssl();
- ret = (DSO *)OPENSSL_malloc(sizeof(DSO));
+ ret = (DSO *)malloc(sizeof(DSO));
if(ret == NULL)
{
DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
{
/* sk_new doesn't generate any errors so we do */
DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
- OPENSSL_free(ret);
+ free(ret);
return(NULL);
}
if(meth == NULL)
ret->references = 1;
if((ret->meth->init != NULL) && !ret->meth->init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
sk_void_free(dso->meth_data);
if(dso->filename != NULL)
- OPENSSL_free(dso->filename);
+ free(dso->filename);
if(dso->loaded_filename != NULL)
- OPENSSL_free(dso->loaded_filename);
+ free(dso->loaded_filename);
- OPENSSL_free(dso);
+ free(dso);
return(1);
}
return(0);
}
/* We'll duplicate filename */
- copied = OPENSSL_malloc(strlen(filename) + 1);
+ copied = malloc(strlen(filename) + 1);
if(copied == NULL)
{
DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE);
}
BUF_strlcpy(copied, filename, strlen(filename) + 1);
if(dso->filename)
- OPENSSL_free(dso->filename);
+ free(dso->filename);
dso->filename = copied;
return(1);
}
}
if(result == NULL)
{
- result = OPENSSL_malloc(strlen(filename) + 1);
+ result = malloc(strlen(filename) + 1);
if(result == NULL)
{
DSOerr(DSO_F_DSO_CONVERT_FILENAME,
penclen = i2o_ECPublicKey(ec_key, NULL);
if (penclen <= 0)
goto err;
- penc = OPENSSL_malloc(penclen);
+ penc = malloc(penclen);
if (!penc)
goto err;
p = penc;
else
ASN1_STRING_free(pval);
if (penc)
- OPENSSL_free(penc);
+ free(penc);
return 0;
}
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
return 0;
}
- ep = (unsigned char *) OPENSSL_malloc(eplen);
+ ep = (unsigned char *) malloc(eplen);
if (!ep)
{
EC_KEY_set_enc_flags(ec_key, old_flags);
if (!i2d_ECPrivateKey(ec_key, &p))
{
EC_KEY_set_enc_flags(ec_key, old_flags);
- OPENSSL_free(ep);
+ free(ep);
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
}
/* restore old encoding flags */
if (ktype > 0)
{
buf_len += 10;
- if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buffer = malloc(buf_len)) == NULL)
{
reason = ERR_R_MALLOC_FAILURE;
goto err;
if (ctx)
BN_CTX_free(ctx);
if (buffer != NULL)
- OPENSSL_free(buffer);
+ free(buffer);
return(ret);
}
}
else
{
- if ((buffer_1 = OPENSSL_malloc(len_1)) == NULL)
+ if ((buffer_1 = malloc(len_1)) == NULL)
{
ECerr(EC_F_EC_ASN1_GROUP2CURVE,
ERR_R_MALLOC_FAILURE);
}
else
{
- if ((buffer_2 = OPENSSL_malloc(len_2)) == NULL)
+ if ((buffer_2 = malloc(len_2)) == NULL)
{
ECerr(EC_F_EC_ASN1_GROUP2CURVE,
ERR_R_MALLOC_FAILURE);
ok = 1;
err: if (buffer_1)
- OPENSSL_free(buffer_1);
+ free(buffer_1);
if (buffer_2)
- OPENSSL_free(buffer_2);
+ free(buffer_2);
if (tmp_1)
BN_free(tmp_1);
if (tmp_2)
ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_EC_LIB);
goto err;
}
- if ((buffer = OPENSSL_malloc(len)) == NULL)
+ if ((buffer = malloc(len)) == NULL)
{
ECerr(EC_F_EC_ASN1_GROUP2PARAMETERS, ERR_R_MALLOC_FAILURE);
goto err;
if (tmp)
BN_free(tmp);
if (buffer)
- OPENSSL_free(buffer);
+ free(buffer);
return(ret);
}
if (params->curve->seed != NULL)
{
if (ret->seed != NULL)
- OPENSSL_free(ret->seed);
- if (!(ret->seed = OPENSSL_malloc(params->curve->seed->length)))
+ free(ret->seed);
+ if (!(ret->seed = malloc(params->curve->seed->length)))
{
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
ERR_R_MALLOC_FAILURE);
priv_key->version = a->version;
buf_len = (size_t)BN_num_bytes(a->priv_key);
- buffer = OPENSSL_malloc(buf_len);
+ buffer = malloc(buf_len);
if (buffer == NULL)
{
ECerr(EC_F_I2D_ECPRIVATEKEY,
if (tmp_len > buf_len)
{
- unsigned char *tmp_buffer = OPENSSL_realloc(buffer, tmp_len);
+ unsigned char *tmp_buffer = realloc(buffer, tmp_len);
if (!tmp_buffer)
{
ECerr(EC_F_I2D_ECPRIVATEKEY, ERR_R_MALLOC_FAILURE);
ok=1;
err:
if (buffer)
- OPENSSL_free(buffer);
+ free(buffer);
if (priv_key)
EC_PRIVATEKEY_free(priv_key);
return(ok?ret:0);
if (*out == NULL)
{
- if ((*out = OPENSSL_malloc(buf_len)) == NULL)
+ if ((*out = malloc(buf_len)) == NULL)
{
ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_MALLOC_FAILURE);
return 0;
*out, buf_len, NULL))
{
ECerr(EC_F_I2O_ECPUBLICKEY, ERR_R_EC_LIB);
- OPENSSL_free(*out);
+ free(*out);
*out = NULL;
return 0;
}
{
EC_KEY *ret;
- ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
+ ret=(EC_KEY *)malloc(sizeof(EC_KEY));
if (ret == NULL)
{
ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
OPENSSL_cleanse((void *)r, sizeof(EC_KEY));
- OPENSSL_free(r);
+ free(r);
}
EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
return NULL;
}
- ret = OPENSSL_malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (ret == NULL)
{
ECerr(EC_F_EC_GROUP_NEW, ERR_R_MALLOC_FAILURE);
if (!meth->group_init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
BN_free(&group->cofactor);
if (group->seed)
- OPENSSL_free(group->seed);
+ free(group->seed);
- OPENSSL_free(group);
+ free(group);
}
if (group->seed)
{
OPENSSL_cleanse(group->seed, group->seed_len);
- OPENSSL_free(group->seed);
+ free(group->seed);
}
OPENSSL_cleanse(group, sizeof *group);
- OPENSSL_free(group);
+ free(group);
}
if (src->seed)
{
if (dest->seed)
- OPENSSL_free(dest->seed);
- dest->seed = OPENSSL_malloc(src->seed_len);
+ free(dest->seed);
+ dest->seed = malloc(src->seed_len);
if (dest->seed == NULL)
return 0;
if (!memcpy(dest->seed, src->seed, src->seed_len))
else
{
if (dest->seed)
- OPENSSL_free(dest->seed);
+ free(dest->seed);
dest->seed = NULL;
dest->seed_len = 0;
}
{
if (group->seed)
{
- OPENSSL_free(group->seed);
+ free(group->seed);
group->seed = NULL;
group->seed_len = 0;
}
if (!len || !p)
return 1;
- if ((group->seed = OPENSSL_malloc(len)) == NULL)
+ if ((group->seed = malloc(len)) == NULL)
return 0;
memcpy(group->seed, p, len);
group->seed_len = len;
/* no explicit entry needed */
return 1;
- d = OPENSSL_malloc(sizeof *d);
+ d = malloc(sizeof *d);
if (d == NULL)
return 0;
EC_EXTRA_DATA *next = (*p)->next;
(*p)->free_func((*p)->data);
- OPENSSL_free(*p);
+ free(*p);
*p = next;
return;
EC_EXTRA_DATA *next = (*p)->next;
(*p)->clear_free_func((*p)->data);
- OPENSSL_free(*p);
+ free(*p);
*p = next;
return;
EC_EXTRA_DATA *next = d->next;
d->free_func(d->data);
- OPENSSL_free(d);
+ free(d);
d = next;
}
EC_EXTRA_DATA *next = d->next;
d->clear_free_func(d->data);
- OPENSSL_free(d);
+ free(d);
d = next;
}
return NULL;
}
- ret = OPENSSL_malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (ret == NULL)
{
ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE);
if (!ret->meth->point_init(ret))
{
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
if (point->meth->point_finish != 0)
point->meth->point_finish(point);
- OPENSSL_free(point);
+ free(point);
}
else if (point->meth->point_finish != 0)
point->meth->point_finish(point);
OPENSSL_cleanse(point, sizeof *point);
- OPENSSL_free(point);
+ free(point);
}
if (!group)
return NULL;
- ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
+ ret = (EC_PRE_COMP *)malloc(sizeof(EC_PRE_COMP));
if (!ret)
{
ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
for (p = pre->points; *p != NULL; p++)
EC_POINT_free(*p);
- OPENSSL_free(pre->points);
+ free(pre->points);
}
- OPENSSL_free(pre);
+ free(pre);
}
static void ec_pre_comp_clear_free(void *pre_)
EC_POINT_clear_free(*p);
OPENSSL_cleanse(p, sizeof *p);
}
- OPENSSL_free(pre->points);
+ free(pre->points);
}
OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ free(pre);
}
if (BN_is_zero(scalar))
{
- r = OPENSSL_malloc(1);
+ r = malloc(1);
if (!r)
{
ECerr(EC_F_COMPUTE_WNAF, ERR_R_MALLOC_FAILURE);
}
len = BN_num_bits(scalar);
- r = OPENSSL_malloc(len + 1); /* modified wNAF may be one digit longer than binary representation
+ r = malloc(len + 1); /* modified wNAF may be one digit longer than binary representation
* (*ret_len will be set to the actual length, i.e. at most
* BN_num_bits(scalar) + 1) */
if (r == NULL)
err:
if (!ok)
{
- OPENSSL_free(r);
+ free(r);
r = NULL;
}
if (ok)
totalnum = num + numblocks;
- wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
- wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
- wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */
- val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
+ wsize = malloc(totalnum * sizeof wsize[0]);
+ wNAF_len = malloc(totalnum * sizeof wNAF_len[0]);
+ wNAF = malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space for pivot */
+ val_sub = malloc(totalnum * sizeof val_sub[0]);
if (!wsize || !wNAF_len || !wNAF || !val_sub)
{
wNAF_len[i] = tmp_len;
wNAF[i + 1] = NULL;
- wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
+ wNAF[i] = malloc(wNAF_len[i]);
if (wNAF[i] == NULL)
{
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
- OPENSSL_free(tmp_wNAF);
+ free(tmp_wNAF);
goto err;
}
memcpy(wNAF[i], pp, wNAF_len[i]);
if (*tmp_points == NULL)
{
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
- OPENSSL_free(tmp_wNAF);
+ free(tmp_wNAF);
goto err;
}
val_sub[i] = tmp_points;
tmp_points += pre_points_per_block;
pp += blocksize;
}
- OPENSSL_free(tmp_wNAF);
+ free(tmp_wNAF);
}
}
}
/* All points we precompute now go into a single array 'val'.
* 'val_sub[i]' is a pointer to the subarray for the i-th point,
* or to a subarray of 'pre_comp->points' if we already have precomputation. */
- val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
+ val = malloc((num_val + 1) * sizeof val[0]);
if (val == NULL)
{
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
if (tmp != NULL)
EC_POINT_free(tmp);
if (wsize != NULL)
- OPENSSL_free(wsize);
+ free(wsize);
if (wNAF_len != NULL)
- OPENSSL_free(wNAF_len);
+ free(wNAF_len);
if (wNAF != NULL)
{
signed char **w;
for (w = wNAF; *w != NULL; w++)
- OPENSSL_free(*w);
+ free(*w);
- OPENSSL_free(wNAF);
+ free(wNAF);
}
if (val != NULL)
{
for (v = val; *v != NULL; v++)
EC_POINT_clear_free(*v);
- OPENSSL_free(val);
+ free(val);
}
if (val_sub != NULL)
{
- OPENSSL_free(val_sub);
+ free(val_sub);
}
return ret;
}
pre_points_per_block = (size_t)1 << (w - 1);
num = pre_points_per_block * numblocks; /* number of points to compute and store */
- points = OPENSSL_malloc(sizeof (EC_POINT*)*(num + 1));
+ points = malloc(sizeof (EC_POINT*)*(num + 1));
if (!points)
{
ECerr(EC_F_EC_WNAF_PRECOMPUTE_MULT, ERR_R_MALLOC_FAILURE);
for (p = points; *p != NULL; p++)
EC_POINT_free(*p);
- OPENSSL_free(points);
+ free(points);
}
if (tmp_point)
EC_POINT_free(tmp_point);
static int pkey_ec_init(EVP_PKEY_CTX *ctx)
{
EC_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(EC_PKEY_CTX));
+ dctx = malloc(sizeof(EC_PKEY_CTX));
if (!dctx)
return 0;
dctx->gen_group = NULL;
{
if (dctx->gen_group)
EC_GROUP_free(dctx->gen_group);
- OPENSSL_free(dctx);
+ free(dctx);
}
}
if (buf_len == 0)
return NULL;
- if ((buf = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buf = malloc(buf_len)) == NULL)
return NULL;
if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx))
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
ret = BN_bin2bn(buf, buf_len, ret);
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
EC_POINT *ret;
if ((buf_len = BN_num_bytes(bn)) == 0) return NULL;
- buf = OPENSSL_malloc(buf_len);
+ buf = malloc(buf_len);
if (buf == NULL)
return NULL;
if (!BN_bn2bin(bn, buf))
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
{
if ((ret = EC_POINT_new(group)) == NULL)
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
}
{
if (point == NULL)
EC_POINT_clear_free(ret);
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
static const char *HEX_DIGITS = "0123456789ABCDEF";
-/* the return value must be freed (using OPENSSL_free()) */
+/* the return value must be freed (using free()) */
char *EC_POINT_point2hex(const EC_GROUP *group,
const EC_POINT *point,
point_conversion_form_t form,
if (buf_len == 0)
return NULL;
- if ((buf = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buf = malloc(buf_len)) == NULL)
return NULL;
if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx))
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
- ret = (char *)OPENSSL_malloc(buf_len*2+2);
+ ret = (char *)malloc(buf_len*2+2);
if (ret == NULL)
{
- OPENSSL_free(buf);
+ free(buf);
return NULL;
}
p = ret;
}
*p='\0';
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
seed_len = EC_GROUP_get_seed_len(x);
buf_len += 10;
- if ((buffer = OPENSSL_malloc(buf_len)) == NULL)
+ if ((buffer = malloc(buf_len)) == NULL)
{
reason = ERR_R_MALLOC_FAILURE;
goto err;
if (ctx)
BN_CTX_free(ctx);
if (buffer != NULL)
- OPENSSL_free(buffer);
+ free(buffer);
return(ret);
}
static NISTP224_PRE_COMP *nistp224_pre_comp_new()
{
NISTP224_PRE_COMP *ret = NULL;
- ret = (NISTP224_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ ret = (NISTP224_PRE_COMP *) malloc(sizeof *ret);
if (!ret)
{
ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- OPENSSL_free(pre);
+ free(pre);
}
static void nistp224_pre_comp_clear_free(void *pre_)
return;
OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ free(pre);
}
/******************************************************************************/
* converting those into affine form is time well spent */
mixed = 1;
}
- secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
- pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
+ secrets = malloc(num_points * sizeof(felem_bytearray));
+ pre_comp = malloc(num_points * 17 * 3 * sizeof(felem));
if (mixed)
- tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
+ tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem));
if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL)))
{
ECerr(EC_F_EC_GFP_NISTP224_POINTS_MUL, ERR_R_MALLOC_FAILURE);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
if (secrets != NULL)
- OPENSSL_free(secrets);
+ free(secrets);
if (pre_comp != NULL)
- OPENSSL_free(pre_comp);
+ free(pre_comp);
if (tmp_felems != NULL)
- OPENSSL_free(tmp_felems);
+ free(tmp_felems);
return ret;
}
static NISTP256_PRE_COMP *nistp256_pre_comp_new()
{
NISTP256_PRE_COMP *ret = NULL;
- ret = (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ ret = (NISTP256_PRE_COMP *) malloc(sizeof *ret);
if (!ret)
{
ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- OPENSSL_free(pre);
+ free(pre);
}
static void nistp256_pre_comp_clear_free(void *pre_)
return;
OPENSSL_cleanse(pre, sizeof *pre);
- OPENSSL_free(pre);
+ free(pre);
}
/******************************************************************************/
* converting those into affine form is time well spent */
mixed = 1;
}
- secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
- pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem));
+ secrets = malloc(num_points * sizeof(felem_bytearray));
+ pre_comp = malloc(num_points * 17 * 3 * sizeof(smallfelem));
if (mixed)
- tmp_smallfelems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(smallfelem));
+ tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem));
if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL)))
{
ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
if (secrets != NULL)
- OPENSSL_free(secrets);
+ free(secrets);
if (pre_comp != NULL)
- OPENSSL_free(pre_comp);
+ free(pre_comp);
if (tmp_smallfelems != NULL)
- OPENSSL_free(tmp_smallfelems);
+ free(tmp_smallfelems);
return ret;
}
static NISTP521_PRE_COMP *nistp521_pre_comp_new()
{
NISTP521_PRE_COMP *ret = NULL;
- ret = (NISTP521_PRE_COMP *)OPENSSL_malloc(sizeof(NISTP521_PRE_COMP));
+ ret = (NISTP521_PRE_COMP *)malloc(sizeof(NISTP521_PRE_COMP));
if (!ret)
{
ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
if (i > 0)
return;
- OPENSSL_free(pre);
+ free(pre);
}
static void nistp521_pre_comp_clear_free(void *pre_)
return;
OPENSSL_cleanse(pre, sizeof(*pre));
- OPENSSL_free(pre);
+ free(pre);
}
/******************************************************************************/
* converting those into affine form is time well spent */
mixed = 1;
}
- secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray));
- pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(felem));
+ secrets = malloc(num_points * sizeof(felem_bytearray));
+ pre_comp = malloc(num_points * 17 * 3 * sizeof(felem));
if (mixed)
- tmp_felems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(felem));
+ tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem));
if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL)))
{
ECerr(EC_F_EC_GFP_NISTP521_POINTS_MUL, ERR_R_MALLOC_FAILURE);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
if (secrets != NULL)
- OPENSSL_free(secrets);
+ free(secrets);
if (pre_comp != NULL)
- OPENSSL_free(pre_comp);
+ free(pre_comp);
if (tmp_felems != NULL)
- OPENSSL_free(tmp_felems);
+ free(tmp_felems);
return ret;
}
* We need twice that. */
pow2 <<= 1;
- heap = OPENSSL_malloc(pow2 * sizeof heap[0]);
+ heap = malloc(pow2 * sizeof heap[0]);
if (heap == NULL) goto err;
/* The array is used as a binary tree, exactly as in heapsort:
if (heap[i] != NULL)
BN_clear_free(heap[i]);
}
- OPENSSL_free(heap);
+ free(heap);
}
return ret;
}
{
ECDH_DATA *ret;
- ret=(ECDH_DATA *)OPENSSL_malloc(sizeof(ECDH_DATA));
+ ret=(ECDH_DATA *)malloc(sizeof(ECDH_DATA));
if (ret == NULL)
{
ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
{
ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDH, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
#endif
OPENSSL_cleanse((void *)r, sizeof(ECDH_DATA));
- OPENSSL_free(r);
+ free(r);
}
ECDH_DATA *ecdh_check(EC_KEY *key)
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_INTERNAL_ERROR);
goto err;
}
- if ((buf = OPENSSL_malloc(buflen)) == NULL)
+ if ((buf = malloc(buflen)) == NULL)
{
ECDHerr(ECDH_F_ECDH_COMPUTE_KEY,ERR_R_MALLOC_FAILURE);
goto err;
if (tmp) EC_POINT_free(tmp);
if (ctx) BN_CTX_end(ctx);
if (ctx) BN_CTX_free(ctx);
- if (buf) OPENSSL_free(buf);
+ if (buf) free(buf);
return(ret);
}
{
ECDSA_DATA *ret;
- ret=(ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA));
+ ret=(ECDSA_DATA *)malloc(sizeof(ECDSA_DATA));
if (ret == NULL)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
#endif
OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA));
- OPENSSL_free(r);
+ free(r);
}
ECDSA_DATA *ecdsa_check(EC_KEY *key)
* structure. */
static int dynamic_ex_data_idx = -1;
-static void int_free_str(char *s) { OPENSSL_free(s); }
+static void int_free_str(char *s) { free(s); }
/* Because our ex_data element may or may not get allocated depending on whether
* a "first-use" occurs before the ENGINE is freed, we have a memory leak
* problem to solve. We can't declare a "new" handler for the ex_data as we
if(ctx->dynamic_dso)
DSO_free(ctx->dynamic_dso);
if(ctx->DYNAMIC_LIBNAME)
- OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME);
+ free((void*)ctx->DYNAMIC_LIBNAME);
if(ctx->engine_id)
- OPENSSL_free((void*)ctx->engine_id);
+ free((void*)ctx->engine_id);
if(ctx->dirs)
sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str);
- OPENSSL_free(ctx);
+ free(ctx);
}
}
static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
{
dynamic_data_ctx *c;
- c = OPENSSL_malloc(sizeof(dynamic_data_ctx));
+ c = malloc(sizeof(dynamic_data_ctx));
if(!c)
{
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
if(!c->dirs)
{
ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
- OPENSSL_free(c);
+ free(c);
return 0;
}
CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
/* If we lost the race to set the context, c is non-NULL and *ctx is the
* context of the thread that won. */
if(c)
- OPENSSL_free(c);
+ free(c);
return 1;
}
if(p && (strlen((const char *)p) < 1))
p = NULL;
if(ctx->DYNAMIC_LIBNAME)
- OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME);
+ free((void*)ctx->DYNAMIC_LIBNAME);
if(p)
ctx->DYNAMIC_LIBNAME = BUF_strdup(p);
else
if(p && (strlen((const char *)p) < 1))
p = NULL;
if(ctx->engine_id)
- OPENSSL_free((void*)ctx->engine_id);
+ free((void*)ctx->engine_id);
if(p)
ctx->engine_id = BUF_strdup(p);
else
if(DSO_load(ctx->dynamic_dso, merge, NULL, 0))
{
/* Found what we're looking for */
- OPENSSL_free(merge);
+ free(merge);
return 1;
}
- OPENSSL_free(merge);
+ free(merge);
}
return 0;
}
{
ENGINE *ret;
- ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE));
+ ret = (ENGINE *)malloc(sizeof(ENGINE));
if(ret == NULL)
{
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
if(e->destroy)
e->destroy(e);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data);
- OPENSSL_free(e);
+ free(e);
return 1;
}
}
static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
{
- ENGINE_CLEANUP_ITEM *item = OPENSSL_malloc(sizeof(
+ ENGINE_CLEANUP_ITEM *item = malloc(sizeof(
ENGINE_CLEANUP_ITEM));
if(!item) return NULL;
item->cb = cb;
static void engine_cleanup_cb_free(ENGINE_CLEANUP_ITEM *item)
{
(*(item->cb))();
- OPENSSL_free(item);
+ free(item);
}
void ENGINE_cleanup(void)
{
hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
if (!hptr) {
- hptr = OPENSSL_malloc(3*sizeof(E_RSAX_MOD_CTX));
+ hptr = malloc(3*sizeof(E_RSAX_MOD_CTX));
if (!hptr) return NULL;
hptr[2].type = hptr[1].type= hptr[0].type = 0;
RSA_set_ex_data(rsa, rsax_ex_data_idx, hptr);
E_RSAX_MOD_CTX *hptr = RSA_get_ex_data(rsa, rsax_ex_data_idx);
if(hptr)
{
- OPENSSL_free(hptr);
+ free(hptr);
RSA_set_ex_data(rsa, rsax_ex_data_idx, NULL);
}
if (rsa->_method_mod_n)
fnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);
if(!fnd)
{
- fnd = OPENSSL_malloc(sizeof(ENGINE_PILE));
+ fnd = malloc(sizeof(ENGINE_PILE));
if(!fnd) goto end;
fnd->uptodate = 1;
fnd->nid = *nids;
fnd->sk = sk_ENGINE_new_null();
if(!fnd->sk)
{
- OPENSSL_free(fnd);
+ free(fnd);
goto end;
}
fnd->funct = NULL;
sk_ENGINE_free(p->sk);
if(p->funct)
engine_unlocked_finish(p->funct, 0);
- OPENSSL_free(p);
+ free(p);
}
static IMPLEMENT_LHASH_DOALL_FN(int_cleanup_cb, ENGINE_PILE)
static void build_SYS_str_reasons(void)
{
- /* OPENSSL_malloc cannot be used here, use static storage instead */
+ /* malloc cannot be used here, use static storage instead */
static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
int i;
static int init = 1;
if (((p)->err_data[i] != NULL) && \
(p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
{ \
- OPENSSL_free((p)->err_data[i]); \
+ free((p)->err_data[i]); \
(p)->err_data[i]=NULL; \
} \
(p)->err_data_flags[i]=0; \
{
err_clear_data(s,i);
}
- OPENSSL_free(s);
+ free(s);
}
void ERR_load_ERR_strings(void)
/* ret == the error state, if NULL, make a new one */
if (ret == NULL)
{
- ret=(ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE));
+ ret=(ERR_STATE *)malloc(sizeof(ERR_STATE));
if (ret == NULL) return(&fallback);
CRYPTO_THREADID_cpy(&ret->tid, &tid);
ret->top=0;
char *str,*p,*a;
s=80;
- str=OPENSSL_malloc(s+1);
+ str=malloc(s+1);
if (str == NULL) return;
str[0]='\0';
if (n > s)
{
s=n+20;
- p=OPENSSL_realloc(str,s+1);
+ p=realloc(str,s+1);
if (p == NULL)
{
- OPENSSL_free(str);
+ free(str);
return;
}
else
{
BIO_B64_CTX *ctx;
- ctx=(BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX));
+ ctx=(BIO_B64_CTX *)malloc(sizeof(BIO_B64_CTX));
if (ctx == NULL) return(0);
ctx->buf_len=0;
static int b64_free(BIO *a)
{
if (a == NULL) return(0);
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
{
BIO_ENC_CTX *ctx;
- ctx=(BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX));
+ ctx=(BIO_ENC_CTX *)malloc(sizeof(BIO_ENC_CTX));
if (ctx == NULL) return(0);
EVP_CIPHER_CTX_init(&ctx->cipher);
b=(BIO_ENC_CTX *)a->ptr;
EVP_CIPHER_CTX_cleanup(&(b->cipher));
OPENSSL_cleanse(a->ptr,sizeof(BIO_ENC_CTX));
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
{
BIO_OK_CTX *ctx;
- ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
+ ctx=(BIO_OK_CTX *)malloc(sizeof(BIO_OK_CTX));
if (ctx == NULL) return(0);
ctx->buf_len=0;
if (a == NULL) return(0);
EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX));
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
EVP_MD_CTX *EVP_MD_CTX_create(void)
{
- EVP_MD_CTX *ctx=OPENSSL_malloc(sizeof *ctx);
+ EVP_MD_CTX *ctx=malloc(sizeof *ctx);
if (ctx)
EVP_MD_CTX_init(ctx);
if (ctx->digest != type)
{
if (ctx->digest && ctx->digest->ctx_size)
- OPENSSL_free(ctx->md_data);
+ free(ctx->md_data);
ctx->digest=type;
if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size)
{
ctx->update = type->update;
- ctx->md_data=OPENSSL_malloc(type->ctx_size);
+ ctx->md_data=malloc(type->ctx_size);
if (ctx->md_data == NULL)
{
EVPerr(EVP_F_EVP_DIGESTINIT_EX,
out->md_data = tmp_buf;
else
{
- out->md_data=OPENSSL_malloc(out->digest->ctx_size);
+ out->md_data=malloc(out->digest->ctx_size);
if (!out->md_data)
{
EVPerr(EVP_F_EVP_MD_CTX_COPY_EX,ERR_R_MALLOC_FAILURE);
if (ctx)
{
EVP_MD_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
}
&& !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE))
{
OPENSSL_cleanse(ctx->md_data,ctx->digest->ctx_size);
- OPENSSL_free(ctx->md_data);
+ free(ctx->md_data);
}
if (ctx->pctx)
EVP_PKEY_CTX_free(ctx->pctx);
EVP_AES_GCM_CTX *gctx = c->cipher_data;
OPENSSL_cleanse(&gctx->gcm, sizeof(gctx->gcm));
if (gctx->iv != c->iv)
- OPENSSL_free(gctx->iv);
+ free(gctx->iv);
return 1;
}
if ((arg > EVP_MAX_IV_LENGTH) && (arg > gctx->ivlen))
{
if (gctx->iv != c->iv)
- OPENSSL_free(gctx->iv);
- gctx->iv = OPENSSL_malloc(arg);
+ free(gctx->iv);
+ gctx->iv = malloc(arg);
if (!gctx->iv)
return 0;
}
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
{
- EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx);
+ EVP_CIPHER_CTX *ctx=malloc(sizeof *ctx);
if (ctx)
EVP_CIPHER_CTX_init(ctx);
return ctx;
ctx->cipher=cipher;
if (ctx->cipher->ctx_size)
{
- ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
+ ctx->cipher_data=malloc(ctx->cipher->ctx_size);
if (!ctx->cipher_data)
{
EVPerr(EVP_F_EVP_CIPHERINIT_EX, ERR_R_MALLOC_FAILURE);
if (ctx)
{
EVP_CIPHER_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
}
OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
}
if (c->cipher_data)
- OPENSSL_free(c->cipher_data);
+ free(c->cipher_data);
#ifndef OPENSSL_NO_ENGINE
if (c->engine)
/* The EVP_CIPHER we used belongs to an ENGINE, release the
if (in->cipher_data && in->cipher->ctx_size)
{
- out->cipher_data=OPENSSL_malloc(in->cipher->ctx_size);
+ out->cipher_data=malloc(in->cipher->ctx_size);
if (!out->cipher_data)
{
EVPerr(EVP_F_EVP_CIPHER_CTX_COPY,ERR_R_MALLOC_FAILURE);
EVP_PBE_CTL *pbe_tmp;
if (!pbe_algs)
pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
- if (!(pbe_tmp = (EVP_PBE_CTL*) OPENSSL_malloc (sizeof(EVP_PBE_CTL))))
+ if (!(pbe_tmp = (EVP_PBE_CTL*) malloc (sizeof(EVP_PBE_CTL))))
{
EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE,ERR_R_MALLOC_FAILURE);
return 0;
static void free_evp_pbe_ctl(EVP_PBE_CTL *pbe)
{
- OPENSSL_freeFunc(pbe);
+ free(pbe);
}
void EVP_PBE_cleanup(void)
{
EVP_PKEY *ret;
- ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
+ ret=(EVP_PKEY *)malloc(sizeof(EVP_PKEY));
if (ret == NULL)
{
EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
EVP_PKEY_free_it(x);
if (x->attributes)
sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
- OPENSSL_free(x);
+ free(x);
}
static void EVP_PKEY_free_it(EVP_PKEY *x)
}
size=RSA_size(priv->pkey.rsa);
- key=(unsigned char *)OPENSSL_malloc(size+2);
+ key=(unsigned char *)malloc(size+2);
if (key == NULL)
{
/* ERROR */
ret=1;
err:
if (key != NULL) OPENSSL_cleanse(key,size);
- OPENSSL_free(key);
+ free(key);
return(ret);
}
return NULL;
}
- ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
+ ret = malloc(sizeof(EVP_PKEY_CTX));
if (!ret)
{
#ifndef OPENSSL_NO_ENGINE
EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags)
{
EVP_PKEY_METHOD *pmeth;
- pmeth = OPENSSL_malloc(sizeof(EVP_PKEY_METHOD));
+ pmeth = malloc(sizeof(EVP_PKEY_METHOD));
if (!pmeth)
return NULL;
void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth)
{
if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC))
- OPENSSL_free(pmeth);
+ free(pmeth);
}
EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e)
return 0;
}
#endif
- rctx = OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
+ rctx = malloc(sizeof(EVP_PKEY_CTX));
if (!rctx)
return NULL;
* functional reference we held for this reason. */
ENGINE_finish(ctx->engine);
#endif
- OPENSSL_free(ctx);
+ free(ctx);
}
int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
static void
def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *funcs)
{
- OPENSSL_free(funcs);
+ free(funcs);
}
/* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from
{
EX_CLASS_ITEM *item = (EX_CLASS_ITEM *)a_void;
sk_CRYPTO_EX_DATA_FUNCS_pop_free(item->meth, def_cleanup_util_cb);
- OPENSSL_free(item);
+ free(item);
}
/* Return the EX_CLASS_ITEM from the "ex_data" hash table that corresponds to a
CRYPTO_w_lock(CRYPTO_LOCK_EX_DATA);
p = lh_EX_CLASS_ITEM_retrieve(ex_data, &d);
if (!p) {
- gen = OPENSSL_malloc(sizeof(EX_CLASS_ITEM));
+ gen = malloc(sizeof(EX_CLASS_ITEM));
if (gen) {
gen->class_index = class_index;
gen->meth_num = 0;
gen->meth = sk_CRYPTO_EX_DATA_FUNCS_new_null();
if (!gen->meth)
- OPENSSL_free(gen);
+ free(gen);
else {
/* Because we're inside the ex_data lock, the
* return value from the insert will be NULL */
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
int toret = -1;
- CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc(
+ CRYPTO_EX_DATA_FUNCS *a = (CRYPTO_EX_DATA_FUNCS *)malloc(
sizeof(CRYPTO_EX_DATA_FUNCS));
if (!a) {
CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE);
while (sk_CRYPTO_EX_DATA_FUNCS_num(item->meth) <= item->meth_num) {
if (!sk_CRYPTO_EX_DATA_FUNCS_push(item->meth, NULL)) {
CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE);
- OPENSSL_free(a);
+ free(a);
goto err;
}
}
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
if (mx > 0) {
- storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
+ storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
if (!storage)
goto skip;
for (i = 0; i < mx; i++)
}
}
if (storage)
- OPENSSL_free(storage);
+ free(storage);
return 1;
}
if (j < mx)
mx = j;
if (mx > 0) {
- storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
+ storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
if (!storage)
goto skip;
for (i = 0; i < mx; i++)
CRYPTO_set_ex_data(to, i, ptr);
}
if (storage)
- OPENSSL_free(storage);
+ free(storage);
return 1;
}
CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA);
mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth);
if (mx > 0) {
- storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
+ storage = malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*));
if (!storage)
goto skip;
for (i = 0; i < mx; i++)
}
}
if (storage)
- OPENSSL_free(storage);
+ free(storage);
if (ad->sk) {
sk_void_free(ad->sk);
ad->sk = NULL;
{
if (!*pder)
{
- *pder = OPENSSL_malloc(os->length);
+ *pder = malloc(os->length);
inc = 0;
}
else inc = 1;
static int pkey_hmac_init(EVP_PKEY_CTX *ctx)
{
HMAC_PKEY_CTX *hctx;
- hctx = OPENSSL_malloc(sizeof(HMAC_PKEY_CTX));
+ hctx = malloc(sizeof(HMAC_PKEY_CTX));
if (!hctx)
return 0;
hctx->md = NULL;
{
if (hctx->ktmp.length)
OPENSSL_cleanse(hctx->ktmp.data, hctx->ktmp.length);
- OPENSSL_free(hctx->ktmp.data);
+ free(hctx->ktmp.data);
hctx->ktmp.data = NULL;
}
- OPENSSL_free(hctx);
+ free(hctx);
}
static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
if (!key)
return 0;
r = pkey_hmac_ctrl(ctx, EVP_PKEY_CTRL_SET_MAC_KEY, keylen, key);
- OPENSSL_free(key);
+ free(key);
return r;
}
return -2;
fgets(buf,256,stdin);
if (buf[0] == '\0') break;
i=strlen(buf);
- p=OPENSSL_malloc(i+1);
+ p=malloc(i+1);
memcpy(p,buf,i+1);
lh_insert(conf,p);
}
_LHASH *ret;
int i;
- if ((ret=OPENSSL_malloc(sizeof(_LHASH))) == NULL)
+ if ((ret=malloc(sizeof(_LHASH))) == NULL)
goto err0;
- if ((ret->b=OPENSSL_malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
+ if ((ret->b=malloc(sizeof(LHASH_NODE *)*MIN_NODES)) == NULL)
goto err1;
for (i=0; i<MIN_NODES; i++)
ret->b[i]=NULL;
ret->error=0;
return(ret);
err1:
- OPENSSL_free(ret);
+ free(ret);
err0:
return(NULL);
}
while (n != NULL)
{
nn=n->next;
- OPENSSL_free(n);
+ free(n);
n=nn;
}
}
- OPENSSL_free(lh->b);
- OPENSSL_free(lh);
+ free(lh->b);
+ free(lh);
}
void *lh_insert(_LHASH *lh, void *data)
if (*rn == NULL)
{
- if ((nn=(LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL)
+ if ((nn=(LHASH_NODE *)malloc(sizeof(LHASH_NODE))) == NULL)
{
lh->error++;
return(NULL);
nn= *rn;
*rn=nn->next;
ret=nn->data;
- OPENSSL_free(nn);
+ free(nn);
lh->num_delete++;
}
if ((lh->p) >= lh->pmax)
{
j=(int)lh->num_alloc_nodes*2;
- n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
+ n=(LHASH_NODE **)realloc(lh->b,
(int)(sizeof(LHASH_NODE *)*j));
if (n == NULL)
{
lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
if (lh->p == 0)
{
- n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
+ n=(LHASH_NODE **)realloc(lh->b,
(unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
if (n == NULL)
{
{
GCM128_CONTEXT *ret;
- if ((ret = (GCM128_CONTEXT *)OPENSSL_malloc(sizeof(GCM128_CONTEXT))))
+ if ((ret = (GCM128_CONTEXT *)malloc(sizeof(GCM128_CONTEXT))))
CRYPTO_gcm128_init(ret,key,block);
return ret;
{
if (ctx) {
OPENSSL_cleanse(ctx,sizeof(*ctx));
- OPENSSL_free(ctx);
+ free(ctx);
}
}
for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
{
MemCheck_off();
- name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
+ name_funcs = malloc(sizeof(NAME_FUNCS));
MemCheck_on();
if (!name_funcs)
{
alias=type&OBJ_NAME_ALIAS;
type&= ~OBJ_NAME_ALIAS;
- onp=(OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME));
+ onp=(OBJ_NAME *)malloc(sizeof(OBJ_NAME));
if (onp == NULL)
{
/* ERROR */
sk_NAME_FUNCS_value(name_funcs_stack,
ret->type)->free_func(ret->name,ret->type,ret->data);
}
- OPENSSL_free(ret);
+ free(ret);
}
else
{
sk_NAME_FUNCS_value(name_funcs_stack,
ret->type)->free_func(ret->name,ret->type,ret->data);
}
- OPENSSL_free(ret);
+ free(ret);
return(1);
}
else
int n;
d.type=type;
- d.names=OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names);
+ d.names=malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names);
d.n=0;
OBJ_NAME_do_all(type,do_all_sorted_fn,&d);
for(n=0 ; n < d.n ; ++n)
fn(d.names[n],arg);
- OPENSSL_free((void *)d.names);
+ free((void *)d.names);
}
static int free_type;
static void name_funcs_free(NAME_FUNCS *ptr)
{
- OPENSSL_free(ptr);
+ free(ptr);
}
void OBJ_NAME_cleanup(int type)
{
if (--a->obj->nid == 0)
ASN1_OBJECT_free(a->obj);
- OPENSSL_free(a);
+ free(a);
}
static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ)
if (added == NULL)
if (!init_added()) return(0);
if ((o=OBJ_dup(obj)) == NULL) goto err;
- if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_NID]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
if ((o->length != 0) && (obj->data != NULL))
- if (!(ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_DATA]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
if (o->sn != NULL)
- if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_SNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
if (o->ln != NULL)
- if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err2;
+ if (!(ao[ADDED_LNAME]=(ADDED_OBJ *)malloc(sizeof(ADDED_OBJ)))) goto err2;
for (i=ADDED_DATA; i<=ADDED_NID; i++)
{
aop=lh_ADDED_OBJ_insert(added,ao[i]);
/* memory leak, buit should not normally matter */
if (aop != NULL)
- OPENSSL_free(aop);
+ free(aop);
}
}
o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
OBJerr(OBJ_F_OBJ_ADD_OBJECT,ERR_R_MALLOC_FAILURE);
err:
for (i=ADDED_DATA; i<=ADDED_NID; i++)
- if (ao[i] != NULL) OPENSSL_free(ao[i]);
- if (o != NULL) OPENSSL_free(o);
+ if (ao[i] != NULL) free(ao[i]);
+ if (o != NULL) free(o);
return(NID_undef);
}
/* Work out total size */
j = ASN1_object_size(0,i,V_ASN1_OBJECT);
- if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL;
+ if((buf=(unsigned char *)malloc(j)) == NULL) return NULL;
p = buf;
/* Write out tag+length */
cp=buf;
op=d2i_ASN1_OBJECT(NULL,&cp,j);
- OPENSSL_free(buf);
+ free(buf);
return op;
}
}
n++;
n += i;
- OPENSSL_free(bndec);
+ free(bndec);
}
else
{
i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
if (i <= 0) return(0);
- if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL)
+ if ((buf=(unsigned char *)malloc(i)) == NULL)
{
OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE);
return(0);
ok=OBJ_add_object(op);
err:
ASN1_OBJECT_free(op);
- OPENSSL_free(buf);
+ free(buf);
return(ok);
}
OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB);
return(NULL);
}
- data=OPENSSL_malloc(o->length);
+ data=malloc(o->length);
if (data == NULL)
goto err;
if (o->data != NULL)
if (o->ln != NULL)
{
i=strlen(o->ln)+1;
- ln=OPENSSL_malloc(i);
+ ln=malloc(i);
if (ln == NULL) goto err;
memcpy(ln,o->ln,i);
r->ln=ln;
if (o->sn != NULL)
{
i=strlen(o->sn)+1;
- sn=OPENSSL_malloc(i);
+ sn=malloc(i);
if (sn == NULL) goto err;
memcpy(sn,o->sn,i);
r->sn=sn;
return(r);
err:
OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE);
- if (ln != NULL) OPENSSL_free(ln);
- if (sn != NULL) OPENSSL_free(sn);
- if (data != NULL) OPENSSL_free(data);
- if (r != NULL) OPENSSL_free(r);
+ if (ln != NULL) free(ln);
+ if (sn != NULL) free(sn);
+ if (data != NULL) free(data);
+ if (r != NULL) free(r);
return(NULL);
}
sigx_app = sk_nid_triple_new(sigx_cmp);
if (!sigx_app)
return 0;
- ntr = OPENSSL_malloc(sizeof(int) * 3);
+ ntr = malloc(sizeof(int) * 3);
if (!ntr)
return 0;
ntr->sign_id = signid;
if (!sk_nid_triple_push(sig_app, ntr))
{
- OPENSSL_free(ntr);
+ free(ntr);
return 0;
}
static void sid_free(nid_triple *tt)
{
- OPENSSL_free(tt);
+ free(tt);
}
void OBJ_sigid_free(void)
if (data)
{
if ((i=i2d(data,NULL)) <= 0) goto err;
- if (!(b=p=OPENSSL_malloc((unsigned int)i)))
+ if (!(b=p=malloc((unsigned int)i)))
goto err;
if (i2d(data, &p) <= 0) goto err;
}
V_ASN1_SEQUENCE,
V_ASN1_UNIVERSAL,
IS_SEQUENCE))<=0) goto err;
- if (!(b=p=OPENSSL_malloc((unsigned int)i)))
+ if (!(b=p=malloc((unsigned int)i)))
goto err;
if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk,&p,(I2D_OF(ASN1_OBJECT))i2d,
V_ASN1_SEQUENCE,
}
if (!s && !(s = ASN1_STRING_new())) goto err;
if (!(ASN1_STRING_set(s, b, i))) goto err;
- OPENSSL_free(b);
+ free(b);
return s;
err:
- if (b) OPENSSL_free(b);
+ if (b) free(b);
return NULL;
}
#endif
* it relies on library internals.
*/
os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
- os.data = OPENSSL_malloc(os.length);
+ os.data = malloc(os.length);
if (os.data == NULL)
goto err;
tmpval = os.data;
ret = 1;
err:
if (os.data)
- OPENSSL_free(os.data);
+ free(os.data);
return ret;
}
if (rctx->mem)
BIO_free(rctx->mem);
if (rctx->iobuf)
- OPENSSL_free(rctx->iobuf);
- OPENSSL_free(rctx);
+ free(rctx->iobuf);
+ free(rctx);
}
int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req)
static const char post_hdr[] = "POST %s HTTP/1.0\r\n";
OCSP_REQ_CTX *rctx;
- rctx = OPENSSL_malloc(sizeof(OCSP_REQ_CTX));
+ rctx = malloc(sizeof(OCSP_REQ_CTX));
rctx->state = OHS_ERROR;
rctx->mem = BIO_new(BIO_s_mem());
rctx->io = io;
rctx->iobuflen = maxline;
else
rctx->iobuflen = OCSP_MAX_LINE_LEN;
- rctx->iobuf = OPENSSL_malloc(rctx->iobuflen);
+ rctx->iobuf = malloc(rctx->iobuflen);
if (!rctx->iobuf)
return 0;
if (!path)
if (!*phost) goto mem_err;
- OPENSSL_free(buf);
+ free(buf);
return 1;
err:
- if (buf) OPENSSL_free(buf);
- if (*ppath) OPENSSL_free(*ppath);
- if (*pport) OPENSSL_free(*pport);
- if (*phost) OPENSSL_free(*phost);
+ if (buf) free(buf);
+ if (*ppath) free(*ppath);
+ if (*pport) free(*pport);
+ if (*phost) free(*phost);
return 0;
}
else {
/* unknown */
}
- if (name != NULL) OPENSSL_free(name);
- if (header != NULL) OPENSSL_free(header);
- if (data != NULL) OPENSSL_free(data);
+ if (name != NULL) free(name);
+ if (header != NULL) free(header);
+ if (data != NULL) free(data);
name=NULL;
header=NULL;
data=NULL;
ret=NULL;
}
- if (name != NULL) OPENSSL_free(name);
- if (header != NULL) OPENSSL_free(header);
- if (data != NULL) OPENSSL_free(data);
+ if (name != NULL) free(name);
+ if (header != NULL) free(header);
+ if (data != NULL) free(data);
return(ret);
}
return 0;
}
if(check_pem(nm, name)) break;
- OPENSSL_free(nm);
- OPENSSL_free(header);
- OPENSSL_free(data);
+ free(nm);
+ free(header);
+ free(data);
}
if (!PEM_get_EVP_CIPHER_INFO(header,&cipher)) goto err;
if (!PEM_do_header(&cipher,data,&len,cb,u)) goto err;
ret = 1;
err:
- if (!ret || !pnm) OPENSSL_free(nm);
- OPENSSL_free(header);
- if (!ret) OPENSSL_free(data);
+ if (!ret || !pnm) free(nm);
+ free(header);
+ if (!ret) free(data);
return ret;
}
}
/* dzise + 8 bytes are needed */
/* actually it needs the cipher block size extra... */
- data=(unsigned char *)OPENSSL_malloc((unsigned int)dsize+20);
+ data=(unsigned char *)malloc((unsigned int)dsize+20);
if (data == NULL)
{
PEMerr(PEM_F_PEM_ASN1_WRITE_BIO,ERR_R_MALLOC_FAILURE);
if (data != NULL)
{
OPENSSL_cleanse(data,(unsigned int)dsize);
- OPENSSL_free(data);
+ free(data);
}
return(ret);
}
goto err;
}
- buf = OPENSSL_malloc(PEM_BUFSIZE*8);
+ buf = malloc(PEM_BUFSIZE*8);
if (buf == NULL)
{
reason=ERR_R_MALLOC_FAILURE;
EVP_EncodeFinal(&ctx,buf,&outl);
if ((outl > 0) && (BIO_write(bp,(char *)buf,outl) != outl)) goto err;
OPENSSL_cleanse(buf, PEM_BUFSIZE*8);
- OPENSSL_free(buf);
+ free(buf);
buf = NULL;
if ( (BIO_write(bp,"-----END ",9) != 9) ||
(BIO_write(bp,name,nlen) != nlen) ||
err:
if (buf) {
OPENSSL_cleanse(buf, PEM_BUFSIZE*8);
- OPENSSL_free(buf);
+ free(buf);
}
PEMerr(PEM_F_PEM_WRITE_BIO,reason);
return(0);
*header=headerB->data;
*data=(unsigned char *)dataB->data;
*len=bl;
- OPENSSL_free(nameB);
- OPENSSL_free(headerB);
- OPENSSL_free(dataB);
+ free(nameB);
+ free(headerB);
+ free(dataB);
return(1);
err:
BUF_MEM_free(nameB);
ret=d2i(x,&p,len);
if (ret == NULL)
PEMerr(PEM_F_PEM_ASN1_READ_BIO,ERR_R_ASN1_LIB);
- OPENSSL_free(data);
+ free(data);
return(ret);
}
if (ret == NULL)
PEMerr(PEM_F_PEM_READ_BIO_PRIVATEKEY,ERR_R_ASN1_LIB);
err:
- OPENSSL_free(nm);
+ free(nm);
OPENSSL_cleanse(data, len);
- OPENSSL_free(data);
+ free(data);
return(ret);
}
err:
if (ret == NULL)
PEMerr(PEM_F_PEM_READ_BIO_PARAMETERS,ERR_R_ASN1_LIB);
- OPENSSL_free(nm);
- OPENSSL_free(data);
+ free(nm);
+ free(data);
return(ret);
}
j=RSA_size(pubk[i]->pkey.rsa);
if (j > max) max=j;
}
- s=(char *)OPENSSL_malloc(max*2);
+ s=(char *)malloc(max*2);
if (s == NULL)
{
PEMerr(PEM_F_PEM_SEALINIT,ERR_R_MALLOC_FAILURE);
ret=npubk;
err:
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH);
return(ret);
}
}
i=RSA_size(priv->pkey.rsa);
if (i < 100) i=100;
- s=(unsigned char *)OPENSSL_malloc(i*2);
+ s=(unsigned char *)malloc(i*2);
if (s == NULL)
{
PEMerr(PEM_F_PEM_SEALFINAL,ERR_R_MALLOC_FAILURE);
err:
EVP_MD_CTX_cleanup(&ctx->md);
EVP_CIPHER_CTX_cleanup(&ctx->cipher);
- if (s != NULL) OPENSSL_free(s);
+ if (s != NULL) free(s);
return(ret);
}
#else /* !OPENSSL_NO_RSA */
int i,ret=0;
unsigned int m_len;
- m=(unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey)+2);
+ m=(unsigned char *)malloc(EVP_PKEY_size(pkey)+2);
if (m == NULL)
{
PEMerr(PEM_F_PEM_SIGNFINAL,ERR_R_MALLOC_FAILURE);
ret=1;
err:
/* ctx has been zeroed by EVP_SignFinal() */
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
unsigned char *tmpbuf, *q;
unsigned int i;
p = *in + nbyte - 1;
- tmpbuf = OPENSSL_malloc(nbyte);
+ tmpbuf = malloc(nbyte);
if (!tmpbuf)
return 0;
q = tmpbuf;
for (i = 0; i < nbyte; i++)
*q++ = *p--;
*r = BN_bin2bn(tmpbuf, nbyte, NULL);
- OPENSSL_free(tmpbuf);
+ free(tmpbuf);
if (*r)
{
*in += nbyte;
return NULL;
length = blob_length(bitlen, isdss, ispub);
- buf = OPENSSL_malloc(length);
+ buf = malloc(length);
if (!buf)
{
PEMerr(PEM_F_DO_B2I_BIO, ERR_R_MALLOC_FAILURE);
err:
if (buf)
- OPENSSL_free(buf);
+ free(buf);
return ret;
}
p = *out;
else
{
- p = OPENSSL_malloc(outlen);
+ p = malloc(outlen);
if (!p)
return -1;
*out = p;
if (outlen < 0)
return -1;
wrlen = BIO_write(out, tmp, outlen);
- OPENSSL_free(tmp);
+ free(tmp);
if (wrlen == outlen)
return outlen;
return -1;
PEMerr(PEM_F_DO_PVK_BODY,PEM_R_BAD_PASSWORD_READ);
return NULL;
}
- enctmp = OPENSSL_malloc(keylen + 8);
+ enctmp = malloc(keylen + 8);
if (!enctmp)
{
PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE);
err:
EVP_CIPHER_CTX_cleanup(&cctx);
if (enctmp && saltlen)
- OPENSSL_free(enctmp);
+ free(enctmp);
return ret;
}
if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen))
return 0;
buflen = (int) keylen + saltlen;
- buf = OPENSSL_malloc(buflen);
+ buf = malloc(buflen);
if (!buf)
{
PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE);
if (buf)
{
OPENSSL_cleanse(buf, buflen);
- OPENSSL_free(buf);
+ free(buf);
}
return ret;
}
p = *out;
else
{
- p = OPENSSL_malloc(outlen);
+ p = malloc(outlen);
if (!p)
{
PEMerr(PEM_F_I2B_PVK,ERR_R_MALLOC_FAILURE);
if (outlen < 0)
return -1;
wrlen = BIO_write(out, tmp, outlen);
- OPENSSL_free(tmp);
+ free(tmp);
if (wrlen == outlen)
{
PEMerr(PEM_F_I2B_PVK_BIO, PEM_R_BIO_WRITE_FAILURE);
/* Encrypt/Decrypt a buffer based on password and algor, result in a
- * OPENSSL_malloc'ed buffer
+ * malloc'ed buffer
*/
unsigned char * PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
return NULL;
}
- if(!(out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) {
+ if(!(out = malloc(inlen + EVP_CIPHER_CTX_block_size(&ctx)))) {
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_MALLOC_FAILURE);
goto err;
}
if (!EVP_CipherUpdate(&ctx, out, &i, in, inlen))
{
- OPENSSL_free(out);
+ free(out);
out = NULL;
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,ERR_R_EVP_LIB);
goto err;
outlen = i;
if(!EVP_CipherFinal_ex(&ctx, out + i, &i)) {
- OPENSSL_free(out);
+ free(out);
out = NULL;
PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,PKCS12_R_PKCS12_CIPHERFINAL_ERROR);
goto err;
ret = ASN1_item_d2i(NULL, &p, outlen, it);
if (zbuf) OPENSSL_cleanse(out, outlen);
if(!ret) PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I,PKCS12_R_DECODE_ERROR);
- OPENSSL_free(out);
+ free(out);
return ret;
}
if (!PKCS12_pbe_crypt(algor, pass, passlen, in, inlen, &oct->data,
&oct->length, 1)) {
PKCS12err(PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT,PKCS12_R_ENCRYPT_ERROR);
- OPENSSL_free(in);
+ free(in);
return NULL;
}
if (zbuf) OPENSSL_cleanse(in, inlen);
- OPENSSL_free(in);
+ free(in);
return oct;
}
return 0;
if(unipass) {
OPENSSL_cleanse(unipass, uniplen); /* Clear password from memory */
- OPENSSL_free(unipass);
+ free(unipass);
}
return ret;
}
u = EVP_MD_size (md_type);
if (u < 0)
return 0;
- D = OPENSSL_malloc (v);
- Ai = OPENSSL_malloc (u);
- B = OPENSSL_malloc (v + 1);
+ D = malloc (v);
+ Ai = malloc (u);
+ B = malloc (v + 1);
Slen = v * ((saltlen+v-1)/v);
if(passlen) Plen = v * ((passlen+v-1)/v);
else Plen = 0;
Ilen = Slen + Plen;
- I = OPENSSL_malloc (Ilen);
+ I = malloc (Ilen);
Ij = BN_new();
Bpl1 = BN_new();
if (!D || !Ai || !B || !I || !Ij || !Bpl1)
PKCS12err(PKCS12_F_PKCS12_KEY_GEN_UNI,ERR_R_MALLOC_FAILURE);
end:
- OPENSSL_free (Ai);
- OPENSSL_free (B);
- OPENSSL_free (D);
- OPENSSL_free (I);
+ free (Ai);
+ free (B);
+ free (D);
+ free (I);
BN_free (Ij);
BN_free (Bpl1);
EVP_MD_CTX_cleanup(&ctx);
len = ASN1_STRING_to_UTF8(&data, fname);
if(len > 0) {
r = X509_alias_set1(x509, data, len);
- OPENSSL_free(data);
+ free(data);
if (!r)
{
X509_free(x509);
}
if (!saltlen) saltlen = PKCS12_SALT_LEN;
p12->mac->salt->length = saltlen;
- if (!(p12->mac->salt->data = OPENSSL_malloc (saltlen))) {
+ if (!(p12->mac->salt->data = malloc (saltlen))) {
PKCS12err(PKCS12_F_PKCS12_SETUP_MAC, ERR_R_MALLOC_FAILURE);
return 0;
}
unsigned char *unitmp;
if (asclen == -1) asclen = strlen(asc);
ulen = asclen*2 + 2;
- if (!(unitmp = OPENSSL_malloc(ulen))) return NULL;
+ if (!(unitmp = malloc(ulen))) return NULL;
for (i = 0; i < ulen - 2; i+=2) {
unitmp[i] = 0;
unitmp[i + 1] = asc[i>>1];
/* If no terminating zero allow for one */
if (!unilen || uni[unilen - 1]) asclen++;
uni++;
- if (!(asctmp = OPENSSL_malloc(asclen))) return NULL;
+ if (!(asctmp = malloc(asclen))) return NULL;
for (i = 0; i < unilen; i+=2) asctmp[i>>1] = uni[i];
asctmp[asclen - 1] = 0;
return asctmp;
{
BIO_BER_CTX *ctx;
- ctx=(BIO_BER_CTX *)OPENSSL_malloc(sizeof(BIO_BER_CTX));
+ ctx=(BIO_BER_CTX *)malloc(sizeof(BIO_BER_CTX));
if (ctx == NULL) return(0);
memset((char *)ctx,0,sizeof(BIO_BER_CTX));
if (a == NULL) return(0);
b=(BIO_BER_CTX *)a->ptr;
OPENSSL_cleanse(a->ptr,sizeof(BIO_BER_CTX));
- OPENSSL_free(a->ptr);
+ free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
if (EVP_PKEY_encrypt(pctx, NULL, &eklen, key, keylen) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
ri->enc_key->data, ri->enc_key->length) <= 0)
goto err;
- ek = OPENSSL_malloc(eklen);
+ ek = malloc(eklen);
if (ek == NULL)
{
if (*pek)
{
OPENSSL_cleanse(*pek, *peklen);
- OPENSSL_free(*pek);
+ free(*pek);
}
*pek = ek;
if (pctx)
EVP_PKEY_CTX_free(pctx);
if (!ret && ek)
- OPENSSL_free(ek);
+ free(ek);
return ret;
}
goto err;
/* Generate random key as MMA defence */
tkeylen = EVP_CIPHER_CTX_key_length(evp_ctx);
- tkey = OPENSSL_malloc(tkeylen);
+ tkey = malloc(tkeylen);
if (!tkey)
goto err;
if (EVP_CIPHER_CTX_rand_key(evp_ctx, tkey) <= 0)
{
/* Use random key as MMA defence */
OPENSSL_cleanse(ek, eklen);
- OPENSSL_free(ek);
+ free(ek);
ek = tkey;
eklen = tkeylen;
tkey = NULL;
if (ek)
{
OPENSSL_cleanse(ek,eklen);
- OPENSSL_free(ek);
+ free(ek);
ek = NULL;
}
if (tkey)
{
OPENSSL_cleanse(tkey,tkeylen);
- OPENSSL_free(tkey);
+ free(tkey);
tkey = NULL;
}
if (ek)
{
OPENSSL_cleanse(ek,eklen);
- OPENSSL_free(ek);
+ free(ek);
}
if (tkey)
{
OPENSSL_cleanse(tkey,tkeylen);
- OPENSSL_free(tkey);
+ free(tkey);
}
if (out != NULL) BIO_free_all(out);
if (btmp != NULL) BIO_free_all(btmp);
unsigned char *abuf = NULL;
unsigned int abuflen;
abuflen = EVP_PKEY_size(si->pkey);
- abuf = OPENSSL_malloc(abuflen);
+ abuf = malloc(abuflen);
if (!abuf)
goto err;
goto err;
if (EVP_DigestSignUpdate(&mctx,abuf,alen) <= 0)
goto err;
- OPENSSL_free(abuf);
+ free(abuf);
if (EVP_DigestSignFinal(&mctx, NULL, &siglen) <= 0)
goto err;
- abuf = OPENSSL_malloc(siglen);
+ abuf = malloc(siglen);
if(!abuf)
goto err;
if (EVP_DigestSignFinal(&mctx, abuf, &siglen) <= 0)
err:
if (abuf)
- OPENSSL_free(abuf);
+ free(abuf);
EVP_MD_CTX_cleanup(&mctx);
return 0;
if (!EVP_VerifyUpdate(&mdc_tmp, abuf, alen))
goto err;
- OPENSSL_free(abuf);
+ free(abuf);
}
os=si->enc_digest;
pitem *
pitem_new(unsigned char *prio64be, void *data)
{
- pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem));
+ pitem *item = (pitem *) malloc(sizeof(pitem));
if (item == NULL) return NULL;
memcpy(item->priority,prio64be,sizeof(item->priority));
{
if (item == NULL) return;
- OPENSSL_free(item);
+ free(item);
}
pqueue_s *
pqueue_new()
{
- pqueue_s *pq = (pqueue_s *) OPENSSL_malloc(sizeof(pqueue_s));
+ pqueue_s *pq = (pqueue_s *) malloc(sizeof(pqueue_s));
if (pq == NULL) return NULL;
memset(pq, 0x00, sizeof(pqueue_s));
{
if (pq == NULL) return;
- OPENSSL_free(pq);
+ free(pq);
}
pitem *
V_ASN1_NULL, NULL, penc, penclen))
return 1;
- OPENSSL_free(penc);
+ free(penc);
return 0;
}
update_buflen(x->iqmp, &buf_len);
}
- m=(unsigned char *)OPENSSL_malloc(buf_len+10);
+ m=(unsigned char *)malloc(buf_len+10);
if (m == NULL)
{
RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE);
}
ret=1;
err:
- if (m != NULL) OPENSSL_free(m);
+ if (m != NULL) free(m);
return(ret);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num=BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if (!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num = BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if(!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num = BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if(!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
f = BN_CTX_get(ctx);
ret = BN_CTX_get(ctx);
num=BN_num_bytes(rsa->n);
- buf = OPENSSL_malloc(num);
+ buf = malloc(num);
if(!f || !ret || !buf)
{
RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,ERR_R_MALLOC_FAILURE);
if (buf != NULL)
{
OPENSSL_cleanse(buf,num);
- OPENSSL_free(buf);
+ free(buf);
}
return(r);
}
{
RSA *ret;
- ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
+ ret=(RSA *)malloc(sizeof(RSA));
if (ret == NULL)
{
RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (!ENGINE_init(engine))
{
RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
ret->engine = engine;
RSAerr(RSA_F_RSA_NEW_METHOD,
ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
}
if (ret->engine)
ENGINE_finish(ret->engine);
#endif
- OPENSSL_free(ret);
+ free(ret);
return(NULL);
}
ENGINE_finish(ret->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data);
- OPENSSL_free(ret);
+ free(ret);
ret=NULL;
}
return(ret);
if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding);
if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);
- OPENSSL_free(r);
+ free(r);
}
int RSA_up_ref(RSA *r)
20);
#endif
- dbmask = OPENSSL_malloc(emlen - SHA_DIGEST_LENGTH);
+ dbmask = malloc(emlen - SHA_DIGEST_LENGTH);
if (dbmask == NULL)
{
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
for (i = 0; i < SHA_DIGEST_LENGTH; i++)
seed[i] ^= seedmask[i];
- OPENSSL_free(dbmask);
+ free(dbmask);
return 1;
}
}
dblen = num - SHA_DIGEST_LENGTH;
- db = OPENSSL_malloc(dblen + num);
+ db = malloc(dblen + num);
if (db == NULL)
{
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
memcpy(to, db + i, mlen);
}
}
- OPENSSL_free(db);
+ free(db);
return mlen;
decoding_err:
/* to avoid chosen ciphertext attacks, the error message should not reveal
* which kind of decoding error happened */
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR);
- if (db != NULL) OPENSSL_free(db);
+ if (db != NULL) free(db);
return -1;
}
static int pkey_rsa_init(EVP_PKEY_CTX *ctx)
{
RSA_PKEY_CTX *rctx;
- rctx = OPENSSL_malloc(sizeof(RSA_PKEY_CTX));
+ rctx = malloc(sizeof(RSA_PKEY_CTX));
if (!rctx)
return 0;
rctx->nbits = 1024;
{
if (ctx->tbuf)
return 1;
- ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey));
+ ctx->tbuf = malloc(EVP_PKEY_size(pk->pkey));
if (!ctx->tbuf)
return 0;
return 1;
if (rctx->pub_exp)
BN_free(rctx->pub_exp);
if (rctx->tbuf)
- OPENSSL_free(rctx->tbuf);
- OPENSSL_free(rctx);
+ free(rctx->tbuf);
+ free(rctx);
}
}
static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
}
maskedDBLen = emLen - hLen - 1;
H = EM + maskedDBLen;
- DB = OPENSSL_malloc(maskedDBLen);
+ DB = malloc(maskedDBLen);
if (!DB)
{
RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE);
err:
if (DB)
- OPENSSL_free(DB);
+ free(DB);
EVP_MD_CTX_cleanup(&ctx);
return ret;
}
if (sLen > 0)
{
- salt = OPENSSL_malloc(sLen);
+ salt = malloc(sLen);
if (!salt)
{
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,ERR_R_MALLOC_FAILURE);
err:
if (salt)
- OPENSSL_free(salt);
+ free(salt);
return ret;
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return(0);
}
- s=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
+ s=(unsigned char *)malloc((unsigned int)j+1);
if (s == NULL)
{
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
*siglen=i;
OPENSSL_cleanse(s,(unsigned int)j+1);
- OPENSSL_free(s);
+ free(s);
return(ret);
}
return(0);
}
- s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
+ s=(unsigned char *)malloc((unsigned int)siglen);
if (s == NULL)
{
RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
if (s != NULL)
{
OPENSSL_cleanse(s,(unsigned int)siglen);
- OPENSSL_free(s);
+ free(s);
}
return(ret);
}
return(0);
}
if(type != NID_md5_sha1) {
- tmps=(unsigned char *)OPENSSL_malloc((unsigned int)j+1);
+ tmps=(unsigned char *)malloc((unsigned int)j+1);
if (tmps == NULL)
{
RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE);
if(type != NID_md5_sha1) {
OPENSSL_cleanse(tmps,(unsigned int)j+1);
- OPENSSL_free(tmps);
+ free(tmps);
}
return(ret);
}
return 1;
}
- s=(unsigned char *)OPENSSL_malloc((unsigned int)siglen);
+ s=(unsigned char *)malloc((unsigned int)siglen);
if (s == NULL)
{
RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
if (s != NULL)
{
OPENSSL_cleanse(s,(unsigned int)siglen);
- OPENSSL_free(s);
+ free(s);
}
return(ret);
}
int longg ;
int longN = BN_num_bytes(N);
- if ((tmp = OPENSSL_malloc(longN)) == NULL)
+ if ((tmp = malloc(longN)) == NULL)
return NULL;
BN_bn2bin(N,tmp) ;
/* use the zeros behind to pad on left */
EVP_DigestUpdate(&ctxt, tmp + longg, longN-longg);
EVP_DigestUpdate(&ctxt, tmp, longg);
- OPENSSL_free(tmp);
+ free(tmp);
EVP_DigestFinal_ex(&ctxt, digest, NULL);
EVP_MD_CTX_cleanup(&ctxt);
longN= BN_num_bytes(N);
- if ((cAB = OPENSSL_malloc(2*longN)) == NULL)
+ if ((cAB = malloc(2*longN)) == NULL)
return NULL;
memset(cAB, 0, longN);
EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(A,cAB+longN), longN);
EVP_DigestUpdate(&ctxt, cAB + BN_bn2bin(B,cAB+longN), longN);
- OPENSSL_free(cAB);
+ free(cAB);
EVP_DigestFinal_ex(&ctxt, cu, NULL);
EVP_MD_CTX_cleanup(&ctxt);
(pass == NULL))
return NULL;
- if ((cs = OPENSSL_malloc(BN_num_bytes(s))) == NULL)
+ if ((cs = malloc(BN_num_bytes(s))) == NULL)
return NULL;
EVP_MD_CTX_init(&ctxt);
EVP_DigestInit_ex(&ctxt, EVP_sha1(), NULL);
BN_bn2bin(s,cs);
EVP_DigestUpdate(&ctxt, cs, BN_num_bytes(s));
- OPENSSL_free(cs);
+ free(cs);
EVP_DigestUpdate(&ctxt, dig, sizeof(dig));
EVP_DigestFinal_ex(&ctxt, dig, NULL);
EVP_MD_CTX_cleanup(&ctxt);
return;
BN_free(user_pwd->s);
BN_clear_free(user_pwd->v);
- OPENSSL_free(user_pwd->id);
- OPENSSL_free(user_pwd->info);
- OPENSSL_free(user_pwd);
+ free(user_pwd->id);
+ free(user_pwd->info);
+ free(user_pwd);
}
static SRP_user_pwd *SRP_user_pwd_new()
{
- SRP_user_pwd *ret = OPENSSL_malloc(sizeof(SRP_user_pwd));
+ SRP_user_pwd *ret = malloc(sizeof(SRP_user_pwd));
if (ret == NULL)
return NULL;
ret->N = NULL;
SRP_VBASE *SRP_VBASE_new(char *seed_key)
{
- SRP_VBASE *vb = (SRP_VBASE *) OPENSSL_malloc(sizeof(SRP_VBASE));
+ SRP_VBASE *vb = (SRP_VBASE *) malloc(sizeof(SRP_VBASE));
if (vb == NULL)
return NULL;
if (!(vb->users_pwd = sk_SRP_user_pwd_new_null()) ||
!(vb->gN_cache = sk_SRP_gN_cache_new_null()))
{
- OPENSSL_free(vb);
+ free(vb);
return NULL;
}
vb->default_g = NULL;
{
sk_SRP_user_pwd_free(vb->users_pwd);
sk_SRP_gN_cache_free(vb->gN_cache);
- OPENSSL_free(vb);
+ free(vb);
return NULL;
}
return vb;
{
sk_SRP_user_pwd_pop_free(vb->users_pwd,SRP_user_pwd_free);
sk_SRP_gN_cache_free(vb->gN_cache);
- OPENSSL_free(vb->seed_key);
- OPENSSL_free(vb);
+ free(vb->seed_key);
+ free(vb);
return 0;
}
unsigned char tmp[MAX_LEN];
int len;
- SRP_gN_cache *newgN = (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache));
+ SRP_gN_cache *newgN = (SRP_gN_cache *)malloc(sizeof(SRP_gN_cache));
if (newgN == NULL)
return NULL;
if ((newgN->bn = BN_bin2bn(tmp, len, NULL)))
return newgN;
- OPENSSL_free(newgN->b64_bn);
+ free(newgN->b64_bn);
err:
- OPENSSL_free(newgN);
+ free(newgN);
return NULL;
}
{
if (gN_cache == NULL)
return;
- OPENSSL_free(gN_cache->b64_bn);
+ free(gN_cache->b64_bn);
BN_free(gN_cache->bn);
- OPENSSL_free(gN_cache);
+ free(gN_cache);
}
static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
{
/*we add this couple in the internal Stack */
- if ((gN = (SRP_gN *)OPENSSL_malloc(sizeof(SRP_gN))) == NULL)
+ if ((gN = (SRP_gN *)malloc(sizeof(SRP_gN))) == NULL)
goto err;
if (!(gN->id = BUF_strdup(pp[DB_srpid]))
if (gN != NULL)
{
- OPENSSL_free(gN->id);
- OPENSSL_free(gN);
+ free(gN->id);
+ free(gN);
}
SRP_user_pwd_free(user_pwd);
if(!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) goto err;
BN_bn2bin(v,tmp);
- if (((vf = OPENSSL_malloc(BN_num_bytes(v)*2)) == NULL))
+ if (((vf = malloc(BN_num_bytes(v)*2)) == NULL))
goto err;
t_tob64(vf, tmp, BN_num_bytes(v));
{
char *tmp_salt;
- if ((tmp_salt = OPENSSL_malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL)
+ if ((tmp_salt = malloc(SRP_RANDOM_SALT_LEN * 2)) == NULL)
{
- OPENSSL_free(vf);
+ free(vf);
goto err;
}
t_tob64(tmp_salt, tmp2, SRP_RANDOM_SALT_LEN);
char **s;
if ((ret=sk_new(sk->comp)) == NULL) goto err;
- s=(char **)OPENSSL_realloc((char *)ret->data,
+ s=(char **)realloc((char *)ret->data,
(unsigned int)sizeof(char *)*sk->num_alloc);
if (s == NULL) goto err;
ret->data=s;
_STACK *ret;
int i;
- if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL)
+ if ((ret=malloc(sizeof(_STACK))) == NULL)
goto err;
- if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)
+ if ((ret->data=malloc(sizeof(char *)*MIN_NODES)) == NULL)
goto err;
for (i=0; i<MIN_NODES; i++)
ret->data[i]=NULL;
return(ret);
err:
if(ret)
- OPENSSL_free(ret);
+ free(ret);
return(NULL);
}
if(st == NULL) return 0;
if (st->num_alloc <= st->num+1)
{
- s=OPENSSL_realloc((char *)st->data,
+ s=realloc((char *)st->data,
(unsigned int)sizeof(char *)*st->num_alloc*2);
if (s == NULL)
return(0);
void sk_free(_STACK *st)
{
if (st == NULL) return;
- if (st->data != NULL) OPENSSL_free(st->data);
- OPENSSL_free(st);
+ if (st->data != NULL) free(st->data);
+ free(st);
}
int sk_num(const _STACK *st)
return NULL;
}
- ret=(STORE *)OPENSSL_malloc(sizeof(STORE));
+ ret=(STORE *)malloc(sizeof(STORE));
if (ret == NULL)
{
STOREerr(STORE_F_STORE_NEW_METHOD,ERR_R_MALLOC_FAILURE);
if (store->meth->clean)
store->meth->clean(store);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_STORE, store, &store->ex_data);
- OPENSSL_free(store);
+ free(store);
}
int STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void))
STORE_OBJECT *STORE_OBJECT_new(void)
{
- STORE_OBJECT *object = OPENSSL_malloc(sizeof(STORE_OBJECT));
+ STORE_OBJECT *object = malloc(sizeof(STORE_OBJECT));
if (object) memset(object, 0, sizeof(STORE_OBJECT));
return object;
}
BUF_MEM_free(data->data.arbitrary);
break;
}
- OPENSSL_free(data);
+ free(data);
}
IMPLEMENT_STACK_OF(STORE_OBJECT*)
STORE_ATTR_INFO *STORE_ATTR_INFO_new(void)
{
- return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO));
+ return (STORE_ATTR_INFO *)malloc(sizeof(STORE_ATTR_INFO));
}
static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs,
STORE_ATTR_TYPES code)
STORE_ATTR_TYPES i;
for(i = 0; i++ < STORE_ATTR_TYPE_NUM;)
STORE_ATTR_INFO_attr_free(attrs, i);
- OPENSSL_free(attrs);
+ free(attrs);
}
return 1;
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].cstring);
+ free(attrs->values[code].cstring);
attrs->values[code].cstring = NULL;
CLEAR_ATTRBIT(attrs, code);
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].sha1string);
+ free(attrs->values[code].sha1string);
attrs->values[code].sha1string = NULL;
CLEAR_ATTRBIT(attrs, code);
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].dn);
+ free(attrs->values[code].dn);
attrs->values[code].dn = NULL;
CLEAR_ATTRBIT(attrs, code);
}
}
if (ATTR_IS_SET(attrs,code))
{
- OPENSSL_free(attrs->values[code].number);
+ free(attrs->values[code].number);
attrs->values[code].number = NULL;
CLEAR_ATTRBIT(attrs, code);
}
if (attributes)
{
struct attr_list_ctx_st *context =
- (struct attr_list_ctx_st *)OPENSSL_malloc(sizeof(struct attr_list_ctx_st));
+ (struct attr_list_ctx_st *)malloc(sizeof(struct attr_list_ctx_st));
if (context)
context->attributes = attributes;
else
#if 0
OPENSSL_ITEM *attributes = context->attributes;
#endif
- OPENSSL_free(context);
+ free(context);
return 1;
}
STOREerr(STORE_F_STORE_PARSE_ATTRS_END, ERR_R_PASSED_NULL_PARAMETER);
OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[])
{
struct mem_ctx_st *context =
- (struct mem_ctx_st *)OPENSSL_malloc(sizeof(struct mem_ctx_st));
+ (struct mem_ctx_st *)malloc(sizeof(struct mem_ctx_st));
void *attribute_context = NULL;
STORE_ATTR_INFO *attrs = NULL;
}
if (context && context->search_attributes)
sk_STORE_ATTR_INFO_free(context->search_attributes);
- if (context) OPENSSL_free(context);
+ if (context) free(context);
return 1;
}
static int mem_list_endp(STORE *s, void *handle)
STORE_METHOD *STORE_create_method(char *name)
{
- STORE_METHOD *store_method = (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD));
+ STORE_METHOD *store_method = (STORE_METHOD *)malloc(sizeof(STORE_METHOD));
if (store_method)
{
void STORE_destroy_method(STORE_METHOD *store_method)
{
if (!store_method) return;
- OPENSSL_free(store_method->name);
+ free(store_method->name);
store_method->name = NULL;
- OPENSSL_free(store_method);
+ free(store_method);
}
int STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f)
{
result = BIO_write(bio, "0x", 2) > 0;
result = result && BIO_write(bio, hex, strlen(hex)) > 0;
- OPENSSL_free(hex);
+ free(hex);
}
BN_free(&num_bn);
{
TS_RESP_CTX *ctx;
- if (!(ctx = (TS_RESP_CTX *) OPENSSL_malloc(sizeof(TS_RESP_CTX))))
+ if (!(ctx = (TS_RESP_CTX *) malloc(sizeof(TS_RESP_CTX))))
{
TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
ASN1_INTEGER_free(ctx->seconds);
ASN1_INTEGER_free(ctx->millis);
ASN1_INTEGER_free(ctx->micros);
- OPENSSL_free(ctx);
+ free(ctx);
}
int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer)
int len;
len = i2d_ESS_SIGNING_CERT(sc, NULL);
- if (!(pp = (unsigned char *) OPENSSL_malloc(len)))
+ if (!(pp = (unsigned char *) malloc(len)))
{
TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
goto err;
TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
goto err;
}
- OPENSSL_free(pp); pp = NULL;
+ free(pp); pp = NULL;
return PKCS7_add_signed_attribute(si,
NID_id_smime_aa_signingCertificate,
V_ASN1_SEQUENCE, seq);
err:
ASN1_STRING_free(seq);
- OPENSSL_free(pp);
+ free(pp);
return 0;
}
err:
X509_free(signer);
X509_ALGOR_free(md_alg);
- OPENSSL_free(imprint);
+ free(imprint);
return ret;
}
", status text: ", embedded_status_text ?
embedded_status_text : "unspecified",
", failure codes: ", failure_text);
- OPENSSL_free(embedded_status_text);
+ free(embedded_status_text);
return 0;
}
length += 1; /* separator character */
}
/* Allocate memory (closing '\0' included). */
- if (!(result = OPENSSL_malloc(length)))
+ if (!(result = malloc(length)))
{
TSerr(TS_F_TS_GET_STATUS_TEXT, ERR_R_MALLOC_FAILURE);
return NULL;
if (length < 0)
goto err;
*imprint_len = length;
- if (!(*imprint = OPENSSL_malloc(*imprint_len)))
+ if (!(*imprint = malloc(*imprint_len)))
{
TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE);
goto err;
return 1;
err:
X509_ALGOR_free(*md_alg);
- OPENSSL_free(*imprint);
+ free(*imprint);
*imprint_len = 0;
return 0;
}
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
{
TS_VERIFY_CTX *ctx =
- (TS_VERIFY_CTX *) OPENSSL_malloc(sizeof(TS_VERIFY_CTX));
+ (TS_VERIFY_CTX *) malloc(sizeof(TS_VERIFY_CTX));
if (ctx)
memset(ctx, 0, sizeof(TS_VERIFY_CTX));
else
if (!ctx) return;
TS_VERIFY_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx)
ASN1_OBJECT_free(ctx->policy);
X509_ALGOR_free(ctx->md_alg);
- OPENSSL_free(ctx->imprint);
+ free(ctx->imprint);
BIO_free_all(ctx->data);
if (!(ret->md_alg = X509_ALGOR_dup(md_alg))) goto err;
msg = TS_MSG_IMPRINT_get_msg(imprint);
ret->imprint_len = ASN1_STRING_length(msg);
- if (!(ret->imprint = OPENSSL_malloc(ret->imprint_len))) goto err;
+ if (!(ret->imprint = malloc(ret->imprint_len))) goto err;
memcpy(ret->imprint, ASN1_STRING_data(msg), ret->imprint_len);
/* Setting nonce. */
if ((buf=BUF_MEM_new()) == NULL) goto err;
if (!BUF_MEM_grow(buf,size)) goto err;
- if ((ret=OPENSSL_malloc(sizeof(TXT_DB))) == NULL)
+ if ((ret=malloc(sizeof(TXT_DB))) == NULL)
goto err;
ret->num_fields=num;
ret->index=NULL;
ret->qual=NULL;
if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL)
goto err;
- if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL)
+ if ((ret->index=malloc(sizeof(*ret->index)*num)) == NULL)
goto err;
- if ((ret->qual=OPENSSL_malloc(sizeof(*(ret->qual))*num)) == NULL)
+ if ((ret->qual=malloc(sizeof(*(ret->qual))*num)) == NULL)
goto err;
for (i=0; i<num; i++)
{
else
{
buf->data[offset-1]='\0'; /* blat the '\n' */
- if (!(p=OPENSSL_malloc(add+offset))) goto err;
+ if (!(p=malloc(add+offset))) goto err;
offset=0;
}
pp=(char **)p;
if (er)
{
#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
- if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n");
+ if (er == 1) fprintf(stderr,"malloc failure\n");
#endif
if (ret != NULL)
{
if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data);
- if (ret->index != NULL) OPENSSL_free(ret->index);
- if (ret->qual != NULL) OPENSSL_free(ret->qual);
- if (ret != NULL) OPENSSL_free(ret);
+ if (ret->index != NULL) free(ret->index);
+ if (ret->qual != NULL) free(ret->qual);
+ if (ret != NULL) free(ret);
}
return(NULL);
}
{
for (i=db->num_fields-1; i>=0; i--)
if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]);
- OPENSSL_free(db->index);
+ free(db->index);
}
if (db->qual != NULL)
- OPENSSL_free(db->qual);
+ free(db->qual);
if (db->data != NULL)
{
for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--)
if (max == NULL) /* new row */
{
for (n=0; n<db->num_fields; n++)
- if (p[n] != NULL) OPENSSL_free(p[n]);
+ if (p[n] != NULL) free(p[n]);
}
else
{
{
if (((p[n] < (char *)p) || (p[n] > max))
&& (p[n] != NULL))
- OPENSSL_free(p[n]);
+ free(p[n]);
}
}
- OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i));
+ free(sk_OPENSSL_PSTRING_value(db->data,i));
}
sk_OPENSSL_PSTRING_free(db->data);
}
- OPENSSL_free(db);
+ free(db);
}
and object_name is the name of the object (might be a card name or
a file name.
The returned string shall always be allocated on the heap with
- OPENSSL_malloc(), and need to be free'd with OPENSSL_free().
+ malloc(), and need to be free'd with free().
If the ui_method doesn't contain a pointer to a user-defined prompt
constructor, a default string is built, looking like this:
{
UI *ret;
- ret=(UI *)OPENSSL_malloc(sizeof(UI));
+ ret=(UI *)malloc(sizeof(UI));
if (ret == NULL)
{
UIerr(UI_F_UI_NEW_METHOD,ERR_R_MALLOC_FAILURE);
{
if (uis->flags & OUT_STRING_FREEABLE)
{
- OPENSSL_free((char *)uis->out_string);
+ free((char *)uis->out_string);
switch(uis->type)
{
case UIT_BOOLEAN:
- OPENSSL_free((char *)uis->_.boolean_data.action_desc);
- OPENSSL_free((char *)uis->_.boolean_data.ok_chars);
- OPENSSL_free((char *)uis->_.boolean_data.cancel_chars);
+ free((char *)uis->_.boolean_data.action_desc);
+ free((char *)uis->_.boolean_data.ok_chars);
+ free((char *)uis->_.boolean_data.cancel_chars);
break;
default:
break;
}
}
- OPENSSL_free(uis);
+ free(uis);
}
void UI_free(UI *ui)
return;
sk_UI_STRING_pop_free(ui->strings,free_string);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_UI, ui, &ui->ex_data);
- OPENSSL_free(ui);
+ free(ui);
}
static int allocate_string_stack(UI *ui)
{
UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER);
}
- else if ((ret = (UI_STRING *)OPENSSL_malloc(sizeof(UI_STRING))))
+ else if ((ret = (UI_STRING *)malloc(sizeof(UI_STRING))))
{
ret->out_string=prompt;
ret->flags=prompt_freeable ? OUT_STRING_FREEABLE : 0;
ok_chars_copy, cancel_chars_copy, 1, UIT_BOOLEAN, flags,
result_buf);
err:
- if (prompt_copy) OPENSSL_free(prompt_copy);
- if (action_desc_copy) OPENSSL_free(action_desc_copy);
- if (ok_chars_copy) OPENSSL_free(ok_chars_copy);
- if (cancel_chars_copy) OPENSSL_free(cancel_chars_copy);
+ if (prompt_copy) free(prompt_copy);
+ if (action_desc_copy) free(action_desc_copy);
+ if (ok_chars_copy) free(ok_chars_copy);
+ if (cancel_chars_copy) free(cancel_chars_copy);
return -1;
}
len += sizeof(prompt2) - 1 + strlen(object_name);
len += sizeof(prompt3) - 1;
- prompt = (char *)OPENSSL_malloc(len + 1);
+ prompt = (char *)malloc(len + 1);
BUF_strlcpy(prompt, prompt1, len + 1);
BUF_strlcat(prompt, object_desc, len + 1);
if (object_name)
UI_METHOD *UI_create_method(char *name)
{
- UI_METHOD *ui_method = (UI_METHOD *)OPENSSL_malloc(sizeof(UI_METHOD));
+ UI_METHOD *ui_method = (UI_METHOD *)malloc(sizeof(UI_METHOD));
if (ui_method)
{
anything Murphy can throw at you and more! You have been warned. */
void UI_destroy_method(UI_METHOD *ui_method)
{
- OPENSSL_free(ui_method->name);
+ free(ui_method->name);
ui_method->name = NULL;
- OPENSSL_free(ui_method);
+ free(ui_method);
}
int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui))
and object_name is the name of the object (might be a card name or
a file name.
The returned string shall always be allocated on the heap with
- OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). */
+ malloc(), and need to be free'd with free(). */
char *(*ui_construct_prompt)(UI *ui, const char *object_desc,
const char *object_name);
};
{
BY_DIR *a;
- if ((a = (BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL)
+ if ((a = (BY_DIR *)malloc(sizeof(BY_DIR))) == NULL)
return (0);
if ((a->buffer = BUF_MEM_new()) == NULL) {
- OPENSSL_free(a);
+ free(a);
return (0);
}
a->dirs = NULL;
static void
by_dir_hash_free(BY_DIR_HASH *hash)
{
- OPENSSL_free(hash);
+ free(hash);
}
static int
by_dir_entry_free(BY_DIR_ENTRY *ent)
{
if (ent->dir)
- OPENSSL_free(ent->dir);
+ free(ent->dir);
if (ent->hashes)
sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
- OPENSSL_free(ent);
+ free(ent);
}
static void
sk_BY_DIR_ENTRY_pop_free(a->dirs, by_dir_entry_free);
if (a->buffer != NULL)
BUF_MEM_free(a->buffer);
- OPENSSL_free(a);
+ free(a);
}
static int
return 0;
}
}
- ent = OPENSSL_malloc(sizeof(BY_DIR_ENTRY));
+ ent = malloc(sizeof(BY_DIR_ENTRY));
if (!ent)
return 0;
ent->dir_type = type;
ent->hashes, idx);
}
if (!hent) {
- hent = OPENSSL_malloc(sizeof(BY_DIR_HASH));
+ hent = malloc(sizeof(BY_DIR_HASH));
hent->hash = h;
hent->suffix = k;
if (!sk_BY_DIR_HASH_push(ent->hashes, hent)) {
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
- OPENSSL_free(hent);
+ free(hent);
ok = 0;
goto finish;
}
goto err;
if (!EVP_DigestUpdate(&ctx,(unsigned char *)f,strlen(f)))
goto err;
- OPENSSL_free(f);
+ free(f);
if(!EVP_DigestUpdate(&ctx,(unsigned char *)a->cert_info->serialNumber->data,
(unsigned long)a->cert_info->serialNumber->length))
goto err;
{
X509_LOOKUP *ret;
- ret=(X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP));
+ ret=(X509_LOOKUP *)malloc(sizeof(X509_LOOKUP));
if (ret == NULL) return NULL;
ret->init=0;
ret->store_ctx=NULL;
if ((method->new_item != NULL) && !method->new_item(ret))
{
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
return ret;
if ( (ctx->method != NULL) &&
(ctx->method->free != NULL))
(*ctx->method->free)(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int X509_LOOKUP_init(X509_LOOKUP *ctx)
{
X509_STORE *ret;
- if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
+ if ((ret=(X509_STORE *)malloc(sizeof(X509_STORE))) == NULL)
return NULL;
ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
ret->cache=1;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE, ret, &ret->ex_data))
{
sk_X509_OBJECT_free(ret->objs);
- OPENSSL_free(ret);
+ free(ret);
return NULL;
}
/* abort(); */
}
- OPENSSL_free(a);
+ free(a);
}
void X509_STORE_free(X509_STORE *vfy)
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data);
if (vfy->param)
X509_VERIFY_PARAM_free(vfy->param);
- OPENSSL_free(vfy);
+ free(vfy);
}
X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
int ret=1;
if (x == NULL) return 0;
- obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
+ obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT));
if (obj == NULL)
{
X509err(X509_F_X509_STORE_ADD_CERT,ERR_R_MALLOC_FAILURE);
if (X509_OBJECT_retrieve_match(ctx->objs, obj))
{
X509_OBJECT_free_contents(obj);
- OPENSSL_free(obj);
+ free(obj);
X509err(X509_F_X509_STORE_ADD_CERT,X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret=0;
}
int ret=1;
if (x == NULL) return 0;
- obj=(X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
+ obj=(X509_OBJECT *)malloc(sizeof(X509_OBJECT));
if (obj == NULL)
{
X509err(X509_F_X509_STORE_ADD_CRL,ERR_R_MALLOC_FAILURE);
if (X509_OBJECT_retrieve_match(ctx->objs, obj))
{
X509_OBJECT_free_contents(obj);
- OPENSSL_free(obj);
+ free(obj);
X509err(X509_F_X509_STORE_ADD_CRL,X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret=0;
}
if(b)
{
buf=b->data;
- OPENSSL_free(b);
+ free(b);
}
strlcpy(buf,"NO X509_NAME",len);
return buf;
if (b != NULL)
{
p=b->data;
- OPENSSL_free(b);
+ free(b);
}
else
p=buf;
ri=ret->req_info;
ri->version->length=1;
- ri->version->data=(unsigned char *)OPENSSL_malloc(1);
+ ri->version->data=(unsigned char *)malloc(1);
if (ri->version->data == NULL) goto err;
ri->version->data[0]=0; /* version == 0 */
idx = X509_TRUST_get_by_id(id);
/* Need a new entry */
if(idx == -1) {
- if(!(trtmp = OPENSSL_malloc(sizeof(X509_TRUST)))) {
+ if(!(trtmp = malloc(sizeof(X509_TRUST)))) {
X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE);
return 0;
}
trtmp->flags = X509_TRUST_DYNAMIC;
} else trtmp = X509_TRUST_get0(idx);
- /* OPENSSL_free existing name if dynamic */
- if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name);
+ /* free existing name if dynamic */
+ if(trtmp->flags & X509_TRUST_DYNAMIC_NAME) free(trtmp->name);
/* dup supplied name */
if(!(trtmp->name = BUF_strdup(name))) {
X509err(X509_F_X509_TRUST_ADD,ERR_R_MALLOC_FAILURE);
if (p->flags & X509_TRUST_DYNAMIC)
{
if (p->flags & X509_TRUST_DYNAMIC_NAME)
- OPENSSL_free(p->name);
- OPENSSL_free(p);
+ free(p->name);
+ free(p);
}
}
X509_STORE_CTX *X509_STORE_CTX_new(void)
{
X509_STORE_CTX *ctx;
- ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX));
+ ctx = (X509_STORE_CTX *)malloc(sizeof(X509_STORE_CTX));
if (!ctx)
{
X509err(X509_F_X509_STORE_CTX_NEW,ERR_R_MALLOC_FAILURE);
void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
{
X509_STORE_CTX_cleanup(ctx);
- OPENSSL_free(ctx);
+ free(ctx);
}
int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
if(!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_X509_STORE_CTX, ctx,
&(ctx->ex_data)))
{
- OPENSSL_free(ctx);
+ free(ctx);
X509err(X509_F_X509_STORE_CTX_INIT,ERR_R_MALLOC_FAILURE);
return 0;
}
X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void)
{
X509_VERIFY_PARAM *param;
- param = OPENSSL_malloc(sizeof(X509_VERIFY_PARAM));
+ param = malloc(sizeof(X509_VERIFY_PARAM));
memset(param, 0, sizeof(X509_VERIFY_PARAM));
x509_verify_param_zero(param);
return param;
void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param)
{
x509_verify_param_zero(param);
- OPENSSL_free(param);
+ free(param);
}
/* This function determines how parameters are "inherited" from one structure
int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name)
{
if (param->name)
- OPENSSL_free(param->name);
+ free(param->name);
param->name = BUF_strdup(name);
if (param->name)
return 1;
int spki_len;
NETSCAPE_SPKI *spki;
if(len <= 0) len = strlen(str);
- if (!(spki_der = OPENSSL_malloc(len + 1))) {
+ if (!(spki_der = malloc(len + 1))) {
X509err(X509_F_NETSCAPE_SPKI_B64_DECODE, ERR_R_MALLOC_FAILURE);
return NULL;
}
if(spki_len < 0) {
X509err(X509_F_NETSCAPE_SPKI_B64_DECODE,
X509_R_BASE64_DECODE_ERROR);
- OPENSSL_free(spki_der);
+ free(spki_der);
return NULL;
}
p = spki_der;
spki = d2i_NETSCAPE_SPKI(NULL, &p, spki_len);
- OPENSSL_free(spki_der);
+ free(spki_der);
return spki;
}
char *b64_str;
int der_len;
der_len = i2d_NETSCAPE_SPKI(spki, NULL);
- der_spki = OPENSSL_malloc(der_len);
- b64_str = OPENSSL_malloc(der_len * 2);
+ der_spki = malloc(der_len);
+ b64_str = malloc(der_len * 2);
if(!der_spki || !b64_str) {
X509err(X509_F_NETSCAPE_SPKI_B64_ENCODE, ERR_R_MALLOC_FAILURE);
return NULL;
p = der_spki;
i2d_NETSCAPE_SPKI(spki, &p);
EVP_EncodeBlock((unsigned char *)b64_str, der_spki, der_len);
- OPENSSL_free(der_spki);
+ free(der_spki);
return b64_str;
}
CERTIFICATEPOLICIES *ext_cpols = NULL;
POLICY_MAPPINGS *ext_pmaps = NULL;
int i;
- cache = OPENSSL_malloc(sizeof(X509_POLICY_CACHE));
+ cache = malloc(sizeof(X509_POLICY_CACHE));
if (!cache)
return 0;
cache->anyPolicy = NULL;
policy_data_free(cache->anyPolicy);
if (cache->data)
sk_X509_POLICY_DATA_pop_free(cache->data, policy_data_free);
- OPENSSL_free(cache);
+ free(cache);
}
const X509_POLICY_CACHE *policy_cache_set(X509 *x)
sk_POLICYQUALINFO_pop_free(data->qualifier_set,
POLICYQUALINFO_free);
sk_ASN1_OBJECT_pop_free(data->expected_policy_set, ASN1_OBJECT_free);
- OPENSSL_free(data);
+ free(data);
}
/* Create a data based on an existing policy. If 'id' is NULL use the
}
else
id = NULL;
- ret = OPENSSL_malloc(sizeof(X509_POLICY_DATA));
+ ret = malloc(sizeof(X509_POLICY_DATA));
if (!ret)
return NULL;
ret->expected_policy_set = sk_ASN1_OBJECT_new_null();
if (!ret->expected_policy_set)
{
- OPENSSL_free(ret);
+ free(ret);
if (id)
ASN1_OBJECT_free(id);
return NULL;
X509_POLICY_TREE *tree)
{
X509_POLICY_NODE *node;
- node = OPENSSL_malloc(sizeof(X509_POLICY_NODE));
+ node = malloc(sizeof(X509_POLICY_NODE));
if (!node)
return NULL;
node->data = data;
void policy_node_free(X509_POLICY_NODE *node)
{
- OPENSSL_free(node);
+ free(node);
}
/* See if a policy node matches a policy OID. If mapping enabled look through
/* If we get this far initialize the tree */
- tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE));
+ tree = malloc(sizeof(X509_POLICY_TREE));
if (!tree)
return 0;
tree->flags = 0;
- tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n);
+ tree->levels = malloc(sizeof(X509_POLICY_LEVEL) * n);
tree->nlevel = 0;
tree->extra_data = NULL;
tree->auth_policies = NULL;
if (!tree->levels)
{
- OPENSSL_free(tree);
+ free(tree);
return 0;
}
if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK)
{
node->parent->nchild--;
- OPENSSL_free(node);
+ free(node);
(void)sk_X509_POLICY_NODE_delete(nodes,i);
}
}
if (node->nchild == 0)
{
node->parent->nchild--;
- OPENSSL_free(node);
+ free(node);
(void)sk_X509_POLICY_NODE_delete(nodes, i);
}
}
{
if (curr->anyPolicy->parent)
curr->anyPolicy->parent->nchild--;
- OPENSSL_free(curr->anyPolicy);
+ free(curr->anyPolicy);
curr->anyPolicy = NULL;
}
if (curr == tree->levels)
static void exnode_free(X509_POLICY_NODE *node)
{
if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE))
- OPENSSL_free(node);
+ free(node);
}
sk_X509_POLICY_DATA_pop_free(tree->extra_data,
policy_data_free);
- OPENSSL_free(tree->levels);
- OPENSSL_free(tree);
+ free(tree->levels);
+ free(tree);
}
X509V3_conf_err(val);
goto err;
}
- OPENSSL_free(s);
+ free(s);
s = NULL;
continue;
}
goto err;
}
- OPENSSL_free(s);
+ free(s);
s = NULL;
}
return addr;
err:
- OPENSSL_free(s);
+ free(s);
sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free);
return NULL;
}
if(akeyid->keyid) {
tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length);
X509V3_add_value("keyid", tmp, &extlist);
- OPENSSL_free(tmp);
+ free(tmp);
}
if(akeyid->issuer)
extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist);
tmp = hex_to_string(akeyid->serial->data,
akeyid->serial->length);
X509V3_add_value("serial", tmp, &extlist);
- OPENSSL_free(tmp);
+ free(tmp);
}
return extlist;
}
if (!(gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx)))
return 0;
objlen = p - value;
- objtmp = OPENSSL_malloc(objlen + 1);
+ objtmp = malloc(objlen + 1);
if (objtmp) {
strlcpy(objtmp, value, objlen + 1);
gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0);
- OPENSSL_free(objtmp);
+ free(objtmp);
} else
gen->d.otherName->type_id = NULL;
if (!gen->d.otherName->type_id)
if ((s = i2s_ASN1_INTEGER(NULL, aor->u.id)) == NULL)
return 0;
BIO_printf(out, "%*s%s\n", indent + 2, "", s);
- OPENSSL_free(s);
+ free(s);
break;
case ASIdOrRange_range:
if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->min)) == NULL)
return 0;
BIO_printf(out, "%*s%s-", indent + 2, "", s);
- OPENSSL_free(s);
+ free(s);
if ((s = i2s_ASN1_INTEGER(NULL, aor->u.range->max)) == NULL)
return 0;
BIO_printf(out, "%s\n", s);
- OPENSSL_free(s);
+ free(s);
break;
default:
return 0;
ASRange *r;
switch (a->type) {
case ASIdOrRange_id:
- if ((r = OPENSSL_malloc(sizeof(ASRange))) == NULL) {
+ if ((r = malloc(sizeof(ASRange))) == NULL) {
X509V3err(X509V3_F_ASIDENTIFIERCHOICE_CANONIZE,
ERR_R_MALLOC_FAILURE);
goto done;
s[i1] = '\0';
min = s2i_ASN1_INTEGER(NULL, s);
max = s2i_ASN1_INTEGER(NULL, s + i2);
- OPENSSL_free(s);
+ free(s);
if (min == NULL || max == NULL) {
X509V3err(X509V3_F_V2I_ASIDENTIFIERS, ERR_R_MALLOC_FAILURE);
goto err;
{
unsigned char *p;
ext_len = method->i2d(ext_struc, NULL);
- if(!(ext_der = OPENSSL_malloc(ext_len))) goto merr;
+ if(!(ext_der = malloc(ext_len))) goto merr;
p = ext_der;
method->i2d(ext_struc, &p);
}
err:
ASN1_OBJECT_free(obj);
M_ASN1_OCTET_STRING_free(oct);
- if(ext_der) OPENSSL_free(ext_der);
+ if(ext_der) free(ext_der);
return extension;
}
if(i) BIO_puts(out, ", ");
tmp = i2s_ASN1_INTEGER(NULL, num);
BIO_puts(out, tmp);
- OPENSSL_free(tmp);
+ free(tmp);
}
BIO_puts(out, "\n");
}
{
char *tmp;
if(!ia5 || !ia5->length) return NULL;
- if(!(tmp = OPENSSL_malloc(ia5->length + 1))) {
+ if(!(tmp = malloc(ia5->length + 1))) {
X509V3err(X509V3_F_I2S_ASN1_IA5STRING,ERR_R_MALLOC_FAILURE);
return NULL;
}
vtmp = sk_CONF_VALUE_value(ret, i);
i2t_ASN1_OBJECT(objtmp, sizeof objtmp, desc->method);
nlen = strlen(objtmp) + strlen(vtmp->name) + 5;
- ntmp = OPENSSL_malloc(nlen);
+ ntmp = malloc(nlen);
if(!ntmp) {
X509V3err(X509V3_F_I2V_AUTHORITY_INFO_ACCESS,
ERR_R_MALLOC_FAILURE);
BUF_strlcpy(ntmp, objtmp, nlen);
BUF_strlcat(ntmp, " - ", nlen);
BUF_strlcat(ntmp, vtmp->name, nlen);
- OPENSSL_free(vtmp->name);
+ free(vtmp->name);
vtmp->name = ntmp;
}
ctmp.value = cnf->value;
if(!v2i_GENERAL_NAME_ex(acc->location, method, ctx, &ctmp, 0))
goto err;
- if(!(objtmp = OPENSSL_malloc(objlen + 1))) {
+ if(!(objtmp = malloc(objlen + 1))) {
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,ERR_R_MALLOC_FAILURE);
goto err;
}
if(!acc->method) {
X509V3err(X509V3_F_V2I_AUTHORITY_INFO_ACCESS,X509V3_R_BAD_OBJECT);
ERR_add_error_data(2, "value=", objtmp);
- OPENSSL_free(objtmp);
+ free(objtmp);
goto err;
}
- OPENSSL_free(objtmp);
+ free(objtmp);
}
return ainfo;
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
return 0;
}
- if(!(tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) {
+ if(!(tmpext = (X509V3_EXT_METHOD *)malloc(sizeof(X509V3_EXT_METHOD)))) {
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);
return 0;
}
static void ext_list_free(X509V3_EXT_METHOD *ext)
{
- if(ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext);
+ if(ext->ext_flags & X509V3_EXT_DYNAMIC) free(ext);
}
/* Legacy function: we don't need to add standard extensions
goto err;
}
- tmp_data = OPENSSL_realloc((*policy)->data,
+ tmp_data = realloc((*policy)->data,
(*policy)->length + val_len + 1);
if (tmp_data)
{
}
else
{
- OPENSSL_free(tmp_data2);
+ free(tmp_data2);
/* realloc failure implies the original data space is b0rked too! */
(*policy)->data = NULL;
(*policy)->length = 0;
X509V3_conf_err(val);
goto err;
}
- OPENSSL_free(tmp_data2);
+ free(tmp_data2);
}
else if (strncmp(val->value, "file:", 5) == 0)
{
{
if (!n) continue;
- tmp_data = OPENSSL_realloc((*policy)->data,
+ tmp_data = realloc((*policy)->data,
(*policy)->length + n + 1);
if (!tmp_data)
else if (strncmp(val->value, "text:", 5) == 0)
{
val_len = strlen(val->value + 5);
- tmp_data = OPENSSL_realloc((*policy)->data,
+ tmp_data = realloc((*policy)->data,
(*policy)->length + val_len + 1);
if (tmp_data)
{
err:
sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
- if(value) OPENSSL_free(value);
+ if(value) free(value);
if(method->it) ASN1_item_free(ext_str, ASN1_ITEM_ptr(method->it));
else method->ext_free(ext_str);
return ok;
idx = X509_PURPOSE_get_by_id(id);
/* Need a new entry */
if(idx == -1) {
- if(!(ptmp = OPENSSL_malloc(sizeof(X509_PURPOSE)))) {
+ if(!(ptmp = malloc(sizeof(X509_PURPOSE)))) {
X509V3err(X509V3_F_X509_PURPOSE_ADD,ERR_R_MALLOC_FAILURE);
return 0;
}
ptmp->flags = X509_PURPOSE_DYNAMIC;
} else ptmp = X509_PURPOSE_get0(idx);
- /* OPENSSL_free existing name if dynamic */
+ /* free existing name if dynamic */
if(ptmp->flags & X509_PURPOSE_DYNAMIC_NAME) {
- OPENSSL_free(ptmp->name);
- OPENSSL_free(ptmp->sname);
+ free(ptmp->name);
+ free(ptmp->sname);
}
/* dup supplied name */
ptmp->name = BUF_strdup(name);
if (p->flags & X509_PURPOSE_DYNAMIC)
{
if (p->flags & X509_PURPOSE_DYNAMIC_NAME) {
- OPENSSL_free(p->name);
- OPENSSL_free(p->sname);
+ free(p->name);
+ free(p->sname);
}
- OPENSSL_free(p);
+ free(p);
}
}
id = sk_SXNETID_value(sx->ids, i);
tmp = i2s_ASN1_INTEGER(NULL, id->zone);
BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp);
- OPENSSL_free(tmp);
+ free(tmp);
M_ASN1_OCTET_STRING_print(out, id->user);
}
return 1;
char *tname = NULL, *tvalue = NULL;
if(name && !(tname = BUF_strdup(name))) goto err;
if(value && !(tvalue = BUF_strdup(value))) goto err;
- if(!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) goto err;
+ if(!(vtmp = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) goto err;
if(!*extlist && !(*extlist = sk_CONF_VALUE_new_null())) goto err;
vtmp->section = NULL;
vtmp->name = tname;
return 1;
err:
X509V3err(X509V3_F_X509V3_ADD_VALUE,ERR_R_MALLOC_FAILURE);
- if(vtmp) OPENSSL_free(vtmp);
- if(tname) OPENSSL_free(tname);
- if(tvalue) OPENSSL_free(tvalue);
+ if(vtmp) free(vtmp);
+ if(tname) free(tname);
+ if(tvalue) free(tvalue);
return 0;
}
void X509V3_conf_free(CONF_VALUE *conf)
{
if(!conf) return;
- if(conf->name) OPENSSL_free(conf->name);
- if(conf->value) OPENSSL_free(conf->value);
- if(conf->section) OPENSSL_free(conf->section);
- OPENSSL_free(conf);
+ if(conf->name) free(conf->name);
+ if(conf->value) free(conf->value);
+ if(conf->section) free(conf->section);
+ free(conf);
}
int X509V3_add_value_bool(const char *name, int asn1_bool,
if(!aint) return 1;
if(!(strtmp = i2s_ASN1_INTEGER(NULL, aint))) return 0;
ret = X509V3_add_value(name, strtmp, extlist);
- OPENSSL_free(strtmp);
+ free(strtmp);
return ret;
}
}
X509V3_add_value(ntmp, NULL, &values);
}
-OPENSSL_free(linebuf);
+free(linebuf);
return values;
err:
-OPENSSL_free(linebuf);
+free(linebuf);
sk_CONF_VALUE_pop_free(values, X509V3_conf_free);
return NULL;
/* hex string utilities */
-/* Given a buffer of length 'len' return a OPENSSL_malloc'ed string with its
+/* Given a buffer of length 'len' return a malloc'ed string with its
* hex representation
* @@@ (Contents of buffer are always kept in ASCII, also on EBCDIC machines)
*/
int i;
const static char hexdig[] = "0123456789ABCDEF";
if(!buffer || !len) return NULL;
- if(!(tmp = OPENSSL_malloc(len * 3 + 1))) {
+ if(!(tmp = malloc(len * 3 + 1))) {
X509V3err(X509V3_F_HEX_TO_STRING,ERR_R_MALLOC_FAILURE);
return NULL;
}
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_INVALID_NULL_ARGUMENT);
return NULL;
}
- if(!(hexbuf = OPENSSL_malloc(strlen(str) >> 1))) goto err;
+ if(!(hexbuf = malloc(strlen(str) >> 1))) goto err;
for(p = (unsigned char *)str, q = hexbuf; *p;) {
ch = *p++;
if(ch == ':') continue;
cl = *p++;
if(!cl) {
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ODD_NUMBER_OF_DIGITS);
- OPENSSL_free(hexbuf);
+ free(hexbuf);
return NULL;
}
if(isupper(ch)) ch = tolower(ch);
return hexbuf;
err:
- if(hexbuf) OPENSSL_free(hexbuf);
+ if(hexbuf) free(hexbuf);
X509V3err(X509V3_F_STRING_TO_HEX,ERR_R_MALLOC_FAILURE);
return NULL;
badhex:
- OPENSSL_free(hexbuf);
+ free(hexbuf);
X509V3err(X509V3_F_STRING_TO_HEX,X509V3_R_ILLEGAL_HEX_DIGIT);
return NULL;
static void str_free(OPENSSL_STRING str)
{
- OPENSSL_free(str);
+ free(str);
}
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email)
iplen2 = a2i_ipadd(ipout + iplen1, p);
- OPENSSL_free(iptmp);
+ free(iptmp);
iptmp = NULL;
if (!iplen2 || (iplen1 != iplen2))
err:
if (iptmp)
- OPENSSL_free(iptmp);
+ free(iptmp);
if (ret)
ASN1_OCTET_STRING_free(ret);
return NULL;
{
BIO_SSL *bs;
- bs = (BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL));
+ bs = (BIO_SSL *)malloc(sizeof(BIO_SSL));
if (bs == NULL) {
BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return (0);
a->flags = 0;
}
if (a->ptr != NULL)
- OPENSSL_free(a->ptr);
+ free(a->ptr);
return (1);
}
unsigned char *buf = NULL;
unsigned char *bitmask = NULL;
- frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
+ frag = (hm_fragment *)malloc(sizeof(hm_fragment));
if (frag == NULL)
return NULL;
if (frag_len) {
- buf = (unsigned char *)OPENSSL_malloc(frag_len);
+ buf = (unsigned char *)malloc(frag_len);
if (buf == NULL) {
- OPENSSL_free(frag);
+ free(frag);
return NULL;
}
}
/* Initialize reassembly bitmask if necessary */
if (reassembly) {
- bitmask = (unsigned char *)OPENSSL_malloc(RSMBLY_BITMASK_SIZE(frag_len));
+ bitmask = (unsigned char *)malloc(RSMBLY_BITMASK_SIZE(frag_len));
if (bitmask == NULL) {
if (buf != NULL)
- OPENSSL_free(buf);
- OPENSSL_free(frag);
+ free(buf);
+ free(frag);
return NULL;
}
memset(bitmask, 0, RSMBLY_BITMASK_SIZE(frag_len));
EVP_MD_CTX_destroy(frag->msg_header.saved_retransmit_state.write_hash);
}
if (frag->fragment)
- OPENSSL_free(frag->fragment);
+ free(frag->fragment);
if (frag->reassembly)
- OPENSSL_free(frag->reassembly);
- OPENSSL_free(frag);
+ free(frag->reassembly);
+ free(frag);
}
/* send s->init_buf in records of type 'type' (SSL3_RT_HANDSHAKE or SSL3_RT_CHANGE_CIPHER_SPEC) */
is_complete);
if (is_complete) {
- OPENSSL_free(frag->reassembly);
+ free(frag->reassembly);
frag->reassembly = NULL;
}
if (frag != NULL)
dtls1_hm_fragment_free(frag);
if (item != NULL)
- OPENSSL_free(item);
+ free(item);
*ok = 0;
return i;
}
if (frag != NULL)
dtls1_hm_fragment_free(frag);
if (item != NULL)
- OPENSSL_free(item);
+ free(item);
*ok = 0;
return i;
}
NULL, 0, NULL);
encodedPoint = (unsigned char *)
- OPENSSL_malloc(encoded_pt_len *
+ malloc(encoded_pt_len *
sizeof(unsigned char));
bn_ctx = BN_CTX_new();
/* Free allocated memory */
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
s2n(psk_len, t);
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint);
if (s->ctx->psk_identity_hint != NULL &&
s->session->psk_identity_hint == NULL) {
}
if (s->session->psk_identity != NULL)
- OPENSSL_free(s->session->psk_identity);
+ free(s->session->psk_identity);
s->session->psk_identity = BUF_strdup(identity);
if (s->session->psk_identity == NULL) {
SSLerr(SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE,
#ifndef OPENSSL_NO_ECDH
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
if (!ssl3_new(s))
return (0);
- if ((d1 = OPENSSL_malloc(sizeof *d1)) == NULL) return (0);
+ if ((d1 = malloc(sizeof *d1)) == NULL) return (0);
memset(d1, 0, sizeof *d1);
/* d1->handshake_epoch=0; */
pqueue_free(d1->sent_messages);
if (d1->buffered_app_data.q)
pqueue_free(d1->buffered_app_data.q);
- OPENSSL_free(d1);
+ free(d1);
return (0);
}
while ((item = pqueue_pop(s->d1->unprocessed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf) {
- OPENSSL_free(rdata->rbuf.buf);
+ free(rdata->rbuf.buf);
}
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->processed_rcds.q)) != NULL) {
rdata = (DTLS1_RECORD_DATA *) item->data;
if (rdata->rbuf.buf) {
- OPENSSL_free(rdata->rbuf.buf);
+ free(rdata->rbuf.buf);
}
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->buffered_messages)) != NULL) {
frag = (hm_fragment *)item->data;
- OPENSSL_free(frag->fragment);
- OPENSSL_free(frag);
+ free(frag->fragment);
+ free(frag);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->sent_messages)) != NULL) {
frag = (hm_fragment *)item->data;
- OPENSSL_free(frag->fragment);
- OPENSSL_free(frag);
+ free(frag->fragment);
+ free(frag);
pitem_free(item);
}
while ((item = pqueue_pop(s->d1->buffered_app_data.q)) != NULL) {
frag = (hm_fragment *)item->data;
- OPENSSL_free(frag->fragment);
- OPENSSL_free(frag);
+ free(frag->fragment);
+ free(frag);
pitem_free(item);
}
}
pqueue_free(s->d1->sent_messages);
pqueue_free(s->d1->buffered_app_data.q);
- OPENSSL_free(s->d1);
+ free(s->d1);
s->d1 = NULL;
}
rdata = (DTLS1_RECORD_DATA *)item->data;
if (s->s3->rbuf.buf != NULL)
- OPENSSL_free(s->s3->rbuf.buf);
+ free(s->s3->rbuf.buf);
s->packet = rdata->packet;
s->packet_length = rdata->packet_length;
if (pqueue_size(queue->q) >= 100)
return 0;
- rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA));
+ rdata = malloc(sizeof(DTLS1_RECORD_DATA));
item = pitem_new(priority, rdata);
if (rdata == NULL || item == NULL) {
if (rdata != NULL)
- OPENSSL_free(rdata);
+ free(rdata);
if (item != NULL)
pitem_free(item);
/* insert should not fail, since duplicates are dropped */
if (pqueue_insert(queue->q, item) == NULL) {
- OPENSSL_free(rdata);
+ free(rdata);
pitem_free(item);
return (0);
}
if (!ssl3_setup_buffers(s)) {
SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR);
- OPENSSL_free(rdata);
+ free(rdata);
pitem_free(item);
return (0);
}
if (item) {
dtls1_copy_record(s, item);
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
return (1);
rdata = (DTLS1_RECORD_DATA *)item->data;
if (s->s3->rbuf.buf != NULL)
- OPENSSL_free(s->s3->rbuf.buf);
+ free(s->s3->rbuf.buf);
s->packet = rdata->packet;
s->packet_length = rdata->packet_length;
memcpy(&(s->s3->rbuf), &(rdata->rbuf), sizeof(SSL3_BUFFER));
memcpy(&(s->s3->rrec), &(rdata->rrec), sizeof(SSL3_RECORD));
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
/* s->d1->next_expected_seq_num++; */
dtls1_copy_record(s, item);
- OPENSSL_free(item->data);
+ free(item->data);
pitem_free(item);
}
}
NULL, 0, NULL);
encodedPoint = (unsigned char *)
- OPENSSL_malloc(encodedlen*sizeof(unsigned char));
+ malloc(encodedlen*sizeof(unsigned char));
bn_ctx = BN_CTX_new();
if ((encodedPoint == NULL) || (bn_ctx == NULL)) {
memcpy((unsigned char*)p,
(unsigned char *)encodedPoint,
encodedlen);
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
p += encodedlen;
}
#endif
err:
#ifndef OPENSSL_NO_ECDH
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
BN_CTX_free(bn_ctx);
#endif
EVP_MD_CTX_cleanup(&md_ctx);
DTLS1_HM_HEADER_LENGTH + 22 + EVP_MAX_IV_LENGTH +
EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen))
return -1;
- senc = OPENSSL_malloc(slen);
+ senc = malloc(slen);
if (!senc)
return -1;
p = senc;
if (tctx->tlsext_ticket_key_cb) {
if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
&hctx, 1) < 0) {
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
} else {
s->init_num = len;
s->state = SSL3_ST_SW_SESSION_TICKET_B;
s->init_off = 0;
- OPENSSL_free(senc);
+ free(senc);
/* XDTLS: set message header ? */
msg_len = s->init_num - DTLS1_HM_HEADER_LENGTH;
{
void* p;
- p = OPENSSL_malloc(nmemb*size);
+ p = malloc(nmemb*size);
if (p){
memset(p, 0, nmemb*size);
}
return p;
}
-#define kssl_malloc(size) OPENSSL_malloc((size))
-#define kssl_realloc(ptr, size) OPENSSL_realloc(ptr, size)
-#define kssl_free(ptr) OPENSSL_free((ptr))
+#define kssl_malloc(size) malloc((size))
+#define kssl_realloc(ptr, size) realloc(ptr, size)
+#define kssl_free(ptr) free((ptr))
char
s->init_num = 0;
if (buf != buf_space)
- OPENSSL_free(buf);
+ free(buf);
return (SSL_accept(s));
err:
if (buf != buf_space)
- OPENSSL_free(buf);
+ free(buf);
return (-1);
}
if (!(s->options & SSL_OP_NO_COMPRESSION))
len += SSL3_RT_MAX_COMPRESSED_OVERHEAD;
#endif
- if ((p = OPENSSL_malloc(len)) == NULL)
+ if ((p = malloc(len)) == NULL)
goto err;
s->s3->rbuf.buf = p;
s->s3->rbuf.len = len;
len += headerlen + align +
SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD;
- if ((p = OPENSSL_malloc(len)) == NULL)
+ if ((p = malloc(len)) == NULL)
goto err;
s->s3->wbuf.buf = p;
s->s3->wbuf.len = len;
ssl3_release_write_buffer(SSL *s)
{
if (s->s3->wbuf.buf != NULL) {
- OPENSSL_free(s->s3->wbuf.buf);
+ free(s->s3->wbuf.buf);
s->s3->wbuf.buf = NULL;
}
return 1;
ssl3_release_read_buffer(SSL *s)
{
if (s->s3->rbuf.buf != NULL) {
- OPENSSL_free(s->s3->rbuf.buf);
+ free(s->s3->rbuf.buf);
s->s3->rbuf.buf = NULL;
}
return 1;
if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) {
s->session->sess_cert = ssl_sess_cert_new();
if (s->ctx->psk_identity_hint)
- OPENSSL_free(s->ctx->psk_identity_hint);
+ free(s->ctx->psk_identity_hint);
s->ctx->psk_identity_hint = NULL;
}
#endif
memcpy(tmp_id_hint, p, i);
memset(tmp_id_hint + i, 0, PSK_MAX_IDENTITY_LEN + 1 - i);
if (s->ctx->psk_identity_hint != NULL)
- OPENSSL_free(s->ctx->psk_identity_hint);
+ free(s->ctx->psk_identity_hint);
s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint);
if (s->ctx->psk_identity_hint == NULL) {
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE);
goto f_err;
}
if (s->session->tlsext_tick) {
- OPENSSL_free(s->session->tlsext_tick);
+ free(s->session->tlsext_tick);
s->session->tlsext_ticklen = 0;
}
- s->session->tlsext_tick = OPENSSL_malloc(ticklen);
+ s->session->tlsext_tick = malloc(ticklen);
if (!s->session->tlsext_tick) {
SSLerr(SSL_F_SSL3_GET_NEW_SESSION_TICKET, ERR_R_MALLOC_FAILURE);
goto err;
goto f_err;
}
if (s->tlsext_ocsp_resp)
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = BUF_memdup(p, resplen);
if (!s->tlsext_ocsp_resp) {
al = SSL_AD_INTERNAL_ERROR;
NULL, 0, NULL);
encodedPoint =
- (unsigned char *)OPENSSL_malloc(
+ (unsigned char *)malloc(
encoded_pt_len * sizeof(unsigned char));
bn_ctx = BN_CTX_new();
/* Free allocated memory */
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
goto err;
}
if (s->session->srp_username != NULL)
- OPENSSL_free(s->session->srp_username);
+ free(s->session->srp_username);
s->session->srp_username = BUF_strdup(s->srp_ctx.login);
if (s->session->srp_username == NULL) {
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
s2n(psk_len, t);
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint);
if (s->ctx->psk_identity_hint != NULL &&
s->session->psk_identity_hint == NULL) {
}
if (s->session->psk_identity != NULL)
- OPENSSL_free(s->session->psk_identity);
+ free(s->session->psk_identity);
s->session->psk_identity = BUF_strdup(identity);
if (s->session->psk_identity == NULL) {
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,
#ifndef OPENSSL_NO_ECDH
BN_CTX_free(bn_ctx);
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
if (clnt_ecdh != NULL)
EC_KEY_free(clnt_ecdh);
EVP_PKEY_free(srvr_pub_pkey);
if (which & SSL3_CC_READ) {
if (s->enc_read_ctx != NULL)
reuse_dd = 1;
- else if ((s->enc_read_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
+ else if ((s->enc_read_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
goto err;
else
/* make sure it's intialized in case we exit later with an error */
}
if (s->s3->rrec.comp == NULL)
s->s3->rrec.comp = (unsigned char *)
- OPENSSL_malloc(SSL3_RT_MAX_PLAIN_LENGTH);
+ malloc(SSL3_RT_MAX_PLAIN_LENGTH);
if (s->s3->rrec.comp == NULL)
goto err;
}
} else {
if (s->enc_write_ctx != NULL)
reuse_dd = 1;
- else if ((s->enc_write_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
+ else if ((s->enc_write_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
goto err;
else
/* make sure it's intialized in case we exit later with an error */
ssl3_cleanup_key_block(s);
- if ((p = OPENSSL_malloc(num)) == NULL)
+ if ((p = malloc(num)) == NULL)
goto err;
s->s3->tmp.key_block_length = num;
if (s->s3->tmp.key_block != NULL) {
OPENSSL_cleanse(s->s3->tmp.key_block,
s->s3->tmp.key_block_length);
- OPENSSL_free(s->s3->tmp.key_block);
+ free(s->s3->tmp.key_block);
s->s3->tmp.key_block = NULL;
}
s->s3->tmp.key_block_length = 0;
if (s->s3->handshake_dgst[i])
EVP_MD_CTX_destroy(s->s3->handshake_dgst[i]);
}
- OPENSSL_free(s->s3->handshake_dgst);
+ free(s->s3->handshake_dgst);
s->s3->handshake_dgst = NULL;
}
/* Allocate handshake_dgst array */
ssl3_free_digest_list(s);
- s->s3->handshake_dgst = OPENSSL_malloc(SSL_MAX_DIGEST * sizeof(EVP_MD_CTX *));
+ s->s3->handshake_dgst = malloc(SSL_MAX_DIGEST * sizeof(EVP_MD_CTX *));
memset(s->s3->handshake_dgst, 0, SSL_MAX_DIGEST *sizeof(EVP_MD_CTX *));
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
if (hdatalen <= 0) {
{
SSL3_STATE *s3;
- if ((s3 = OPENSSL_malloc(sizeof *s3)) == NULL) goto err;
+ if ((s3 = malloc(sizeof *s3)) == NULL) goto err;
memset(s3, 0, sizeof *s3);
memset(s3->rrec.seq_num, 0, sizeof(s3->rrec.seq_num));
memset(s3->wrec.seq_num, 0, sizeof(s3->wrec.seq_num));
#ifdef TLSEXT_TYPE_opaque_prf_input
if (s->s3->client_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
if (s->s3->server_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
#endif
ssl3_cleanup_key_block(s);
if (s->s3->wbuf.buf != NULL)
ssl3_release_write_buffer(s);
if (s->s3->rrec.comp != NULL)
- OPENSSL_free(s->s3->rrec.comp);
+ free(s->s3->rrec.comp);
#ifndef OPENSSL_NO_DH
if (s->s3->tmp.dh != NULL)
DH_free(s->s3->tmp.dh);
SSL_SRP_CTX_free(s);
#endif
OPENSSL_cleanse(s->s3, sizeof *s->s3);
- OPENSSL_free(s->s3);
+ free(s->s3);
s->s3 = NULL;
}
#ifdef TLSEXT_TYPE_opaque_prf_input
if (s->s3->client_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
s->s3->client_opaque_prf_input = NULL;
if (s->s3->server_opaque_prf_input != NULL)
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
s->s3->server_opaque_prf_input = NULL;
#endif
sk_X509_NAME_pop_free(s->s3->tmp.ca_names, X509_NAME_free);
if (s->s3->rrec.comp != NULL) {
- OPENSSL_free(s->s3->rrec.comp);
+ free(s->s3->rrec.comp);
s->s3->rrec.comp = NULL;
}
#ifndef OPENSSL_NO_DH
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (s->next_proto_negotiated) {
- OPENSSL_free(s->next_proto_negotiated);
+ free(s->next_proto_negotiated);
s->next_proto_negotiated = NULL;
s->next_proto_negotiated_len = 0;
}
case SSL_CTRL_SET_TLSEXT_HOSTNAME:
if (larg == TLSEXT_NAMETYPE_host_name) {
if (s->tlsext_hostname != NULL)
- OPENSSL_free(s->tlsext_hostname);
+ free(s->tlsext_hostname);
s->tlsext_hostname = NULL;
ret = 1;
break;
}
if (s->tlsext_opaque_prf_input != NULL)
- OPENSSL_free(s->tlsext_opaque_prf_input);
+ free(s->tlsext_opaque_prf_input);
if ((size_t)larg == 0)
- s->tlsext_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->tlsext_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->tlsext_opaque_prf_input = BUF_memdup(parg, (size_t)larg);
if (s->tlsext_opaque_prf_input != NULL) {
case SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP:
if (s->tlsext_ocsp_resp)
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = parg;
s->tlsext_ocsp_resplen = larg;
ret = 1;
case SSL_CTRL_SET_TLS_EXT_SRP_USERNAME:
ctx->srp_ctx.srp_Mask|=SSL_kSRP;
if (ctx->srp_ctx.login != NULL)
- OPENSSL_free(ctx->srp_ctx.login);
+ free(ctx->srp_ctx.login);
ctx->srp_ctx.login = NULL;
if (parg == NULL)
break;
NULL, 0, NULL);
encodedPoint = (unsigned char *)
- OPENSSL_malloc(encodedlen*sizeof(unsigned char));
+ malloc(encodedlen*sizeof(unsigned char));
bn_ctx = BN_CTX_new();
if ((encodedPoint == NULL) || (bn_ctx == NULL)) {
p += 1;
memcpy((unsigned char*)p,
(unsigned char *)encodedPoint, encodedlen);
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
encodedPoint = NULL;
p += encodedlen;
}
err:
#ifndef OPENSSL_NO_ECDH
if (encodedPoint != NULL)
- OPENSSL_free(encodedPoint);
+ free(encodedPoint);
BN_CTX_free(bn_ctx);
#endif
EVP_MD_CTX_cleanup(&md_ctx);
s2n(psk_len, t);
if (s->session->psk_identity != NULL)
- OPENSSL_free(s->session->psk_identity);
+ free(s->session->psk_identity);
s->session->psk_identity = BUF_strdup((char *)p);
if (s->session->psk_identity == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
}
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint);
if (s->ctx->psk_identity_hint != NULL &&
s->session->psk_identity_hint == NULL) {
goto err;
}
if (s->session->srp_username != NULL)
- OPENSSL_free(s->session->srp_username);
+ free(s->session->srp_username);
s->session->srp_username = BUF_strdup(s->srp_ctx.login);
if (s->session->srp_username == NULL) {
SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,
*/
if (slen_full > 0xFF00)
return -1;
- senc = OPENSSL_malloc(slen_full);
+ senc = malloc(slen_full);
if (!senc)
return -1;
p = senc;
const_p = senc;
sess = d2i_SSL_SESSION(NULL, &const_p, slen_full);
if (sess == NULL) {
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
slen = i2d_SSL_SESSION(sess, NULL);
if (slen > slen_full) {
/* shouldn't ever happen */
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
p = senc;
if (tctx->tlsext_ticket_key_cb) {
if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
&hctx, 1) < 0) {
- OPENSSL_free(senc);
+ free(senc);
return -1;
}
} else {
s->init_num = len;
s->state = SSL3_ST_SW_SESSION_TICKET_B;
s->init_off = 0;
- OPENSSL_free(senc);
+ free(senc);
}
/* SSL3_ST_SW_SESSION_TICKET_B */
if (proto_len + padding_len + 2 != s->init_num)
return 0;
- s->next_proto_negotiated = OPENSSL_malloc(proto_len);
+ s->next_proto_negotiated = malloc(proto_len);
if (!s->next_proto_negotiated) {
SSLerr(SSL_F_SSL3_GET_NEXT_PROTO, ERR_R_MALLOC_FAILURE);
return 0;
/* Note that I cheat in the following 2 assignments. I know
* that if the ASN1_INTEGER passed to ASN1_INTEGER_set
- * is > sizeof(long)+1, the buffer will not be re-OPENSSL_malloc()ed.
+ * is > sizeof(long)+1, the buffer will not be re-malloc()ed.
* This is a bit evil but makes things simple, no dynamic allocation
* to clean up :-) */
a.version.length = LSIZE2;
ai.length = 0;
M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER);
if (ai.data != NULL) {
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
}
ssl_version = (int)ASN1_INTEGER_get(aip);
ret->ssl_version = ssl_version;
if (ai.data != NULL) {
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
}
else
ret->krb5_client_princ_len = os.length;
memcpy(ret->krb5_client_princ, os.data, ret->krb5_client_princ_len);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
ret->key_arg_length = os.length;
memcpy(ret->key_arg, os.data, ret->key_arg_length);
if (os.data != NULL)
- OPENSSL_free(os.data);
+ free(os.data);
ai.length = 0;
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 1);
if (ai.data != NULL) {
ret->time = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 2);
if (ai.data != NULL) {
ret->timeout = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else
ret->sid_ctx_length = os.length;
memcpy(ret->sid_ctx, os.data, os.length);
}
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 5);
if (ai.data != NULL) {
ret->verify_result = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 6);
if (os.data) {
ret->tlsext_hostname = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 7);
if (os.data) {
ret->psk_identity_hint = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 8);
if (os.data) {
ret->psk_identity = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 9);
if (ai.data != NULL) {
ret->tlsext_tick_lifetime_hint = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else if (ret->tlsext_ticklen && ret->session_id_length)
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11);
if (os.data) {
ret->compress_meth = os.data[0];
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
}
#endif
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 12);
if (os.data) {
ret->srp_username = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
{
CERT *ret;
- ret = (CERT *)OPENSSL_malloc(sizeof(CERT));
+ ret = (CERT *)malloc(sizeof(CERT));
if (ret == NULL) {
SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
CERT *ret;
int i;
- ret = (CERT *)OPENSSL_malloc(sizeof(CERT));
+ ret = (CERT *)malloc(sizeof(CERT));
if (ret == NULL) {
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
return (NULL);
EVP_PKEY_free(c->pkeys[i].publickey);
#endif
}
- OPENSSL_free(c);
+ free(c);
}
int
{
SESS_CERT *ret;
- ret = OPENSSL_malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (ret == NULL) {
SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
EC_KEY_free(sc->peer_ecdh_tmp);
#endif
- OPENSSL_free(sc);
+ free(sc);
}
int
MemCheck_off();
ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
if (ssl_comp_methods != NULL) {
- comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
+ comp = (SSL_COMP *)malloc(sizeof(SSL_COMP));
if (comp != NULL) {
comp->method = COMP_zlib();
if (comp->method &&
comp->method->type == NID_undef)
- OPENSSL_free(comp);
+ free(comp);
else {
comp->id = SSL_COMP_ZLIB_IDX;
comp->name = comp->method->name;
curr = curr->next;
}
- number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int));
+ number_uses = malloc((max_strength_bits + 1) * sizeof(int));
if (!number_uses) {
SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE);
return (0);
if (number_uses[i] > 0)
ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p);
- OPENSSL_free(number_uses);
+ free(number_uses);
return (1);
}
#ifdef KSSL_DEBUG
printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers);
#endif /* KSSL_DEBUG */
- co_list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
+ co_list = (CIPHER_ORDER *)malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
if (co_list == NULL) {
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
return(NULL); /* Failure */
/* Now sort by symmetric encryption strength. The above ordering remains
* in force within each class */
if (!ssl_cipher_strength_sort(&head, &tail)) {
- OPENSSL_free(co_list);
+ free(co_list);
return NULL;
}
*/
num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
- ca_list = OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
+ ca_list = malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
if (ca_list == NULL) {
- OPENSSL_free(co_list);
+ free(co_list);
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
return(NULL); /* Failure */
}
if (ok && (strlen(rule_p) > 0))
ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list);
- OPENSSL_free((void *)ca_list); /* Not needed anymore */
+ free((void *)ca_list); /* Not needed anymore */
if (!ok)
{ /* Rule processing failure */
- OPENSSL_free(co_list);
+ free(co_list);
return (NULL);
}
* if we cannot get one.
*/
if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) {
- OPENSSL_free(co_list);
+ free(co_list);
return (NULL);
}
#endif
}
}
- OPENSSL_free(co_list); /* Not needed any longer */
+ free(co_list); /* Not needed any longer */
tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack);
if (tmp_cipher_list == NULL) {
if (buf == NULL) {
len = 128;
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (buf == NULL)
- return("OPENSSL_malloc Error");
+ return("malloc Error");
} else if (len < 128)
return("Buffer too small");
}
MemCheck_off();
- comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
+ comp = (SSL_COMP *)malloc(sizeof(SSL_COMP));
comp->id = id;
comp->method = cm;
load_builtin_compressions();
if (ssl_comp_methods &&
sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) {
- OPENSSL_free(comp);
+ free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID);
return (1);
} else if ((ssl_comp_methods == NULL) ||
!sk_SSL_COMP_push(ssl_comp_methods, comp)) {
- OPENSSL_free(comp);
+ free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
return (1);
return (NULL);
}
- s = (SSL *)OPENSSL_malloc(sizeof(SSL));
+ s = (SSL *)malloc(sizeof(SSL));
if (s == NULL)
goto err;
memset(s, 0, sizeof(SSL));
ssl_cert_free(s->cert);
if (s->ctx != NULL)
SSL_CTX_free(s->ctx); /* decrement reference count */
- OPENSSL_free(s);
+ free(s);
}
SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
#ifndef OPENSSL_NO_TLSEXT
if (s->tlsext_hostname)
- OPENSSL_free(s->tlsext_hostname);
+ free(s->tlsext_hostname);
if (s->initial_ctx)
SSL_CTX_free(s->initial_ctx);
#ifndef OPENSSL_NO_EC
if (s->tlsext_ecpointformatlist)
- OPENSSL_free(s->tlsext_ecpointformatlist);
+ free(s->tlsext_ecpointformatlist);
if (s->tlsext_ellipticcurvelist)
- OPENSSL_free(s->tlsext_ellipticcurvelist);
+ free(s->tlsext_ellipticcurvelist);
#endif /* OPENSSL_NO_EC */
if (s->tlsext_opaque_prf_input)
- OPENSSL_free(s->tlsext_opaque_prf_input);
+ free(s->tlsext_opaque_prf_input);
if (s->tlsext_ocsp_exts)
sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
X509_EXTENSION_free);
if (s->tlsext_ocsp_ids)
sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free);
if (s->tlsext_ocsp_resp)
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
#endif
if (s->client_CA != NULL)
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (s->next_proto_negotiated)
- OPENSSL_free(s->next_proto_negotiated);
+ free(s->next_proto_negotiated);
#endif
#ifndef OPENSSL_NO_SRTP
sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles);
#endif
- OPENSSL_free(s);
+ free(s);
}
void
SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
goto err;
}
- ret = (SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX));
+ ret = (SSL_CTX *)malloc(sizeof(SSL_CTX));
if (ret == NULL)
goto err;
#if 0
static void
SSL_COMP_free(SSL_COMP *comp)
- { OPENSSL_free(comp);
+ { free(comp);
}
#endif
#ifndef OPENSSL_NO_PSK
if (a->psk_identity_hint)
- OPENSSL_free(a->psk_identity_hint);
+ free(a->psk_identity_hint);
#endif
#ifndef OPENSSL_NO_SRP
SSL_CTX_SRP_CTX_free(a);
ENGINE_finish(a->client_cert_engine);
#endif
- OPENSSL_free(a);
+ free(a);
}
void
{
if (s->enc_read_ctx != NULL) {
EVP_CIPHER_CTX_cleanup(s->enc_read_ctx);
- OPENSSL_free(s->enc_read_ctx);
+ free(s->enc_read_ctx);
s->enc_read_ctx = NULL;
}
if (s->enc_write_ctx != NULL) {
EVP_CIPHER_CTX_cleanup(s->enc_write_ctx);
- OPENSSL_free(s->enc_write_ctx);
+ free(s->enc_write_ctx);
s->enc_write_ctx = NULL;
}
#ifndef OPENSSL_NO_COMP
return 0;
}
if (ctx->psk_identity_hint != NULL)
- OPENSSL_free(ctx->psk_identity_hint);
+ free(ctx->psk_identity_hint);
if (identity_hint != NULL) {
ctx->psk_identity_hint = BUF_strdup(identity_hint);
if (ctx->psk_identity_hint == NULL)
return 0;
}
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
if (identity_hint != NULL) {
s->session->psk_identity_hint = BUF_strdup(identity_hint);
if (s->session->psk_identity_hint == NULL)
{
SSL_SESSION *ss;
- ss = (SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION));
+ ss = (SSL_SESSION *)malloc(sizeof(SSL_SESSION));
if (ss == NULL) {
SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
return (0);
#ifndef OPENSSL_NO_EC
if (s->tlsext_ecpointformatlist) {
if (ss->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(ss->tlsext_ecpointformatlist);
- if ((ss->tlsext_ecpointformatlist = OPENSSL_malloc(s->tlsext_ecpointformatlist_length)) == NULL) {
+ free(ss->tlsext_ecpointformatlist);
+ if ((ss->tlsext_ecpointformatlist = malloc(s->tlsext_ecpointformatlist_length)) == NULL) {
SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE);
SSL_SESSION_free(ss);
return 0;
}
if (s->tlsext_ellipticcurvelist) {
if (ss->tlsext_ellipticcurvelist != NULL)
- OPENSSL_free(ss->tlsext_ellipticcurvelist);
- if ((ss->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
+ free(ss->tlsext_ellipticcurvelist);
+ if ((ss->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE);
SSL_SESSION_free(ss);
return 0;
sk_SSL_CIPHER_free(ss->ciphers);
#ifndef OPENSSL_NO_TLSEXT
if (ss->tlsext_hostname != NULL)
- OPENSSL_free(ss->tlsext_hostname);
+ free(ss->tlsext_hostname);
if (ss->tlsext_tick != NULL)
- OPENSSL_free(ss->tlsext_tick);
+ free(ss->tlsext_tick);
#ifndef OPENSSL_NO_EC
ss->tlsext_ecpointformatlist_length = 0;
if (ss->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(ss->tlsext_ecpointformatlist);
+ free(ss->tlsext_ecpointformatlist);
ss->tlsext_ellipticcurvelist_length = 0;
if (ss->tlsext_ellipticcurvelist != NULL)
- OPENSSL_free(ss->tlsext_ellipticcurvelist);
+ free(ss->tlsext_ellipticcurvelist);
#endif /* OPENSSL_NO_EC */
#endif
#ifndef OPENSSL_NO_PSK
if (ss->psk_identity_hint != NULL)
- OPENSSL_free(ss->psk_identity_hint);
+ free(ss->psk_identity_hint);
if (ss->psk_identity != NULL)
- OPENSSL_free(ss->psk_identity);
+ free(ss->psk_identity);
#endif
#ifndef OPENSSL_NO_SRP
if (ss->srp_username != NULL)
- OPENSSL_free(ss->srp_username);
+ free(ss->srp_username);
#endif
OPENSSL_cleanse(ss, sizeof(*ss));
- OPENSSL_free(ss);
+ free(ss);
}
int
#ifndef OPENSSL_NO_KRB5
if (s->kssl_ctx && !s->kssl_ctx->client_princ &&
session->krb5_client_princ_len > 0) {
- s->kssl_ctx->client_princ = (char *)OPENSSL_malloc(session->krb5_client_princ_len + 1);
+ s->kssl_ctx->client_princ = (char *)malloc(session->krb5_client_princ_len + 1);
memcpy(s->kssl_ctx->client_princ, session->krb5_client_princ,
session->krb5_client_princ_len);
s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0';
{
if (s->version >= TLS1_VERSION) {
if (s->tlsext_session_ticket) {
- OPENSSL_free(s->tlsext_session_ticket);
+ free(s->tlsext_session_ticket);
s->tlsext_session_ticket = NULL;
}
- s->tlsext_session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
+ s->tlsext_session_ticket = malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
if (!s->tlsext_session_ticket) {
SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE);
return 0;
ret = 0;
err:
/* We have to set the BIO's to NULL otherwise they will be
- * OPENSSL_free()ed twice. Once when th s_ssl is SSL_free()ed and
+ * free()ed twice. Once when th s_ssl is SSL_free()ed and
* again when c_ssl is SSL_free()ed.
* This is a hack required because s_ssl and c_ssl are sharing the same
* BIO structure and SSL_set_bio() and SSL_free() automatically
if (s->enc_read_ctx != NULL)
reuse_dd = 1;
- else if ((s->enc_read_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
+ else if ((s->enc_read_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
goto err;
else
/* make sure it's intialized in case we exit later with an error */
}
if (s->s3->rrec.comp == NULL)
s->s3->rrec.comp = (unsigned char *)
- OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
+ malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
if (s->s3->rrec.comp == NULL)
goto err;
}
ssl3_cleanup_key_block(s);
- if ((p1 = (unsigned char *)OPENSSL_malloc(num)) == NULL) {
+ if ((p1 = (unsigned char *)malloc(num)) == NULL) {
SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE);
goto err;
}
s->s3->tmp.key_block_length = num;
s->s3->tmp.key_block = p1;
- if ((p2 = (unsigned char *)OPENSSL_malloc(num)) == NULL) {
+ if ((p2 = (unsigned char *)malloc(num)) == NULL) {
SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE);
goto err;
}
err:
if (p2) {
OPENSSL_cleanse(p2, num);
- OPENSSL_free(p2);
+ free(p2);
}
return (ret);
}
printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, olen, label, llen, p, plen);
#endif /* KSSL_DEBUG */
- buff = OPENSSL_malloc(olen);
+ buff = malloc(olen);
if (buff == NULL)
goto err2;
vallen += 2 + contextlen;
}
- val = OPENSSL_malloc(vallen);
+ val = malloc(vallen);
if (val == NULL)
goto err2;
currentvalpos = 0;
rv = 0;
ret:
if (buff != NULL)
- OPENSSL_free(buff);
+ free(buff);
if (val != NULL)
- OPENSSL_free(val);
+ free(val);
return (rv);
}
{
#ifndef OPENSSL_NO_TLSEXT
if (s->tlsext_session_ticket) {
- OPENSSL_free(s->tlsext_session_ticket);
+ free(s->tlsext_session_ticket);
}
#endif /* OPENSSL_NO_TLSEXT */
ssl3_free(s);
else if (s->session && s->tlsext_session_ticket &&
s->tlsext_session_ticket->data) {
ticklen = s->tlsext_session_ticket->length;
- s->session->tlsext_tick = OPENSSL_malloc(ticklen);
+ s->session->tlsext_tick = malloc(ticklen);
if (!s->session->tlsext_tick)
return NULL;
memcpy(s->session->tlsext_tick,
*al = TLS1_AD_UNRECOGNIZED_NAME;
return 0;
}
- if ((s->session->tlsext_hostname = OPENSSL_malloc(len + 1)) == NULL) {
+ if ((s->session->tlsext_hostname = malloc(len + 1)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
memcpy(s->session->tlsext_hostname, sdata, len);
s->session->tlsext_hostname[len] = '\0';
if (strlen(s->session->tlsext_hostname) != len) {
- OPENSSL_free(s->session->tlsext_hostname);
+ free(s->session->tlsext_hostname);
s->session->tlsext_hostname = NULL;
*al = TLS1_AD_UNRECOGNIZED_NAME;
return 0;
*al = SSL_AD_DECODE_ERROR;
return 0;
}
- if ((s->srp_ctx.login = OPENSSL_malloc(len + 1)) == NULL)
+ if ((s->srp_ctx.login = malloc(len + 1)) == NULL)
return -1;
memcpy(s->srp_ctx.login, &data[1], len);
s->srp_ctx.login[len] = '\0';
}
if (!s->hit) {
if (s->session->tlsext_ecpointformatlist) {
- OPENSSL_free(s->session->tlsext_ecpointformatlist);
+ free(s->session->tlsext_ecpointformatlist);
s->session->tlsext_ecpointformatlist = NULL;
}
s->session->tlsext_ecpointformatlist_length = 0;
- if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) {
+ if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
return 0;
}
s->session->tlsext_ellipticcurvelist_length = 0;
- if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL) {
+ if ((s->session->tlsext_ellipticcurvelist = malloc(ellipticcurvelist_length)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
}
if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
if (s->s3->client_opaque_prf_input_len == 0)
- s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len);
if (s->s3->client_opaque_prf_input == NULL) {
}
s->session->tlsext_ecpointformatlist_length = 0;
if (s->session->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(s->session->tlsext_ecpointformatlist);
- if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) {
+ free(s->session->tlsext_ecpointformatlist);
+ if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
}
if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
if (s->s3->server_opaque_prf_input_len == 0)
- s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len);
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
- s->next_proto_negotiated = OPENSSL_malloc(selected_len);
+ s->next_proto_negotiated = malloc(selected_len);
if (!s->next_proto_negotiated) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
using_ecc = using_ecc && (s->version >= TLS1_VERSION);
if (using_ecc) {
if (s->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(s->tlsext_ecpointformatlist);
- if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) {
+ free(s->tlsext_ecpointformatlist);
+ if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) {
SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE);
return -1;
}
/* we support all named elliptic curves in draft-ietf-tls-ecc-12 */
if (s->tlsext_ellipticcurvelist != NULL)
- OPENSSL_free(s->tlsext_ellipticcurvelist);
+ free(s->tlsext_ellipticcurvelist);
s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2;
- if ((s->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
+ if ((s->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
s->tlsext_ellipticcurvelist_length = 0;
SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE);
return -1;
if (s->tlsext_opaque_prf_input != NULL) {
if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
if (s->tlsext_opaque_prf_input_len == 0)
- s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len);
if (s->s3->client_opaque_prf_input == NULL) {
if (using_ecc) {
if (s->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(s->tlsext_ecpointformatlist);
- if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) {
+ free(s->tlsext_ecpointformatlist);
+ if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) {
SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT, ERR_R_MALLOC_FAILURE);
return -1;
}
}
if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
s->s3->server_opaque_prf_input = NULL;
if (s->tlsext_opaque_prf_input != NULL) {
* of the same length as the client opaque PRF input! */
if (s->tlsext_opaque_prf_input_len == 0)
- s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len);
if (s->s3->server_opaque_prf_input == NULL) {
* there is no response.
*/
if (s->tlsext_ocsp_resp) {
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = NULL;
}
s->tlsext_ocsp_resplen = -1;
/* Move p after IV to start of encrypted ticket, update length */
p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);
eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx);
- sdec = OPENSSL_malloc(eticklen);
+ sdec = malloc(eticklen);
if (!sdec) {
EVP_CIPHER_CTX_cleanup(&ctx);
return -1;
p = sdec;
sess = d2i_SSL_SESSION(NULL, &p, slen);
- OPENSSL_free(sdec);
+ free(sdec);
if (sess) {
/* The session ID, if non-empty, is used by some clients to
* detect that the ticket has been accepted. So we copy it to
SSL_CTX_SRP_CTX_free(struct ssl_ctx_st *ctx) {
if (ctx == NULL)
return 0;
- OPENSSL_free(ctx->srp_ctx.login);
+ free(ctx->srp_ctx.login);
BN_free(ctx->srp_ctx.N);
BN_free(ctx->srp_ctx.g);
BN_free(ctx->srp_ctx.s);
SSL_SRP_CTX_free(struct ssl_st *s) {
if (s == NULL)
return 0;
- OPENSSL_free(s->srp_ctx.login);
+ free(s->srp_ctx.login);
BN_free(s->srp_ctx.N);
BN_free(s->srp_ctx.g);
BN_free(s->srp_ctx.s);
return (1);
err:
- OPENSSL_free(s->srp_ctx.login);
+ free(s->srp_ctx.login);
BN_free(s->srp_ctx.N);
BN_free(s->srp_ctx.g);
BN_free(s->srp_ctx.s);
goto err;
tmp_len = BN_num_bytes(K);
- if ((tmp = OPENSSL_malloc(tmp_len)) == NULL)
+ if ((tmp = malloc(tmp_len)) == NULL)
goto err;
BN_bn2bin(K, tmp);
ret = s->method->ssl3_enc->generate_master_secret(s, master_key, tmp, tmp_len);
err:
if (tmp) {
OPENSSL_cleanse(tmp, tmp_len);
- OPENSSL_free(tmp);
+ free(tmp);
}
BN_clear_free(K);
BN_clear_free(u);
goto err;
tmp_len = BN_num_bytes(K);
- if ((tmp = OPENSSL_malloc(tmp_len)) == NULL) goto err;
+ if ((tmp = malloc(tmp_len)) == NULL) goto err;
BN_bn2bin(K, tmp);
ret = s->method->ssl3_enc->generate_master_secret(s, master_key,
tmp, tmp_len);
err:
if (tmp) {
OPENSSL_cleanse(tmp, tmp_len);
- OPENSSL_free(tmp);
+ free(tmp);
}
BN_clear_free(K);
BN_clear_free(x);
if (passwd) {
OPENSSL_cleanse(passwd, strlen(passwd));
- OPENSSL_free(passwd);
+ free(passwd);
}
BN_clear_free(u);
return ret;
/* Note that I cheat in the following 2 assignments. I know
* that if the ASN1_INTEGER passed to ASN1_INTEGER_set
- * is > sizeof(long)+1, the buffer will not be re-OPENSSL_malloc()ed.
+ * is > sizeof(long)+1, the buffer will not be re-malloc()ed.
* This is a bit evil but makes things simple, no dynamic allocation
* to clean up :-) */
a.version.length = LSIZE2;
ai.length = 0;
M_ASN1_D2I_get_x(ASN1_INTEGER, aip, d2i_ASN1_INTEGER);
if (ai.data != NULL) {
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
}
ssl_version = (int)ASN1_INTEGER_get(aip);
ret->ssl_version = ssl_version;
if (ai.data != NULL) {
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
}
else
ret->krb5_client_princ_len = os.length;
memcpy(ret->krb5_client_princ, os.data, ret->krb5_client_princ_len);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
ret->key_arg_length = os.length;
memcpy(ret->key_arg, os.data, ret->key_arg_length);
if (os.data != NULL)
- OPENSSL_free(os.data);
+ free(os.data);
ai.length = 0;
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 1);
if (ai.data != NULL) {
ret->time = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 2);
if (ai.data != NULL) {
ret->timeout = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else
ret->sid_ctx_length = os.length;
memcpy(ret->sid_ctx, os.data, os.length);
}
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 5);
if (ai.data != NULL) {
ret->verify_result = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 6);
if (os.data) {
ret->tlsext_hostname = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 7);
if (os.data) {
ret->psk_identity_hint = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 8);
if (os.data) {
ret->psk_identity = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
M_ASN1_D2I_get_EXP_opt(aip, d2i_ASN1_INTEGER, 9);
if (ai.data != NULL) {
ret->tlsext_tick_lifetime_hint = ASN1_INTEGER_get(aip);
- OPENSSL_free(ai.data);
+ free(ai.data);
ai.data = NULL;
ai.length = 0;
} else if (ret->tlsext_ticklen && ret->session_id_length)
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 11);
if (os.data) {
ret->compress_meth = os.data[0];
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
}
#endif
M_ASN1_D2I_get_EXP_opt(osp, d2i_ASN1_OCTET_STRING, 12);
if (os.data) {
ret->srp_username = BUF_strndup((char *)os.data, os.length);
- OPENSSL_free(os.data);
+ free(os.data);
os.data = NULL;
os.length = 0;
} else
{
CERT *ret;
- ret = (CERT *)OPENSSL_malloc(sizeof(CERT));
+ ret = (CERT *)malloc(sizeof(CERT));
if (ret == NULL) {
SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
CERT *ret;
int i;
- ret = (CERT *)OPENSSL_malloc(sizeof(CERT));
+ ret = (CERT *)malloc(sizeof(CERT));
if (ret == NULL) {
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
return (NULL);
EVP_PKEY_free(c->pkeys[i].publickey);
#endif
}
- OPENSSL_free(c);
+ free(c);
}
int
{
SESS_CERT *ret;
- ret = OPENSSL_malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (ret == NULL) {
SSLerr(SSL_F_SSL_SESS_CERT_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
EC_KEY_free(sc->peer_ecdh_tmp);
#endif
- OPENSSL_free(sc);
+ free(sc);
}
int
MemCheck_off();
ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
if (ssl_comp_methods != NULL) {
- comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
+ comp = (SSL_COMP *)malloc(sizeof(SSL_COMP));
if (comp != NULL) {
comp->method = COMP_zlib();
if (comp->method &&
comp->method->type == NID_undef)
- OPENSSL_free(comp);
+ free(comp);
else {
comp->id = SSL_COMP_ZLIB_IDX;
comp->name = comp->method->name;
curr = curr->next;
}
- number_uses = OPENSSL_malloc((max_strength_bits + 1) * sizeof(int));
+ number_uses = malloc((max_strength_bits + 1) * sizeof(int));
if (!number_uses) {
SSLerr(SSL_F_SSL_CIPHER_STRENGTH_SORT, ERR_R_MALLOC_FAILURE);
return (0);
if (number_uses[i] > 0)
ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ORD, i, head_p, tail_p);
- OPENSSL_free(number_uses);
+ free(number_uses);
return (1);
}
#ifdef KSSL_DEBUG
printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers);
#endif /* KSSL_DEBUG */
- co_list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
+ co_list = (CIPHER_ORDER *)malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
if (co_list == NULL) {
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
return(NULL); /* Failure */
/* Now sort by symmetric encryption strength. The above ordering remains
* in force within each class */
if (!ssl_cipher_strength_sort(&head, &tail)) {
- OPENSSL_free(co_list);
+ free(co_list);
return NULL;
}
*/
num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
- ca_list = OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
+ ca_list = malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
if (ca_list == NULL) {
- OPENSSL_free(co_list);
+ free(co_list);
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST, ERR_R_MALLOC_FAILURE);
return(NULL); /* Failure */
}
if (ok && (strlen(rule_p) > 0))
ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list);
- OPENSSL_free((void *)ca_list); /* Not needed anymore */
+ free((void *)ca_list); /* Not needed anymore */
if (!ok)
{ /* Rule processing failure */
- OPENSSL_free(co_list);
+ free(co_list);
return (NULL);
}
* if we cannot get one.
*/
if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) {
- OPENSSL_free(co_list);
+ free(co_list);
return (NULL);
}
#endif
}
}
- OPENSSL_free(co_list); /* Not needed any longer */
+ free(co_list); /* Not needed any longer */
tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack);
if (tmp_cipher_list == NULL) {
if (buf == NULL) {
len = 128;
- buf = OPENSSL_malloc(len);
+ buf = malloc(len);
if (buf == NULL)
- return("OPENSSL_malloc Error");
+ return("malloc Error");
} else if (len < 128)
return("Buffer too small");
}
MemCheck_off();
- comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
+ comp = (SSL_COMP *)malloc(sizeof(SSL_COMP));
comp->id = id;
comp->method = cm;
load_builtin_compressions();
if (ssl_comp_methods &&
sk_SSL_COMP_find(ssl_comp_methods, comp) >= 0) {
- OPENSSL_free(comp);
+ free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, SSL_R_DUPLICATE_COMPRESSION_ID);
return (1);
} else if ((ssl_comp_methods == NULL) ||
!sk_SSL_COMP_push(ssl_comp_methods, comp)) {
- OPENSSL_free(comp);
+ free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
return (1);
return (NULL);
}
- s = (SSL *)OPENSSL_malloc(sizeof(SSL));
+ s = (SSL *)malloc(sizeof(SSL));
if (s == NULL)
goto err;
memset(s, 0, sizeof(SSL));
ssl_cert_free(s->cert);
if (s->ctx != NULL)
SSL_CTX_free(s->ctx); /* decrement reference count */
- OPENSSL_free(s);
+ free(s);
}
SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
#ifndef OPENSSL_NO_TLSEXT
if (s->tlsext_hostname)
- OPENSSL_free(s->tlsext_hostname);
+ free(s->tlsext_hostname);
if (s->initial_ctx)
SSL_CTX_free(s->initial_ctx);
#ifndef OPENSSL_NO_EC
if (s->tlsext_ecpointformatlist)
- OPENSSL_free(s->tlsext_ecpointformatlist);
+ free(s->tlsext_ecpointformatlist);
if (s->tlsext_ellipticcurvelist)
- OPENSSL_free(s->tlsext_ellipticcurvelist);
+ free(s->tlsext_ellipticcurvelist);
#endif /* OPENSSL_NO_EC */
if (s->tlsext_opaque_prf_input)
- OPENSSL_free(s->tlsext_opaque_prf_input);
+ free(s->tlsext_opaque_prf_input);
if (s->tlsext_ocsp_exts)
sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
X509_EXTENSION_free);
if (s->tlsext_ocsp_ids)
sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free);
if (s->tlsext_ocsp_resp)
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
#endif
if (s->client_CA != NULL)
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (s->next_proto_negotiated)
- OPENSSL_free(s->next_proto_negotiated);
+ free(s->next_proto_negotiated);
#endif
#ifndef OPENSSL_NO_SRTP
sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles);
#endif
- OPENSSL_free(s);
+ free(s);
}
void
SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
goto err;
}
- ret = (SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX));
+ ret = (SSL_CTX *)malloc(sizeof(SSL_CTX));
if (ret == NULL)
goto err;
#if 0
static void
SSL_COMP_free(SSL_COMP *comp)
- { OPENSSL_free(comp);
+ { free(comp);
}
#endif
#ifndef OPENSSL_NO_PSK
if (a->psk_identity_hint)
- OPENSSL_free(a->psk_identity_hint);
+ free(a->psk_identity_hint);
#endif
#ifndef OPENSSL_NO_SRP
SSL_CTX_SRP_CTX_free(a);
ENGINE_finish(a->client_cert_engine);
#endif
- OPENSSL_free(a);
+ free(a);
}
void
{
if (s->enc_read_ctx != NULL) {
EVP_CIPHER_CTX_cleanup(s->enc_read_ctx);
- OPENSSL_free(s->enc_read_ctx);
+ free(s->enc_read_ctx);
s->enc_read_ctx = NULL;
}
if (s->enc_write_ctx != NULL) {
EVP_CIPHER_CTX_cleanup(s->enc_write_ctx);
- OPENSSL_free(s->enc_write_ctx);
+ free(s->enc_write_ctx);
s->enc_write_ctx = NULL;
}
#ifndef OPENSSL_NO_COMP
return 0;
}
if (ctx->psk_identity_hint != NULL)
- OPENSSL_free(ctx->psk_identity_hint);
+ free(ctx->psk_identity_hint);
if (identity_hint != NULL) {
ctx->psk_identity_hint = BUF_strdup(identity_hint);
if (ctx->psk_identity_hint == NULL)
return 0;
}
if (s->session->psk_identity_hint != NULL)
- OPENSSL_free(s->session->psk_identity_hint);
+ free(s->session->psk_identity_hint);
if (identity_hint != NULL) {
s->session->psk_identity_hint = BUF_strdup(identity_hint);
if (s->session->psk_identity_hint == NULL)
{
SSL_SESSION *ss;
- ss = (SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION));
+ ss = (SSL_SESSION *)malloc(sizeof(SSL_SESSION));
if (ss == NULL) {
SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
return (0);
#ifndef OPENSSL_NO_EC
if (s->tlsext_ecpointformatlist) {
if (ss->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(ss->tlsext_ecpointformatlist);
- if ((ss->tlsext_ecpointformatlist = OPENSSL_malloc(s->tlsext_ecpointformatlist_length)) == NULL) {
+ free(ss->tlsext_ecpointformatlist);
+ if ((ss->tlsext_ecpointformatlist = malloc(s->tlsext_ecpointformatlist_length)) == NULL) {
SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE);
SSL_SESSION_free(ss);
return 0;
}
if (s->tlsext_ellipticcurvelist) {
if (ss->tlsext_ellipticcurvelist != NULL)
- OPENSSL_free(ss->tlsext_ellipticcurvelist);
- if ((ss->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
+ free(ss->tlsext_ellipticcurvelist);
+ if ((ss->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_MALLOC_FAILURE);
SSL_SESSION_free(ss);
return 0;
sk_SSL_CIPHER_free(ss->ciphers);
#ifndef OPENSSL_NO_TLSEXT
if (ss->tlsext_hostname != NULL)
- OPENSSL_free(ss->tlsext_hostname);
+ free(ss->tlsext_hostname);
if (ss->tlsext_tick != NULL)
- OPENSSL_free(ss->tlsext_tick);
+ free(ss->tlsext_tick);
#ifndef OPENSSL_NO_EC
ss->tlsext_ecpointformatlist_length = 0;
if (ss->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(ss->tlsext_ecpointformatlist);
+ free(ss->tlsext_ecpointformatlist);
ss->tlsext_ellipticcurvelist_length = 0;
if (ss->tlsext_ellipticcurvelist != NULL)
- OPENSSL_free(ss->tlsext_ellipticcurvelist);
+ free(ss->tlsext_ellipticcurvelist);
#endif /* OPENSSL_NO_EC */
#endif
#ifndef OPENSSL_NO_PSK
if (ss->psk_identity_hint != NULL)
- OPENSSL_free(ss->psk_identity_hint);
+ free(ss->psk_identity_hint);
if (ss->psk_identity != NULL)
- OPENSSL_free(ss->psk_identity);
+ free(ss->psk_identity);
#endif
#ifndef OPENSSL_NO_SRP
if (ss->srp_username != NULL)
- OPENSSL_free(ss->srp_username);
+ free(ss->srp_username);
#endif
OPENSSL_cleanse(ss, sizeof(*ss));
- OPENSSL_free(ss);
+ free(ss);
}
int
#ifndef OPENSSL_NO_KRB5
if (s->kssl_ctx && !s->kssl_ctx->client_princ &&
session->krb5_client_princ_len > 0) {
- s->kssl_ctx->client_princ = (char *)OPENSSL_malloc(session->krb5_client_princ_len + 1);
+ s->kssl_ctx->client_princ = (char *)malloc(session->krb5_client_princ_len + 1);
memcpy(s->kssl_ctx->client_princ, session->krb5_client_princ,
session->krb5_client_princ_len);
s->kssl_ctx->client_princ[session->krb5_client_princ_len] = '\0';
{
if (s->version >= TLS1_VERSION) {
if (s->tlsext_session_ticket) {
- OPENSSL_free(s->tlsext_session_ticket);
+ free(s->tlsext_session_ticket);
s->tlsext_session_ticket = NULL;
}
- s->tlsext_session_ticket = OPENSSL_malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
+ s->tlsext_session_ticket = malloc(sizeof(TLS_SESSION_TICKET_EXT) + ext_len);
if (!s->tlsext_session_ticket) {
SSLerr(SSL_F_SSL_SET_SESSION_TICKET_EXT, ERR_R_MALLOC_FAILURE);
return 0;
if (s->enc_read_ctx != NULL)
reuse_dd = 1;
- else if ((s->enc_read_ctx = OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
+ else if ((s->enc_read_ctx = malloc(sizeof(EVP_CIPHER_CTX))) == NULL)
goto err;
else
/* make sure it's intialized in case we exit later with an error */
}
if (s->s3->rrec.comp == NULL)
s->s3->rrec.comp = (unsigned char *)
- OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
+ malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
if (s->s3->rrec.comp == NULL)
goto err;
}
ssl3_cleanup_key_block(s);
- if ((p1 = (unsigned char *)OPENSSL_malloc(num)) == NULL) {
+ if ((p1 = (unsigned char *)malloc(num)) == NULL) {
SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE);
goto err;
}
s->s3->tmp.key_block_length = num;
s->s3->tmp.key_block = p1;
- if ((p2 = (unsigned char *)OPENSSL_malloc(num)) == NULL) {
+ if ((p2 = (unsigned char *)malloc(num)) == NULL) {
SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE);
goto err;
}
err:
if (p2) {
OPENSSL_cleanse(p2, num);
- OPENSSL_free(p2);
+ free(p2);
}
return (ret);
}
printf ("tls1_export_keying_material(%p,%p,%d,%s,%d,%p,%d)\n", s, out, olen, label, llen, p, plen);
#endif /* KSSL_DEBUG */
- buff = OPENSSL_malloc(olen);
+ buff = malloc(olen);
if (buff == NULL)
goto err2;
vallen += 2 + contextlen;
}
- val = OPENSSL_malloc(vallen);
+ val = malloc(vallen);
if (val == NULL)
goto err2;
currentvalpos = 0;
rv = 0;
ret:
if (buff != NULL)
- OPENSSL_free(buff);
+ free(buff);
if (val != NULL)
- OPENSSL_free(val);
+ free(val);
return (rv);
}
{
#ifndef OPENSSL_NO_TLSEXT
if (s->tlsext_session_ticket) {
- OPENSSL_free(s->tlsext_session_ticket);
+ free(s->tlsext_session_ticket);
}
#endif /* OPENSSL_NO_TLSEXT */
ssl3_free(s);
else if (s->session && s->tlsext_session_ticket &&
s->tlsext_session_ticket->data) {
ticklen = s->tlsext_session_ticket->length;
- s->session->tlsext_tick = OPENSSL_malloc(ticklen);
+ s->session->tlsext_tick = malloc(ticklen);
if (!s->session->tlsext_tick)
return NULL;
memcpy(s->session->tlsext_tick,
*al = TLS1_AD_UNRECOGNIZED_NAME;
return 0;
}
- if ((s->session->tlsext_hostname = OPENSSL_malloc(len + 1)) == NULL) {
+ if ((s->session->tlsext_hostname = malloc(len + 1)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
memcpy(s->session->tlsext_hostname, sdata, len);
s->session->tlsext_hostname[len] = '\0';
if (strlen(s->session->tlsext_hostname) != len) {
- OPENSSL_free(s->session->tlsext_hostname);
+ free(s->session->tlsext_hostname);
s->session->tlsext_hostname = NULL;
*al = TLS1_AD_UNRECOGNIZED_NAME;
return 0;
*al = SSL_AD_DECODE_ERROR;
return 0;
}
- if ((s->srp_ctx.login = OPENSSL_malloc(len + 1)) == NULL)
+ if ((s->srp_ctx.login = malloc(len + 1)) == NULL)
return -1;
memcpy(s->srp_ctx.login, &data[1], len);
s->srp_ctx.login[len] = '\0';
}
if (!s->hit) {
if (s->session->tlsext_ecpointformatlist) {
- OPENSSL_free(s->session->tlsext_ecpointformatlist);
+ free(s->session->tlsext_ecpointformatlist);
s->session->tlsext_ecpointformatlist = NULL;
}
s->session->tlsext_ecpointformatlist_length = 0;
- if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) {
+ if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
return 0;
}
s->session->tlsext_ellipticcurvelist_length = 0;
- if ((s->session->tlsext_ellipticcurvelist = OPENSSL_malloc(ellipticcurvelist_length)) == NULL) {
+ if ((s->session->tlsext_ellipticcurvelist = malloc(ellipticcurvelist_length)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
}
if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
if (s->s3->client_opaque_prf_input_len == 0)
- s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->client_opaque_prf_input = BUF_memdup(sdata, s->s3->client_opaque_prf_input_len);
if (s->s3->client_opaque_prf_input == NULL) {
}
s->session->tlsext_ecpointformatlist_length = 0;
if (s->session->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(s->session->tlsext_ecpointformatlist);
- if ((s->session->tlsext_ecpointformatlist = OPENSSL_malloc(ecpointformatlist_length)) == NULL) {
+ free(s->session->tlsext_ecpointformatlist);
+ if ((s->session->tlsext_ecpointformatlist = malloc(ecpointformatlist_length)) == NULL) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
}
if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
if (s->s3->server_opaque_prf_input_len == 0)
- s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->server_opaque_prf_input = BUF_memdup(sdata, s->s3->server_opaque_prf_input_len);
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
}
- s->next_proto_negotiated = OPENSSL_malloc(selected_len);
+ s->next_proto_negotiated = malloc(selected_len);
if (!s->next_proto_negotiated) {
*al = TLS1_AD_INTERNAL_ERROR;
return 0;
using_ecc = using_ecc && (s->version >= TLS1_VERSION);
if (using_ecc) {
if (s->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(s->tlsext_ecpointformatlist);
- if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) {
+ free(s->tlsext_ecpointformatlist);
+ if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) {
SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE);
return -1;
}
/* we support all named elliptic curves in draft-ietf-tls-ecc-12 */
if (s->tlsext_ellipticcurvelist != NULL)
- OPENSSL_free(s->tlsext_ellipticcurvelist);
+ free(s->tlsext_ellipticcurvelist);
s->tlsext_ellipticcurvelist_length = sizeof(pref_list)/sizeof(pref_list[0]) * 2;
- if ((s->tlsext_ellipticcurvelist = OPENSSL_malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
+ if ((s->tlsext_ellipticcurvelist = malloc(s->tlsext_ellipticcurvelist_length)) == NULL) {
s->tlsext_ellipticcurvelist_length = 0;
SSLerr(SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT, ERR_R_MALLOC_FAILURE);
return -1;
if (s->tlsext_opaque_prf_input != NULL) {
if (s->s3->client_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->client_opaque_prf_input);
+ free(s->s3->client_opaque_prf_input);
if (s->tlsext_opaque_prf_input_len == 0)
- s->s3->client_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->client_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->client_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len);
if (s->s3->client_opaque_prf_input == NULL) {
if (using_ecc) {
if (s->tlsext_ecpointformatlist != NULL)
- OPENSSL_free(s->tlsext_ecpointformatlist);
- if ((s->tlsext_ecpointformatlist = OPENSSL_malloc(3)) == NULL) {
+ free(s->tlsext_ecpointformatlist);
+ if ((s->tlsext_ecpointformatlist = malloc(3)) == NULL) {
SSLerr(SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT, ERR_R_MALLOC_FAILURE);
return -1;
}
}
if (s->s3->server_opaque_prf_input != NULL) /* shouldn't really happen */
- OPENSSL_free(s->s3->server_opaque_prf_input);
+ free(s->s3->server_opaque_prf_input);
s->s3->server_opaque_prf_input = NULL;
if (s->tlsext_opaque_prf_input != NULL) {
* of the same length as the client opaque PRF input! */
if (s->tlsext_opaque_prf_input_len == 0)
- s->s3->server_opaque_prf_input = OPENSSL_malloc(1); /* dummy byte just to get non-NULL */
+ s->s3->server_opaque_prf_input = malloc(1); /* dummy byte just to get non-NULL */
else
s->s3->server_opaque_prf_input = BUF_memdup(s->tlsext_opaque_prf_input, s->tlsext_opaque_prf_input_len);
if (s->s3->server_opaque_prf_input == NULL) {
* there is no response.
*/
if (s->tlsext_ocsp_resp) {
- OPENSSL_free(s->tlsext_ocsp_resp);
+ free(s->tlsext_ocsp_resp);
s->tlsext_ocsp_resp = NULL;
}
s->tlsext_ocsp_resplen = -1;
/* Move p after IV to start of encrypted ticket, update length */
p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);
eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx);
- sdec = OPENSSL_malloc(eticklen);
+ sdec = malloc(eticklen);
if (!sdec) {
EVP_CIPHER_CTX_cleanup(&ctx);
return -1;
p = sdec;
sess = d2i_SSL_SESSION(NULL, &p, slen);
- OPENSSL_free(sdec);
+ free(sdec);
if (sess) {
/* The session ID, if non-empty, is used by some clients to
* detect that the ticket has been accepted. So we copy it to