arg->argc = 0;
if (arg->size == 0) {
arg->size = 20;
- arg->argv = (char **)OPENSSL_malloc(sizeof(char *) * arg->size);
+ arg->argv = OPENSSL_malloc(sizeof(char *) * arg->size);
if (arg->argv == NULL)
return 0;
}
/* The start of something good :-) */
if (arg->argc >= arg->size) {
arg->size += 20;
- arg->argv = (char **)OPENSSL_realloc(arg->argv,
- sizeof(char *) * arg->size);
+ arg->argv = OPENSSL_realloc(arg->argv, sizeof(char *) * arg->size);
if (arg->argv == NULL)
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 = OPENSSL_malloc(bufsiz);
if (!buff) {
BIO_printf(bio_err, "Out of memory\n");
UI_free(ui);
goto end;
/* We now just add it to the database */
- row[DB_type] = (char *)OPENSSL_malloc(2);
+ row[DB_type] = OPENSSL_malloc(2);
tm = X509_get_notAfter(ret);
- row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1);
+ row[DB_exp_date] = OPENSSL_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] = OPENSSL_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 = OPENSSL_malloc(sizeof(char *) * (DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto end;
}
row[DB_serial], row[DB_name]);
/* We now just add it to the database */
- row[DB_type] = (char *)OPENSSL_malloc(2);
+ row[DB_type] = OPENSSL_malloc(2);
tm = X509_get_notAfter(x509);
- row[DB_exp_date] = (char *)OPENSSL_malloc(tm->length + 1);
+ row[DB_exp_date] = OPENSSL_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] = OPENSSL_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 = OPENSSL_malloc(sizeof(char *) * (DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto end;
}
/* 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 = OPENSSL_malloc(a_tm->length + 1);
if (a_tm_s == NULL) {
cnt = -1;
goto end;
int engine_impl = 0;
prog = opt_progname(argv[0]);
- if ((buf = (unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL) {
+ if ((buf = OPENSSL_malloc(BUFSIZE)) == NULL) {
BIO_printf(bio_err, "%s: out of memory\n", prog);
goto end;
}
len = BN_num_bytes(dh->p);
bits = BN_num_bits(dh->p);
- data = (unsigned char *)OPENSSL_malloc(len);
+ data = OPENSSL_malloc(len);
if (data == NULL) {
perror("OPENSSL_malloc");
goto end;
len = BN_num_bytes(dsa->p);
bits_p = BN_num_bits(dsa->p);
- data = (unsigned char *)OPENSSL_malloc(len + 20);
+ data = OPENSSL_malloc(len + 20);
if (data == NULL) {
perror("OPENSSL_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 = OPENSSL_malloc(buf_len);
if (buffer == NULL) {
perror("OPENSSL_malloc");
goto end;
BIO_printf(bio_err, "bufsize=%d\n", bsize);
strbuf = OPENSSL_malloc(SIZE);
- buff = (unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
+ buff = OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
if ((buff == NULL) || (strbuf == NULL)) {
BIO_printf(bio_err, "OPENSSL_malloc failure %ld\n",
(long)EVP_ENCODE_LENGTH(bsize));
i = 1;
size = i2d_RSA_NET(rsa, NULL, NULL, 0);
- if ((p = (unsigned char *)OPENSSL_malloc(size)) == NULL) {
+ if ((p = OPENSSL_malloc(size)) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto end;
}
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 = OPENSSL_malloc(PWD_STRLEN + 1);
PW_CB_DATA cb_tmp;
int l;
{
EBCDIC_OUTBUFF *wbuf;
- wbuf = (EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
+ wbuf = OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024);
if (!wbuf)
return 0;
wbuf->alloced = 1024;
num = num + num; /* double the size */
if (num < inl)
num = inl;
- wbuf = (EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
+ wbuf = OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + num);
if (!wbuf)
return 0;
OPENSSL_free(b->ptr);
*host = NULL;
/* return(0); */
} else {
- if ((*host = (char *)OPENSSL_malloc(strlen(h1->h_name) + 1)) == NULL) {
+ if ((*host = OPENSSL_malloc(strlen(h1->h_name) + 1)) == NULL) {
perror("OPENSSL_malloc");
closesocket(ret);
return (0);
ecdh_doit[i] = 0;
#endif
- if ((buf_malloc =
- (unsigned char *)OPENSSL_malloc((int)BUFSIZE + misalign)) == NULL) {
+ if ((buf_malloc = OPENSSL_malloc((int)BUFSIZE + misalign)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
goto end;
}
- if ((buf2_malloc =
- (unsigned char *)OPENSSL_malloc((int)BUFSIZE + misalign)) == NULL) {
+ if ((buf2_malloc = OPENSSL_malloc((int)BUFSIZE + misalign)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
goto end;
}
char **irow;
int i;
- if ((irow =
- (char **)OPENSSL_malloc(sizeof(char *) * (DB_NUMBER + 1))) == NULL) {
+ if ((irow = OPENSSL_malloc(sizeof(char *) * (DB_NUMBER + 1))) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
return 0;
}
*/
int i, count = *argc;
- char **newargv = (char **)OPENSSL_malloc((count + 1) * sizeof *newargv);
+ char **newargv = OPENSSL_malloc((count + 1) * sizeof *newargv);
for (i = 0; i < count; i++)
newargv[i] = argv[i];
ret->flags |= (ASN1_STRING_FLAG_BITS_LEFT | i); /* set */
if (len-- > 1) { /* using one because of the bits left byte */
- s = (unsigned char *)OPENSSL_malloc((int)len);
+ s = OPENSSL_malloc((int)len);
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
if (!value)
return (1); /* Don't need to set */
if (a->data == NULL)
- c = (unsigned char *)OPENSSL_malloc(w + 1);
+ c = OPENSSL_malloc(w + 1);
else
- c = (unsigned char *)OPENSSL_realloc_clean(a->data,
- a->length, w + 1);
+ c = OPENSSL_realloc_clean(a->data, a->length, w + 1);
if (c == NULL) {
ASN1err(ASN1_F_ASN1_BIT_STRING_SET_BIT, ERR_R_MALLOC_FAILURE);
return 0;
unsigned char *str, *p;
i = i2d(data, NULL);
- if ((str = (unsigned char *)OPENSSL_malloc(i)) == NULL) {
+ if ((str = OPENSSL_malloc(i)) == NULL) {
ASN1err(ASN1_F_ASN1_DIGEST, ERR_R_MALLOC_FAILURE);
return (0);
}
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)
+ if ((a->data = OPENSSL_malloc(sizeof(long) + 1)) != NULL)
memset((char *)a->data, 0, sizeof(long) + 1);
}
if (a->data == NULL) {
int i, j = 0, n, ret = 1;
n = i2d(x, NULL);
- b = (char *)OPENSSL_malloc(n);
+ b = OPENSSL_malloc(n);
if (b == NULL) {
ASN1err(ASN1_F_ASN1_I2D_BIO, ERR_R_MALLOC_FAILURE);
return (0);
* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it signifies
* a missing NULL parameter.
*/
- s = (unsigned char *)OPENSSL_malloc((int)len + 1);
+ s = OPENSSL_malloc((int)len + 1);
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
* We must OPENSSL_malloc stuff, even for 0 bytes otherwise it signifies
* a missing NULL parameter.
*/
- s = (unsigned char *)OPENSSL_malloc((int)len + 1);
+ s = OPENSSL_malloc((int)len + 1);
if (s == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
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)
+ if ((a->data = OPENSSL_malloc(sizeof(long) + 1)) != NULL)
memset((char *)a->data, 0, sizeof(long) + 1);
}
if (a->data == NULL) {
ret->length = 0;
if (data != NULL)
OPENSSL_free(data);
- data = (unsigned char *)OPENSSL_malloc(length);
+ data = OPENSSL_malloc(length);
if (data == NULL) {
i = ERR_R_MALLOC_FAILURE;
goto err;
{
ASN1_OBJECT *ret;
- ret = (ASN1_OBJECT *)OPENSSL_malloc(sizeof(ASN1_OBJECT));
+ ret = OPENSSL_malloc(sizeof(ASN1_OBJECT));
if (ret == NULL) {
ASN1err(ASN1_F_ASN1_OBJECT_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
}
inl = i2d(data, NULL);
- buf_in = (unsigned char *)OPENSSL_malloc((unsigned int)inl);
+ buf_in = OPENSSL_malloc((unsigned int)inl);
outll = outl = EVP_PKEY_size(pkey);
- buf_out = (unsigned char *)OPENSSL_malloc((unsigned int)outl);
+ buf_out = OPENSSL_malloc((unsigned int)outl);
if ((buf_in == NULL) || (buf_out == NULL)) {
outl = 0;
ASN1err(ASN1_F_ASN1_SIGN, ERR_R_MALLOC_FAILURE);
{
ASN1_STRING *ret;
- ret = (ASN1_STRING *)OPENSSL_malloc(sizeof(ASN1_STRING));
+ ret = OPENSSL_malloc(sizeof(ASN1_STRING));
if (ret == NULL) {
ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
}
}
- mhdr = (MIME_HEADER *)OPENSSL_malloc(sizeof(MIME_HEADER));
+ mhdr = OPENSSL_malloc(sizeof(MIME_HEADER));
if (!mhdr)
goto err;
mhdr->name = tmpname;
goto err;
}
/* Parameter values are case sensitive so leave as is */
- mparam = (MIME_PARAM *)OPENSSL_malloc(sizeof(MIME_PARAM));
+ mparam = OPENSSL_malloc(sizeof(MIME_PARAM));
if (!mparam)
goto err;
mparam->param_name = tmpname;
i /= 2;
if (num + i > slen) {
if (s == NULL)
- sp = (unsigned char *)OPENSSL_malloc((unsigned int)num +
- i * 2);
+ sp = OPENSSL_malloc((unsigned int)num + i * 2);
else
- sp = (unsigned char *)OPENSSL_realloc(s,
- (unsigned int)num +
- i * 2);
+ sp = OPENSSL_realloc(s, (unsigned int)num + i * 2);
if (sp == NULL) {
ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE);
if (s != NULL)
i /= 2;
if (num + i > slen) {
if (s == NULL)
- sp = (unsigned char *)OPENSSL_malloc((unsigned int)num +
- i * 2);
+ sp = OPENSSL_malloc((unsigned int)num + i * 2);
else
sp = OPENSSL_realloc_clean(s, slen, num + i * 2);
if (sp == NULL) {
i /= 2;
if (num + i > slen) {
if (s == NULL)
- sp = (unsigned char *)OPENSSL_malloc((unsigned int)num +
- i * 2);
+ sp = OPENSSL_malloc((unsigned int)num + i * 2);
else
- sp = (unsigned char *)OPENSSL_realloc(s,
- (unsigned int)num +
- i * 2);
+ sp = OPENSSL_realloc(s, (unsigned int)num + i * 2);
if (sp == NULL) {
ASN1err(ASN1_F_A2I_ASN1_STRING, ERR_R_MALLOC_FAILURE);
if (s != NULL)
}
/* Since its RC4 encrypted length is actual length */
- if ((zz = (unsigned char *)OPENSSL_malloc(rsalen)) == NULL) {
+ if ((zz = OPENSSL_malloc(rsalen)) == NULL) {
ASN1err(ASN1_F_I2D_RSA_NET, ERR_R_MALLOC_FAILURE);
goto err;
}
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 = OPENSSL_malloc(derlen)) == NULL)
goto err;
i2d_X509_NAME(x->cert_info->subject, &dertmp);
{
X509_INFO *ret = NULL;
- ret = (X509_INFO *)OPENSSL_malloc(sizeof(X509_INFO));
+ ret = OPENSSL_malloc(sizeof(X509_INFO));
if (ret == NULL) {
ASN1err(ASN1_F_X509_INFO_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
{
BIO_F_BUFFER_CTX *ctx;
- ctx = (BIO_F_BUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX));
+ ctx = OPENSSL_malloc(sizeof(BIO_F_BUFFER_CTX));
if (ctx == NULL)
return (0);
- ctx->ibuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+ ctx->ibuf = OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
if (ctx->ibuf == NULL) {
OPENSSL_free(ctx);
return (0);
}
- ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
+ ctx->obuf = OPENSSL_malloc(DEFAULT_BUFFER_SIZE);
if (ctx->obuf == NULL) {
OPENSSL_free(ctx->ibuf);
OPENSSL_free(ctx);
p1 = ctx->ibuf;
p2 = ctx->obuf;
if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) {
- p1 = (char *)OPENSSL_malloc((int)num);
+ p1 = OPENSSL_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 = OPENSSL_malloc((int)num);
if (p2 == NULL) {
if (p1 != ctx->ibuf)
OPENSSL_free(p1);
{
BIO_LINEBUFFER_CTX *ctx;
- ctx = (BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX));
+ ctx = OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX));
if (ctx == NULL)
return (0);
- ctx->obuf = (char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
+ ctx->obuf = OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
if (ctx->obuf == NULL) {
OPENSSL_free(ctx);
return (0);
obs = (int)num;
p = ctx->obuf;
if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) {
- p = (char *)OPENSSL_malloc((int)num);
+ p = OPENSSL_malloc((int)num);
if (p == NULL)
goto malloc_error;
}
{
NBIO_TEST *nt;
- if (!(nt = (NBIO_TEST *)OPENSSL_malloc(sizeof(NBIO_TEST))))
+ if (!(nt = OPENSSL_malloc(sizeof(NBIO_TEST))))
return (0);
nt->lrn = -1;
nt->lwn = -1;
{
BIO *ret = NULL;
- ret = (BIO *)OPENSSL_malloc(sizeof(BIO));
+ ret = OPENSSL_malloc(sizeof(BIO));
if (ret == NULL) {
BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
{
BIO_ACCEPT *ret;
- if ((ret = (BIO_ACCEPT *)OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL)
+ if ((ret = OPENSSL_malloc(sizeof(BIO_ACCEPT))) == NULL)
return (NULL);
memset(ret, 0, sizeof(BIO_ACCEPT));
{
BIO_CONNECT *ret;
- if ((ret = (BIO_CONNECT *)OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL)
+ if ((ret = OPENSSL_malloc(sizeof(BIO_CONNECT))) == NULL)
return (NULL);
ret->state = BIO_CONN_S_BEFORE;
ret->param_hostname = NULL;
/* The default */
};
- if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) {
+ if ((buf = OPENSSL_malloc(inl + 1)) == NULL) {
return (0);
}
strncpy(buf, in, inl);
bn_check_top(mod);
- if ((ret = (BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL) {
+ if ((ret = OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL) {
BNerr(BN_F_BN_BLINDING_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
else
#endif
if ((powerbufFree =
- (unsigned char *)OPENSSL_malloc(powerbufLen +
- MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH))
+ OPENSSL_malloc(powerbufLen + MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH))
== NULL)
goto err;
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL)
+ if ((arr = OPENSSL_malloc(sizeof(int) * max)) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL)
+ if ((arr = OPENSSL_malloc(sizeof(int) * max)) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
bn_check_top(a);
bn_check_top(b);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL)
+ if ((arr = OPENSSL_malloc(sizeof(int) * max)) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
int *arr = NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL)
+ if ((arr = OPENSSL_malloc(sizeof(int) * max)) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
int *arr = NULL;
bn_check_top(a);
bn_check_top(p);
- if ((arr = (int *)OPENSSL_malloc(sizeof(int) * max)) == NULL)
+ if ((arr = OPENSSL_malloc(sizeof(int) * max)) == NULL)
goto err;
ret = BN_GF2m_poly2arr(p, arr, max);
if (!ret || ret > max) {
{
BIGNUM *ret;
- if ((ret = (BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL) {
+ if ((ret = OPENSSL_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 = OPENSSL_malloc(sizeof(BN_ULONG) * words);
if (A == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
{
BN_GENCB *ret;
- if ((ret = (BN_GENCB *)OPENSSL_malloc(sizeof(BN_GENCB))) == NULL) {
+ if ((ret = OPENSSL_malloc(sizeof(BN_GENCB))) == NULL) {
BNerr(BN_F_BN_GENCB_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
{
BN_MONT_CTX *ret;
- if ((ret = (BN_MONT_CTX *)OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL)
+ if ((ret = OPENSSL_malloc(sizeof(BN_MONT_CTX))) == NULL)
return (NULL);
BN_MONT_CTX_init(ret);
char *buf;
char *p;
- buf = (char *)OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
+ buf = OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
if (buf == NULL) {
BNerr(BN_F_BN_BN2HEX, ERR_R_MALLOC_FAILURE);
goto err;
*/
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 = OPENSSL_malloc((num / BN_DEC_NUM + 1) * sizeof(BN_ULONG));
+ buf = OPENSSL_malloc(num + 3);
if ((buf == NULL) || (bn_data == NULL)) {
BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE);
goto err;
bit = (bits - 1) % 8;
mask = 0xff << (bit + 1);
- buf = (unsigned char *)OPENSSL_malloc(bytes);
+ buf = OPENSSL_malloc(bytes);
if (buf == NULL) {
BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
goto err;
{
BN_RECP_CTX *ret;
- if ((ret = (BN_RECP_CTX *)OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL)
+ if ((ret = OPENSSL_malloc(sizeof(BN_RECP_CTX))) == NULL)
return (NULL);
BN_RECP_CTX_init(ret);
static int zlib_stateful_init(COMP_CTX *ctx)
{
int err;
- struct zlib_state *state =
- (struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state));
+ struct zlib_state *state = OPENSSL_malloc(sizeof(struct zlib_state));
if (state == NULL)
goto err;
{
COMP_CTX *ret;
- if ((ret = (COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) {
+ if ((ret = OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) {
/* ZZZZZZZZZZZZZZZZ */
return (NULL);
}
goto err;
}
- section = (char *)OPENSSL_malloc(10);
+ section = OPENSSL_malloc(10);
if (section == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
p++;
*p = '\0';
- if (!(v = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) {
+ if (!(v = OPENSSL_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 = OPENSSL_malloc(strlen(pname) + 1);
v->value = NULL;
if (v->name == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
DH *DH_new_method(ENGINE *engine)
{
- DH *ret;
+ DH *ret = OPENSSL_malloc(sizeof(DH));
- ret = (DH *)OPENSSL_malloc(sizeof(DH));
if (ret == NULL) {
DHerr(DH_F_DH_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
update_buflen(priv_key, &buf_len);
update_buflen(pub_key, &buf_len);
- m = (unsigned char *)OPENSSL_malloc(buf_len + 10);
+ m = OPENSSL_malloc(buf_len + 10);
if (m == NULL) {
DSAerr(DSA_F_DO_DSA_PRINT, ERR_R_MALLOC_FAILURE);
goto err;
{
DSA *ret;
- ret = (DSA *)OPENSSL_malloc(sizeof(DSA));
+ ret = OPENSSL_malloc(sizeof(DSA));
if (ret == NULL) {
DSAerr(DSA_F_DSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
{
DSO *ret;
- if (default_DSO_meth == NULL)
+ if (default_DSO_meth == NULL) {
/*
* We default to DSO_METH_openssl() which in turn defaults 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 = OPENSSL_malloc(sizeof(DSO));
if (ret == NULL) {
DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
ERR_add_error_data(3, "filename(", filename, ")");
goto err;
}
- p = (HINSTANCE *) OPENSSL_malloc(sizeof(HINSTANCE));
+ p = OPENSSL_malloc(sizeof(HINSTANCE));
if (p == NULL) {
DSOerr(DSO_F_WIN32_LOAD, ERR_R_MALLOC_FAILURE);
goto err;
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
return 0;
}
- ep = (unsigned char *)OPENSSL_malloc(eplen);
+ ep = OPENSSL_malloc(eplen);
if (!ep) {
EC_KEY_set_enc_flags(ec_key, old_flags);
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
{
EC_KEY *ret;
- ret = (EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
+ ret = OPENSSL_malloc(sizeof(EC_KEY));
if (ret == NULL) {
ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
if (!group)
return NULL;
- ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
+ ret = OPENSSL_malloc(sizeof(EC_PRE_COMP));
if (!ret) {
ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
return NULL;
}
- ret = (char *)OPENSSL_malloc(buf_len * 2 + 2);
+ ret = OPENSSL_malloc(buf_len * 2 + 2);
if (ret == NULL) {
OPENSSL_free(buf);
return NULL;
static NISTP224_PRE_COMP *nistp224_pre_comp_new()
{
NISTP224_PRE_COMP *ret = NULL;
- ret = (NISTP224_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ ret = OPENSSL_malloc(sizeof *ret);
if (!ret) {
ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
static NISTP256_PRE_COMP *nistp256_pre_comp_new()
{
NISTP256_PRE_COMP *ret = NULL;
- ret = (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret);
+ ret = OPENSSL_malloc(sizeof *ret);
if (!ret) {
ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
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 = OPENSSL_malloc(sizeof(NISTP521_PRE_COMP));
if (!ret) {
ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
if (!group)
return NULL;
- ret = (EC_PRE_COMP *)OPENSSL_malloc(sizeof(EC_PRE_COMP));
+ ret = OPENSSL_malloc(sizeof(EC_PRE_COMP));
if (!ret) {
ECerr(EC_F_ECP_NISTZ256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
{
ECDH_DATA *ret;
- ret = (ECDH_DATA *)OPENSSL_malloc(sizeof(ECDH_DATA));
+ ret = OPENSSL_malloc(sizeof(ECDH_DATA));
if (ret == NULL) {
ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
{
ECDSA_DATA *ret;
- ret = (ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA));
+ ret = OPENSSL_malloc(sizeof(ECDSA_DATA));
if (ret == NULL) {
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
if (bytes == 0)
return (-1);
- if ((pd = (u_int8_t *) OPENSSL_malloc(bytes)) == NULL)
+ if ((pd = OPENSSL_malloc(bytes)) == NULL)
return (-1);
for (i = 0; i < bytes; i++)
{
ENGINE *ret;
- ret = (ENGINE *)OPENSSL_malloc(sizeof(ENGINE));
+ ret = OPENSSL_malloc(sizeof(ENGINE));
if (ret == NULL) {
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
/* ret == the error state, if NULL, make a new one */
if (ret == NULL) {
- ret = (ERR_STATE *)OPENSSL_malloc(sizeof(ERR_STATE));
+ ret = OPENSSL_malloc(sizeof(ERR_STATE));
if (ret == NULL)
return (&fallback);
CRYPTO_THREADID_cpy(&ret->tid, &tid);
{
BIO_B64_CTX *ctx;
- ctx = (BIO_B64_CTX *)OPENSSL_malloc(sizeof(BIO_B64_CTX));
+ ctx = OPENSSL_malloc(sizeof(BIO_B64_CTX));
if (ctx == NULL)
return (0);
{
BIO_ENC_CTX *ctx;
- ctx = (BIO_ENC_CTX *)OPENSSL_malloc(sizeof(BIO_ENC_CTX));
+ ctx = OPENSSL_malloc(sizeof(BIO_ENC_CTX));
if (ctx == NULL)
return (0);
EVP_CIPHER_CTX_init(&ctx->cipher);
{
BIO_OK_CTX *ctx;
- ctx = (BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
+ ctx = OPENSSL_malloc(sizeof(BIO_OK_CTX));
if (ctx == NULL)
return (0);
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 = OPENSSL_malloc(sizeof(EVP_PBE_CTL)))) {
EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE, ERR_R_MALLOC_FAILURE);
return 0;
}
{
EVP_PKEY *ret;
- ret = (EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
+ ret = OPENSSL_malloc(sizeof(EVP_PKEY));
if (ret == NULL) {
EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
}
size = RSA_size(priv->pkey.rsa);
- key = (unsigned char *)OPENSSL_malloc(size + 2);
+ key = OPENSSL_malloc(size + 2);
if (key == NULL) {
/* ERROR */
EVPerr(EVP_F_EVP_OPENINIT, ERR_R_MALLOC_FAILURE);
CRYPTO_EX_free *free_func)
{
int toret = -1;
- CRYPTO_EX_DATA_FUNCS *a =
- (CRYPTO_EX_DATA_FUNCS *)OPENSSL_malloc(sizeof(CRYPTO_EX_DATA_FUNCS));
+ CRYPTO_EX_DATA_FUNCS *a = OPENSSL_malloc(sizeof(CRYPTO_EX_DATA_FUNCS));
if (!a) {
CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE);
return -1;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
- if ((nn = (LHASH_NODE *)OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL) {
+ if ((nn = OPENSSL_malloc(sizeof(LHASH_NODE))) == NULL) {
lh->error++;
return (NULL);
}
if ((lh->p) >= lh->pmax) {
j = (int)lh->num_alloc_nodes * 2;
- n = (LHASH_NODE **)OPENSSL_realloc(lh->b,
- (int)(sizeof(LHASH_NODE *) * j));
+ n = OPENSSL_realloc(lh->b, (int)(sizeof(LHASH_NODE *) * j));
if (n == NULL) {
-/* fputs("realloc error in lhash",stderr); */
+ /* fputs("realloc error in lhash",stderr); */
lh->error++;
lh->p = 0;
return;
}
- /* else */
for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
n[i] = NULL; /* 02/03/92 eay */
lh->pmax = lh->num_alloc_nodes;
np = lh->b[lh->p + lh->pmax - 1];
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,
- (unsigned int)(sizeof(LHASH_NODE *)
- * lh->pmax));
+ n = OPENSSL_realloc(lh->b,
+ (unsigned int)(sizeof(LHASH_NODE *) * lh->pmax));
if (n == NULL) {
-/* fputs("realloc error in lhash",stderr); */
+ /* fputs("realloc error in lhash",stderr); */
lh->error++;
return;
}
}
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
- pointer = (CRYPTO_dynlock *) OPENSSL_malloc(sizeof(CRYPTO_dynlock));
+ pointer = OPENSSL_malloc(sizeof(CRYPTO_dynlock));
if (pointer == NULL) {
CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
return (0);
{
if (a != NULL)
OPENSSL_free(a);
- a = (char *)OPENSSL_malloc(num);
+ a = OPENSSL_malloc(num);
return (a);
}
if (is_MemCheck_on()) {
MemCheck_off(); /* obtain MALLOC2 lock */
- if ((ami = (APP_INFO *)OPENSSL_malloc(sizeof(APP_INFO))) == NULL) {
+ if ((ami = OPENSSL_malloc(sizeof(APP_INFO))) == NULL) {
ret = 0;
goto err;
}
if (is_MemCheck_on()) {
MemCheck_off(); /* make sure we hold MALLOC2 lock */
- if ((m = (MEM *)OPENSSL_malloc(sizeof(MEM))) == NULL) {
+ if ((m = OPENSSL_malloc(sizeof(MEM))) == NULL) {
OPENSSL_free(addr);
MemCheck_on(); /* release MALLOC2 lock if num_disabled drops
* to 0 */
{
GCM128_CONTEXT *ret;
- if ((ret = (GCM128_CONTEXT *)OPENSSL_malloc(sizeof(GCM128_CONTEXT))))
+ if ((ret = OPENSSL_malloc(sizeof(GCM128_CONTEXT))))
CRYPTO_gcm128_init(ret, key, block);
return ret;
OCB128_CONTEXT *octx;
int ret;
- if ((octx = (OCB128_CONTEXT *)OPENSSL_malloc(sizeof(OCB128_CONTEXT)))) {
+ if ((octx = OPENSSL_malloc(sizeof(OCB128_CONTEXT)))) {
ret = CRYPTO_ocb128_init(octx, keyenc, keydec, encrypt, decrypt);
if (ret)
return octx;
alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS;
- onp = (OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME));
+ onp = OPENSSL_malloc(sizeof(OBJ_NAME));
if (onp == NULL) {
/* ERROR */
return (0);
return (0);
if ((o = OBJ_dup(obj)) == NULL)
goto err;
- if (!(ao[ADDED_NID] = (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
+ if (!(ao[ADDED_NID] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
if ((o->length != 0) && (obj->data != NULL))
if (!
- (ao[ADDED_DATA] = (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
+ (ao[ADDED_DATA] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
if (o->sn != NULL)
if (!
- (ao[ADDED_SNAME] =
- (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
+ (ao[ADDED_SNAME] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
if (o->ln != NULL)
if (!
- (ao[ADDED_LNAME] =
- (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
+ (ao[ADDED_LNAME] = OPENSSL_malloc(sizeof(ADDED_OBJ))))
goto err2;
for (i = ADDED_DATA; i <= ADDED_NID; i++) {
/* Work out total size */
j = ASN1_object_size(0, i, V_ASN1_OBJECT);
- if ((buf = (unsigned char *)OPENSSL_malloc(j)) == NULL)
+ if ((buf = OPENSSL_malloc(j)) == NULL)
return NULL;
p = buf;
if (i <= 0)
return (0);
- if ((buf = (unsigned char *)OPENSSL_malloc(i)) == NULL) {
+ if ((buf = OPENSSL_malloc(i)) == NULL) {
OBJerr(OBJ_F_OBJ_CREATE, ERR_R_MALLOC_FAILURE);
return (0);
}
}
/* dzise + 8 bytes are needed */
/* actually it needs the cipher block size extra... */
- data = (unsigned char *)OPENSSL_malloc((unsigned int)dsize + 20);
+ data = OPENSSL_malloc((unsigned int)dsize + 20);
if (data == NULL) {
PEMerr(PEM_F_PEM_ASN1_WRITE_BIO, ERR_R_MALLOC_FAILURE);
goto err;
if (j > max)
max = j;
}
- s = (char *)OPENSSL_malloc(max * 2);
+ s = OPENSSL_malloc(max * 2);
if (s == NULL) {
PEMerr(PEM_F_PEM_SEALINIT, ERR_R_MALLOC_FAILURE);
goto err;
i = RSA_size(priv->pkey.rsa);
if (i < 100)
i = 100;
- s = (unsigned char *)OPENSSL_malloc(i * 2);
+ s = OPENSSL_malloc(i * 2);
if (s == NULL) {
PEMerr(PEM_F_PEM_SEALFINAL, ERR_R_MALLOC_FAILURE);
goto err;
int i, ret = 0;
unsigned int m_len;
- m = (unsigned char *)OPENSSL_malloc(EVP_PKEY_size(pkey) + 2);
+ m = OPENSSL_malloc(EVP_PKEY_size(pkey) + 2);
if (m == NULL) {
PEMerr(PEM_F_PEM_SIGNFINAL, ERR_R_MALLOC_FAILURE);
goto err;
pitem *pitem_new(unsigned char *prio64be, void *data)
{
- pitem *item = (pitem *)OPENSSL_malloc(sizeof(pitem));
+ pitem *item = OPENSSL_malloc(sizeof(pitem));
if (item == NULL)
return NULL;
pqueue_s *pqueue_new()
{
- pqueue_s *pq = (pqueue_s *)OPENSSL_malloc(sizeof(pqueue_s));
+ pqueue_s *pq = OPENSSL_malloc(sizeof(pqueue_s));
if (pq == NULL)
return NULL;
update_buflen(x->iqmp, &buf_len);
}
- m = (unsigned char *)OPENSSL_malloc(buf_len + 10);
+ m = OPENSSL_malloc(buf_len + 10);
if (m == NULL) {
RSAerr(RSA_F_DO_RSA_PRINT, ERR_R_MALLOC_FAILURE);
goto err;
{
RSA *ret;
- ret = (RSA *)OPENSSL_malloc(sizeof(RSA));
+ ret = OPENSSL_malloc(sizeof(RSA));
if (ret == NULL) {
RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return (0);
}
- s = (unsigned char *)OPENSSL_malloc((unsigned int)j + 1);
+ s = OPENSSL_malloc((unsigned int)j + 1);
if (s == NULL) {
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE);
return (0);
return (0);
}
- s = (unsigned char *)OPENSSL_malloc((unsigned int)siglen);
+ s = OPENSSL_malloc((unsigned int)siglen);
if (s == NULL) {
RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE);
goto err;
return (0);
}
if (type != NID_md5_sha1) {
- tmps = (unsigned char *)OPENSSL_malloc((unsigned int)j + 1);
+ tmps = OPENSSL_malloc((unsigned int)j + 1);
if (tmps == NULL) {
RSAerr(RSA_F_RSA_SIGN, ERR_R_MALLOC_FAILURE);
return (0);
return 1;
}
- s = (unsigned char *)OPENSSL_malloc((unsigned int)siglen);
+ s = OPENSSL_malloc((unsigned int)siglen);
if (s == NULL) {
RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE);
goto err;
SRP_VBASE *SRP_VBASE_new(char *seed_key)
{
- SRP_VBASE *vb = (SRP_VBASE *)OPENSSL_malloc(sizeof(SRP_VBASE));
+ SRP_VBASE *vb = OPENSSL_malloc(sizeof(SRP_VBASE));
if (vb == NULL)
return NULL;
{
unsigned char tmp[MAX_LEN];
int len;
+ SRP_gN_cache *newgN = OPENSSL_malloc(sizeof(SRP_gN_cache));
- SRP_gN_cache *newgN =
- (SRP_gN_cache *)OPENSSL_malloc(sizeof(SRP_gN_cache));
if (newgN == NULL)
return NULL;
* we add this couple in the internal Stack
*/
- if ((gN = (SRP_gN *) OPENSSL_malloc(sizeof(SRP_gN))) == NULL)
+ if ((gN = OPENSSL_malloc(sizeof(SRP_gN))) == NULL)
goto err;
if (!(gN->id = BUF_strdup(pp[DB_srpid]))
if ((ret = sk_new(sk->comp)) == NULL)
goto err;
- s = (char **)OPENSSL_realloc((char *)ret->data,
- (unsigned int)sizeof(char *) *
- sk->num_alloc);
+ s = OPENSSL_realloc((char *)ret->data,
+ (unsigned int)sizeof(char *) * sk->num_alloc);
if (s == NULL)
goto err;
ret->data = s;
return NULL;
}
- ret = (STORE *)OPENSSL_malloc(sizeof(STORE));
+ ret = OPENSSL_malloc(sizeof(STORE));
if (ret == NULL) {
STOREerr(STORE_F_STORE_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
STORE_ATTR_INFO *STORE_ATTR_INFO_new(void)
{
- return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO));
+ return OPENSSL_malloc(sizeof(STORE_ATTR_INFO));
}
static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs,
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 *context = OPENSSL_malloc(sizeof(struct mem_ctx_st));
void *attribute_context = NULL;
STORE_ATTR_INFO *attrs = NULL;
STORE_METHOD *STORE_create_method(char *name)
{
- STORE_METHOD *store_method =
- (STORE_METHOD *)OPENSSL_malloc(sizeof(STORE_METHOD));
+ STORE_METHOD *store_method = OPENSSL_malloc(sizeof(STORE_METHOD));
if (store_method) {
memset(store_method, 0, sizeof(*store_method));
{
TS_RESP_CTX *ctx;
- if (!(ctx = (TS_RESP_CTX *)OPENSSL_malloc(sizeof(TS_RESP_CTX)))) {
+ if (!(ctx = OPENSSL_malloc(sizeof(TS_RESP_CTX)))) {
TSerr(TS_F_TS_RESP_CTX_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
int len;
len = i2d_ESS_SIGNING_CERT(sc, NULL);
- if (!(pp = (unsigned char *)OPENSSL_malloc(len))) {
+ if (!(pp = OPENSSL_malloc(len))) {
TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
goto err;
}
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
{
- TS_VERIFY_CTX *ctx =
- (TS_VERIFY_CTX *)OPENSSL_malloc(sizeof(TS_VERIFY_CTX));
+ TS_VERIFY_CTX *ctx = OPENSSL_malloc(sizeof(TS_VERIFY_CTX));
+
if (ctx)
memset(ctx, 0, sizeof(TS_VERIFY_CTX));
else
UI *UI_new_method(const UI_METHOD *method)
{
- UI *ret;
+ UI *ret = OPENSSL_malloc(sizeof(UI));
- ret = (UI *)OPENSSL_malloc(sizeof(UI));
if (ret == NULL) {
UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
} else if ((type == UIT_PROMPT || type == UIT_VERIFY
|| type == UIT_BOOLEAN) && result_buf == NULL) {
UIerr(UI_F_GENERAL_ALLOCATE_PROMPT, UI_R_NO_RESULT_BUFFER);
- } else if ((ret = (UI_STRING *)OPENSSL_malloc(sizeof(UI_STRING)))) {
+ } else if ((ret = OPENSSL_malloc(sizeof(UI_STRING)))) {
ret->out_string = prompt;
ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
ret->input_flags = input_flags;
len += sizeof(prompt2) - 1 + strlen(object_name);
len += sizeof(prompt3) - 1;
- prompt = (char *)OPENSSL_malloc(len + 1);
+ prompt = OPENSSL_malloc(len + 1);
if (prompt == NULL)
return NULL;
BUF_strlcpy(prompt, prompt1, len + 1);
UI_METHOD *UI_create_method(char *name)
{
- UI_METHOD *ui_method = (UI_METHOD *)OPENSSL_malloc(sizeof(UI_METHOD));
+ UI_METHOD *ui_method = OPENSSL_malloc(sizeof(UI_METHOD));
if (ui_method) {
memset(ui_method, 0, sizeof(*ui_method));
{
BY_DIR *a;
- if ((a = (BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL)
+ if ((a = OPENSSL_malloc(sizeof(BY_DIR))) == NULL)
return (0);
if ((a->buffer = BUF_MEM_new()) == NULL) {
OPENSSL_free(a);
{
X509_LOOKUP *ret;
- ret = (X509_LOOKUP *)OPENSSL_malloc(sizeof(X509_LOOKUP));
+ ret = OPENSSL_malloc(sizeof(X509_LOOKUP));
if (ret == NULL)
return NULL;
{
X509_STORE *ret;
- if ((ret = (X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
+ if ((ret = OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
return NULL;
ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
ret->cache = 1;
if (x == NULL)
return 0;
- obj = (X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
+ obj = OPENSSL_malloc(sizeof(X509_OBJECT));
if (obj == NULL) {
X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
return 0;
if (x == NULL)
return 0;
- obj = (X509_OBJECT *)OPENSSL_malloc(sizeof(X509_OBJECT));
+ obj = OPENSSL_malloc(sizeof(X509_OBJECT));
if (obj == NULL) {
X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
return 0;
ri = ret->req_info;
ri->version->length = 1;
- ri->version->data = (unsigned char *)OPENSSL_malloc(1);
+ ri->version->data = OPENSSL_malloc(1);
if (ri->version->data == NULL)
goto err;
ri->version->data[0] = 0; /* version == 0 */
X509_STORE_CTX *X509_STORE_CTX_new(void)
{
X509_STORE_CTX *ctx;
- ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX));
+
+ ctx = OPENSSL_malloc(sizeof(X509_STORE_CTX));
if (!ctx) {
X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
X509V3_R_EXTENSION_NOT_FOUND);
return 0;
}
- if (!
- (tmpext =
- (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) {
+ if (!(tmpext = OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) {
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS, ERR_R_MALLOC_FAILURE);
return 0;
}
goto err;
if (value && !(tvalue = BUF_strdup(value)))
goto err;
- if (!(vtmp = (CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
+ if (!(vtmp = OPENSSL_malloc(sizeof(CONF_VALUE))))
goto err;
if (!*extlist && !(*extlist = sk_CONF_VALUE_new_null()))
goto err;
}
strbuf = OPENSSL_malloc(SIZE);
- buff = (unsigned char *)OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
+ buff = OPENSSL_malloc(EVP_ENCODE_LENGTH(bsize));
if ((buff == NULL) || (strbuf == NULL)) {
BIO_printf(bio_err, "OPENSSL_malloc failure\n");
goto end;
gcp->enc_param_set = OBJ_nid2obj(c->paramNID);
len = i2d_GOST_CIPHER_PARAMS(gcp, NULL);
- p = buf = (unsigned char *)OPENSSL_malloc(len);
+ p = buf = OPENSSL_malloc(len);
if (!buf) {
GOST_CIPHER_PARAMS_free(gcp);
GOSTerr(GOST_F_GOST89_SET_ASN1_PARAMETERS, ERR_R_MALLOC_FAILURE);
while (((out->nbytes = (numbytes + mod)) % 32)) {
mod++;
}
- out->value = (unsigned char *)OPENSSL_malloc(out->nbytes);
+ out->value = OPENSSL_malloc(out->nbytes);
if (!out->value) {
return 0;
}
{
BIO_SSL *bs;
- bs = (BIO_SSL *)OPENSSL_malloc(sizeof(BIO_SSL));
+ bs = OPENSSL_malloc(sizeof(BIO_SSL));
if (bs == NULL) {
BIOerr(BIO_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return (0);
unsigned char *buf = NULL;
unsigned char *bitmask = NULL;
- frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
+ frag = OPENSSL_malloc(sizeof(hm_fragment));
if (frag == NULL)
return NULL;
if (frag_len) {
- buf = (unsigned char *)OPENSSL_malloc(frag_len);
+ buf = OPENSSL_malloc(frag_len);
if (buf == NULL) {
OPENSSL_free(frag);
return NULL;
/* Initialize reassembly bitmask if necessary */
if (reassembly) {
- bitmask =
- (unsigned char *)OPENSSL_malloc(RSMBLY_BITMASK_SIZE(frag_len));
+ bitmask = OPENSSL_malloc(RSMBLY_BITMASK_SIZE(frag_len));
if (bitmask == NULL) {
if (buf != NULL)
OPENSSL_free(buf);
{
CERT *ret;
- ret = (CERT *)OPENSSL_malloc(sizeof(CERT));
+ ret = OPENSSL_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 = OPENSSL_malloc(sizeof(CERT));
if (ret == NULL) {
SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_MALLOC_FAILURE);
return (NULL);
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 = OPENSSL_malloc(sizeof(SSL_COMP));
if (comp != NULL) {
comp->method = COMP_zlib();
if (comp->method && comp->method->type == NID_undef)
fprintf(stderr, "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 = OPENSSL_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 */
}
MemCheck_off();
- comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
+ comp = OPENSSL_malloc(sizeof(SSL_COMP));
if (comp == NULL) {
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD, ERR_R_MALLOC_FAILURE);
return (NULL);
}
- s = (SSL *)OPENSSL_malloc(sizeof(SSL));
+ s = OPENSSL_malloc(sizeof(SSL));
if (s == NULL)
goto err;
memset(s, 0, sizeof(SSL));
SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
goto err;
}
- ret = (SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX));
+ ret = OPENSSL_malloc(sizeof(SSL_CTX));
if (ret == NULL)
goto err;
{
SSL_SESSION *ss;
- ss = (SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION));
+ ss = OPENSSL_malloc(sizeof(SSL_SESSION));
if (ss == NULL) {
SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE);
return (0);
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);
+ OPENSSL_malloc(session->krb5_client_princ_len + 1);
if (s->kssl_ctx->client_princ == NULL) {
SSLerr(SSL_F_SSL_SET_SESSION, ERR_R_MALLOC_FAILURE);
return (0);
ssl3_cleanup_key_block(s);
- if ((p1 = (unsigned char *)OPENSSL_malloc(num)) == NULL) {
+ if ((p1 = OPENSSL_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 = OPENSSL_malloc(num)) == NULL) {
SSLerr(SSL_F_TLS1_SETUP_KEY_BLOCK, ERR_R_MALLOC_FAILURE);
OPENSSL_free(p1);
goto err;
BIO_puts(out, "\n");
alen = DH_size(a);
- abuf = (unsigned char *)OPENSSL_malloc(alen);
+ abuf = OPENSSL_malloc(alen);
aout = DH_compute_key(abuf, b->pub_key, a);
BIO_puts(out, "key1 =");
BIO_puts(out, "\n");
blen = DH_size(b);
- bbuf = (unsigned char *)OPENSSL_malloc(blen);
+ bbuf = OPENSSL_malloc(blen);
bout = DH_compute_key(bbuf, a->pub_key, b);
BIO_puts(out, "key2 =");
# endif
alen = KDF1_SHA1_len;
- abuf = (unsigned char *)OPENSSL_malloc(alen);
+ abuf = OPENSSL_malloc(alen);
aout =
ECDH_compute_key(abuf, alen, EC_KEY_get0_public_key(b), a, KDF1_SHA1);
# endif
blen = KDF1_SHA1_len;
- bbuf = (unsigned char *)OPENSSL_malloc(blen);
+ bbuf = OPENSSL_malloc(blen);
bout =
ECDH_compute_key(bbuf, blen, EC_KEY_get0_public_key(a), b, KDF1_SHA1);