summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-06-07 14:41:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-06-07 14:41:58 +0000
commit306c805cd2f13c5291c0a0fc407db16f863439b7 (patch)
treeaf7680b04ebb61a5881f22f5730ea7be5e5cea39
parent2505442362acb3ea3c9eadeda7567ef83bd72be7 (diff)
malloc() result does not need a cast.
ok miod
-rw-r--r--lib/libssl/src/apps/apps.c2
-rw-r--r--lib/libssl/src/apps/ca.c14
-rw-r--r--lib/libssl/src/apps/dgst.c2
-rw-r--r--lib/libssl/src/apps/dh.c2
-rw-r--r--lib/libssl/src/apps/dhparam.c2
-rw-r--r--lib/libssl/src/apps/dsaparam.c2
-rw-r--r--lib/libssl/src/apps/ecparam.c2
-rw-r--r--lib/libssl/src/apps/enc.c2
-rw-r--r--lib/libssl/src/apps/rsa.c2
-rw-r--r--lib/libssl/src/apps/speed.c4
-rw-r--r--lib/libssl/src/crypto/asn1/asn1_mac.h2
-rw-r--r--lib/libssl/src/crypto/bn/bn_exp.c2
-rw-r--r--lib/libssl/src/crypto/bn/bn_mont.c2
-rw-r--r--lib/libssl/src/crypto/bn/bn_print.c4
-rw-r--r--lib/libssl/src/crypto/bn/bn_rand.c2
-rw-r--r--lib/libssl/src/crypto/bn/bn_recp.c2
-rw-r--r--lib/libssl/src/crypto/comp/c_zlib.c3
-rw-r--r--lib/libssl/src/crypto/conf/conf_def.c6
-rw-r--r--lib/libssl/src/crypto/dh/dh_lib.c2
-rw-r--r--lib/libssl/src/crypto/dsa/dsa_ameth.c2
-rw-r--r--lib/libssl/src/crypto/dsa/dsa_lib.c2
-rw-r--r--lib/libssl/src/crypto/ec/ec_ameth.c2
-rw-r--r--lib/libssl/src/crypto/ec/ec_key.c2
-rw-r--r--lib/libssl/src/crypto/ec/ec_mult.c2
-rw-r--r--lib/libssl/src/crypto/ec/ec_print.c2
-rw-r--r--lib/libssl/src/crypto/ec/ecp_nistp224.c2
-rw-r--r--lib/libssl/src/crypto/ec/ecp_nistp256.c2
-rw-r--r--lib/libssl/src/crypto/ec/ecp_nistp521.c2
-rw-r--r--lib/libssl/src/crypto/ecdh/ech_lib.c2
-rw-r--r--lib/libssl/src/crypto/ecdsa/ecs_lib.c2
-rw-r--r--lib/libssl/src/crypto/engine/eng_lib.c5
-rw-r--r--lib/libssl/src/crypto/engine/hw_cryptodev.c2
-rw-r--r--lib/libssl/src/crypto/err/err.c2
-rw-r--r--lib/libssl/src/crypto/evp/bio_b64.c2
-rw-r--r--lib/libssl/src/crypto/evp/bio_enc.c2
-rw-r--r--lib/libssl/src/crypto/evp/bio_ok.c2
-rw-r--r--lib/libssl/src/crypto/evp/p_lib.c2
-rw-r--r--lib/libssl/src/crypto/evp/p_open.c2
-rw-r--r--lib/libssl/src/crypto/ex_data.c4
-rw-r--r--lib/libssl/src/crypto/lhash/lhash.c2
-rw-r--r--lib/libssl/src/crypto/modes/gcm128.c2
-rw-r--r--lib/libssl/src/crypto/objects/o_names.c2
-rw-r--r--lib/libssl/src/crypto/objects/obj_dat.c12
-rw-r--r--lib/libssl/src/crypto/pem/pem_lib.c2
-rw-r--r--lib/libssl/src/crypto/pem/pem_seal.c2
-rw-r--r--lib/libssl/src/crypto/pem/pem_sign.c2
-rw-r--r--lib/libssl/src/crypto/rsa/rsa_ameth.c2
-rw-r--r--lib/libssl/src/crypto/rsa/rsa_lib.c2
-rw-r--r--lib/libssl/src/crypto/rsa/rsa_saos.c4
-rw-r--r--lib/libssl/src/crypto/rsa/rsa_sign.c4
-rw-r--r--lib/libssl/src/crypto/srp/srp_vfy.c6
-rw-r--r--lib/libssl/src/crypto/store/str_lib.c7
-rw-r--r--lib/libssl/src/crypto/store/str_mem.c3
-rw-r--r--lib/libssl/src/crypto/ts/ts_rsp_sign.c2
-rw-r--r--lib/libssl/src/crypto/ui/ui_lib.c4
-rw-r--r--lib/libssl/src/crypto/x509/by_dir.c2
-rw-r--r--lib/libssl/src/crypto/x509/x509_lu.c8
-rw-r--r--lib/libssl/src/crypto/x509/x509_req.c2
-rw-r--r--lib/libssl/src/ssl/pqueue.c4
59 files changed, 88 insertions, 90 deletions
diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c
index e5e3b150b5d..88bffd7d14c 100644
--- a/lib/libssl/src/apps/apps.c
+++ b/lib/libssl/src/apps/apps.c
@@ -405,7 +405,7 @@ password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_tmp)
ok = UI_add_input_string(ui, prompt, ui_flags, buf,
PW_MIN_LENGTH, bufsiz - 1);
if (ok >= 0 && verify) {
- buff = (char *) malloc(bufsiz);
+ buff = malloc(bufsiz);
ok = UI_add_verify_string(ui, prompt, ui_flags, buff,
PW_MIN_LENGTH, bufsiz - 1, buf);
}
diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c
index 273edb06d65..8f0295d966f 100644
--- a/lib/libssl/src/apps/ca.c
+++ b/lib/libssl/src/apps/ca.c
@@ -1951,17 +1951,17 @@ again2:
goto err;
/* We now just add it to the database */
- row[DB_type] = (char *) malloc(2);
+ row[DB_type] = malloc(2);
tm = X509_get_notAfter(ret);
- row[DB_exp_date] = (char *) malloc(tm->length + 1);
+ row[DB_exp_date] = 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 *) malloc(8);
+ row[DB_file] = 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) ||
@@ -2214,17 +2214,17 @@ do_revoke(X509 * x509, CA_DB * db, int type, char *value)
row[DB_serial], row[DB_name]);
/* We now just add it to the database */
- row[DB_type] = (char *) malloc(2);
+ row[DB_type] = malloc(2);
tm = X509_get_notAfter(x509);
- row[DB_exp_date] = (char *) malloc(tm->length + 1);
+ row[DB_exp_date] = 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 *) malloc(8);
+ row[DB_file] = malloc(8);
/* row[DB_name] done already */
@@ -2372,7 +2372,7 @@ do_updatedb(CA_DB * db)
/* get actual time and make a string */
a_tm = X509_gmtime_adj(a_tm, 0);
- a_tm_s = (char *) malloc(a_tm->length + 1);
+ a_tm_s = malloc(a_tm->length + 1);
if (a_tm_s == NULL) {
cnt = -1;
goto err;
diff --git a/lib/libssl/src/apps/dgst.c b/lib/libssl/src/apps/dgst.c
index a862da98659..0dbb4c33350 100644
--- a/lib/libssl/src/apps/dgst.c
+++ b/lib/libssl/src/apps/dgst.c
@@ -129,7 +129,7 @@ dgst_main(int argc, char **argv)
char *mac_name = NULL;
STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL;
- if ((buf = (unsigned char *) malloc(BUFSIZE)) == NULL) {
+ if ((buf = malloc(BUFSIZE)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
goto end;
}
diff --git a/lib/libssl/src/apps/dh.c b/lib/libssl/src/apps/dh.c
index e5983506383..d0d968967f6 100644
--- a/lib/libssl/src/apps/dh.c
+++ b/lib/libssl/src/apps/dh.c
@@ -248,7 +248,7 @@ bad:
len = BN_num_bytes(dh->p);
bits = BN_num_bits(dh->p);
- data = (unsigned char *) malloc(len);
+ data = malloc(len);
if (data == NULL) {
perror("malloc");
goto end;
diff --git a/lib/libssl/src/apps/dhparam.c b/lib/libssl/src/apps/dhparam.c
index c35f902b540..c8dccf7d0ca 100644
--- a/lib/libssl/src/apps/dhparam.c
+++ b/lib/libssl/src/apps/dhparam.c
@@ -399,7 +399,7 @@ bad:
len = BN_num_bytes(dh->p);
bits = BN_num_bits(dh->p);
- data = (unsigned char *) malloc(len);
+ data = malloc(len);
if (data == NULL) {
perror("malloc");
goto end;
diff --git a/lib/libssl/src/apps/dsaparam.c b/lib/libssl/src/apps/dsaparam.c
index 15f022d395b..29d13cbc764 100644
--- a/lib/libssl/src/apps/dsaparam.c
+++ b/lib/libssl/src/apps/dsaparam.c
@@ -298,7 +298,7 @@ bad:
len = BN_num_bytes(dsa->p);
bits_p = BN_num_bits(dsa->p);
- data = (unsigned char *) malloc(len + 20);
+ data = malloc(len + 20);
if (data == NULL) {
perror("malloc");
goto end;
diff --git a/lib/libssl/src/apps/ecparam.c b/lib/libssl/src/apps/ecparam.c
index 70824e58ded..b31d55d4acb 100644
--- a/lib/libssl/src/apps/ecparam.c
+++ b/lib/libssl/src/apps/ecparam.c
@@ -454,7 +454,7 @@ bad:
if ((tmp_len = (size_t) BN_num_bytes(ec_cofactor)) > buf_len)
buf_len = tmp_len;
- buffer = (unsigned char *) malloc(buf_len);
+ buffer = malloc(buf_len);
if (buffer == NULL) {
perror("malloc");
diff --git a/lib/libssl/src/apps/enc.c b/lib/libssl/src/apps/enc.c
index cbbaa6ef883..a84238f39df 100644
--- a/lib/libssl/src/apps/enc.c
+++ b/lib/libssl/src/apps/enc.c
@@ -338,7 +338,7 @@ enc_main(int argc, char **argv)
BIO_printf(bio_err, "bufsize=%d\n", bsize);
}
strbuf = malloc(SIZE);
- buff = (unsigned char *) malloc(EVP_ENCODE_LENGTH(bsize));
+ buff = malloc(EVP_ENCODE_LENGTH(bsize));
if ((buff == NULL) || (strbuf == NULL)) {
BIO_printf(bio_err, "malloc failure %ld\n", (long) EVP_ENCODE_LENGTH(bsize));
goto end;
diff --git a/lib/libssl/src/apps/rsa.c b/lib/libssl/src/apps/rsa.c
index d9e90c389e5..37a22352dde 100644
--- a/lib/libssl/src/apps/rsa.c
+++ b/lib/libssl/src/apps/rsa.c
@@ -343,7 +343,7 @@ bad:
i = 1;
size = i2d_RSA_NET(rsa, NULL, NULL, sgckey);
- if ((p = (unsigned char *) malloc(size)) == NULL) {
+ if ((p = malloc(size)) == NULL) {
BIO_printf(bio_err, "Memory allocation failure\n");
goto end;
}
diff --git a/lib/libssl/src/apps/speed.c b/lib/libssl/src/apps/speed.c
index da8c3b31969..cdd3c8f96e1 100644
--- a/lib/libssl/src/apps/speed.c
+++ b/lib/libssl/src/apps/speed.c
@@ -545,11 +545,11 @@ speed_main(int argc, char **argv)
rsa_key[i] = NULL;
#endif
- if ((buf = (unsigned char *) malloc((int) BUFSIZE)) == NULL) {
+ if ((buf = malloc((int) BUFSIZE)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
goto end;
}
- if ((buf2 = (unsigned char *) malloc((int) BUFSIZE)) == NULL) {
+ if ((buf2 = malloc((int) BUFSIZE)) == NULL) {
BIO_printf(bio_err, "out of memory\n");
goto end;
}
diff --git a/lib/libssl/src/crypto/asn1/asn1_mac.h b/lib/libssl/src/crypto/asn1/asn1_mac.h
index da03a8cb92d..9ca6a49fd4a 100644
--- a/lib/libssl/src/crypto/asn1/asn1_mac.h
+++ b/lib/libssl/src/crypto/asn1/asn1_mac.h
@@ -289,7 +289,7 @@ err:\
/* New macros */
#define M_ASN1_New_Malloc(ret,type) \
- if ((ret=(type *)malloc(sizeof(type))) == NULL) \
+ if ((ret = malloc(sizeof(type))) == NULL) \
{ c.line=__LINE__; goto err2; }
#define M_ASN1_New(arg,func) \
diff --git a/lib/libssl/src/crypto/bn/bn_exp.c b/lib/libssl/src/crypto/bn/bn_exp.c
index a27373c97be..af88798effa 100644
--- a/lib/libssl/src/crypto/bn/bn_exp.c
+++ b/lib/libssl/src/crypto/bn/bn_exp.c
@@ -627,7 +627,7 @@ BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
numPowers = 1 << window;
powerbufLen = sizeof(m->d[0]) * (top * numPowers +
((2*top) > numPowers ? (2*top) : numPowers));
- if ((powerbufFree = (unsigned char*)malloc(powerbufLen +
+ if ((powerbufFree = malloc(powerbufLen +
MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH)) == NULL)
goto err;
diff --git a/lib/libssl/src/crypto/bn/bn_mont.c b/lib/libssl/src/crypto/bn/bn_mont.c
index 073dfeffeee..af7b0835306 100644
--- a/lib/libssl/src/crypto/bn/bn_mont.c
+++ b/lib/libssl/src/crypto/bn/bn_mont.c
@@ -325,7 +325,7 @@ BN_MONT_CTX_new(void)
{
BN_MONT_CTX *ret;
- if ((ret = (BN_MONT_CTX *)malloc(sizeof(BN_MONT_CTX))) == NULL)
+ if ((ret = malloc(sizeof(BN_MONT_CTX))) == NULL)
return (NULL);
BN_MONT_CTX_init(ret);
diff --git a/lib/libssl/src/crypto/bn/bn_print.c b/lib/libssl/src/crypto/bn/bn_print.c
index ad3a847f01b..4685389bf87 100644
--- a/lib/libssl/src/crypto/bn/bn_print.c
+++ b/lib/libssl/src/crypto/bn/bn_print.c
@@ -72,7 +72,7 @@ BN_bn2hex(const BIGNUM *a)
char *buf;
char *p;
- buf = (char *)malloc(a->top * BN_BYTES * 2 + 2);
+ buf = malloc(a->top * BN_BYTES * 2 + 2);
if (buf == NULL) {
BNerr(BN_F_BN_BN2HEX, ERR_R_MALLOC_FAILURE);
goto err;
@@ -117,7 +117,7 @@ BN_bn2dec(const BIGNUM *a)
i = BN_num_bits(a) * 3;
num = (i / 10 + i / 1000 + 1) + 1;
bn_data = reallocarray(NULL, num / BN_DEC_NUM + 1, sizeof(BN_ULONG));
- buf = (char *)malloc(num + 3);
+ buf = malloc(num + 3);
if ((buf == NULL) || (bn_data == NULL)) {
BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE);
goto err;
diff --git a/lib/libssl/src/crypto/bn/bn_rand.c b/lib/libssl/src/crypto/bn/bn_rand.c
index 488b7c6e63a..0073eec35c0 100644
--- a/lib/libssl/src/crypto/bn/bn_rand.c
+++ b/lib/libssl/src/crypto/bn/bn_rand.c
@@ -130,7 +130,7 @@ bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
bit = (bits - 1) % 8;
mask = 0xff << (bit + 1);
- buf = (unsigned char *)malloc(bytes);
+ buf = malloc(bytes);
if (buf == NULL) {
BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
goto err;
diff --git a/lib/libssl/src/crypto/bn/bn_recp.c b/lib/libssl/src/crypto/bn/bn_recp.c
index 31fe4eb8975..89d6bd480d3 100644
--- a/lib/libssl/src/crypto/bn/bn_recp.c
+++ b/lib/libssl/src/crypto/bn/bn_recp.c
@@ -74,7 +74,7 @@ BN_RECP_CTX_new(void)
{
BN_RECP_CTX *ret;
- if ((ret = (BN_RECP_CTX *)malloc(sizeof(BN_RECP_CTX))) == NULL)
+ if ((ret = malloc(sizeof(BN_RECP_CTX))) == NULL)
return (NULL);
BN_RECP_CTX_init(ret);
diff --git a/lib/libssl/src/crypto/comp/c_zlib.c b/lib/libssl/src/crypto/comp/c_zlib.c
index 26c6507cd5d..34ae5d07f52 100644
--- a/lib/libssl/src/crypto/comp/c_zlib.c
+++ b/lib/libssl/src/crypto/comp/c_zlib.c
@@ -113,8 +113,7 @@ static int
zlib_stateful_init(COMP_CTX *ctx)
{
int err;
- struct zlib_state *state =
- (struct zlib_state *)malloc(sizeof(struct zlib_state));
+ struct zlib_state *state = malloc(sizeof(struct zlib_state));
if (state == NULL)
goto err;
diff --git a/lib/libssl/src/crypto/conf/conf_def.c b/lib/libssl/src/crypto/conf/conf_def.c
index b550623e57c..5fee2e5cfcd 100644
--- a/lib/libssl/src/crypto/conf/conf_def.c
+++ b/lib/libssl/src/crypto/conf/conf_def.c
@@ -229,7 +229,7 @@ def_load_bio(CONF *conf, BIO *in, long *line)
goto err;
}
- section = (char *)malloc(10);
+ section = malloc(10);
if (section == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
goto err;
@@ -361,14 +361,14 @@ again:
p++;
*p = '\0';
- if (!(v = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) {
+ if (!(v = malloc(sizeof(CONF_VALUE)))) {
CONFerr(CONF_F_DEF_LOAD_BIO,
ERR_R_MALLOC_FAILURE);
goto err;
}
if (psection == NULL)
psection = section;
- v->name = (char *)malloc(strlen(pname) + 1);
+ v->name = malloc(strlen(pname) + 1);
v->value = NULL;
if (v->name == NULL) {
CONFerr(CONF_F_DEF_LOAD_BIO,
diff --git a/lib/libssl/src/crypto/dh/dh_lib.c b/lib/libssl/src/crypto/dh/dh_lib.c
index 7a680cc5b48..c585352595c 100644
--- a/lib/libssl/src/crypto/dh/dh_lib.c
+++ b/lib/libssl/src/crypto/dh/dh_lib.c
@@ -110,7 +110,7 @@ DH *DH_new_method(ENGINE *engine)
{
DH *ret;
- ret=(DH *)malloc(sizeof(DH));
+ ret = malloc(sizeof(DH));
if (ret == NULL)
{
DHerr(DH_F_DH_NEW_METHOD,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/dsa/dsa_ameth.c b/lib/libssl/src/crypto/dsa/dsa_ameth.c
index c6d04f6a5d5..459bea20412 100644
--- a/lib/libssl/src/crypto/dsa/dsa_ameth.c
+++ b/lib/libssl/src/crypto/dsa/dsa_ameth.c
@@ -457,7 +457,7 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
update_buflen(priv_key, &buf_len);
update_buflen(pub_key, &buf_len);
- m=(unsigned char *)malloc(buf_len+10);
+ m = malloc(buf_len+10);
if (m == NULL)
{
DSAerr(DSA_F_DO_DSA_PRINT,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/dsa/dsa_lib.c b/lib/libssl/src/crypto/dsa/dsa_lib.c
index 7c7cd608834..002d64665a0 100644
--- a/lib/libssl/src/crypto/dsa/dsa_lib.c
+++ b/lib/libssl/src/crypto/dsa/dsa_lib.c
@@ -116,7 +116,7 @@ DSA *DSA_new_method(ENGINE *engine)
{
DSA *ret;
- ret=(DSA *)malloc(sizeof(DSA));
+ ret = malloc(sizeof(DSA));
if (ret == NULL)
{
DSAerr(DSA_F_DSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/ec/ec_ameth.c b/lib/libssl/src/crypto/ec/ec_ameth.c
index ec074329f27..521ada32998 100644
--- a/lib/libssl/src/crypto/ec/ec_ameth.c
+++ b/lib/libssl/src/crypto/ec/ec_ameth.c
@@ -325,7 +325,7 @@ eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey)
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_EC_LIB);
return 0;
}
- ep = (unsigned char *) malloc(eplen);
+ ep = malloc(eplen);
if (!ep) {
EC_KEY_set_enc_flags(ec_key, old_flags);
ECerr(EC_F_ECKEY_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/ec/ec_key.c b/lib/libssl/src/crypto/ec/ec_key.c
index 1d727ec77da..d0c35bbd226 100644
--- a/lib/libssl/src/crypto/ec/ec_key.c
+++ b/lib/libssl/src/crypto/ec/ec_key.c
@@ -70,7 +70,7 @@ EC_KEY_new(void)
{
EC_KEY *ret;
- ret = (EC_KEY *) malloc(sizeof(EC_KEY));
+ ret = malloc(sizeof(EC_KEY));
if (ret == NULL) {
ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
diff --git a/lib/libssl/src/crypto/ec/ec_mult.c b/lib/libssl/src/crypto/ec/ec_mult.c
index 8894a8f907e..a2d8ce8bc10 100644
--- a/lib/libssl/src/crypto/ec/ec_mult.c
+++ b/lib/libssl/src/crypto/ec/ec_mult.c
@@ -105,7 +105,7 @@ ec_pre_comp_new(const EC_GROUP * group)
if (!group)
return NULL;
- ret = (EC_PRE_COMP *) malloc(sizeof(EC_PRE_COMP));
+ ret = malloc(sizeof(EC_PRE_COMP));
if (!ret) {
ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
diff --git a/lib/libssl/src/crypto/ec/ec_print.c b/lib/libssl/src/crypto/ec/ec_print.c
index 84a78903b38..aac1f4229ab 100644
--- a/lib/libssl/src/crypto/ec/ec_print.c
+++ b/lib/libssl/src/crypto/ec/ec_print.c
@@ -141,7 +141,7 @@ EC_POINT_point2hex(const EC_GROUP * group, const EC_POINT * point,
free(buf);
return NULL;
}
- ret = (char *) malloc(buf_len * 2 + 2);
+ ret = malloc(buf_len * 2 + 2);
if (ret == NULL) {
free(buf);
return NULL;
diff --git a/lib/libssl/src/crypto/ec/ecp_nistp224.c b/lib/libssl/src/crypto/ec/ecp_nistp224.c
index 17777f517b7..9204f6148d2 100644
--- a/lib/libssl/src/crypto/ec/ecp_nistp224.c
+++ b/lib/libssl/src/crypto/ec/ecp_nistp224.c
@@ -1188,7 +1188,7 @@ static NISTP224_PRE_COMP *
nistp224_pre_comp_new()
{
NISTP224_PRE_COMP *ret = NULL;
- ret = (NISTP224_PRE_COMP *) malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (!ret) {
ECerr(EC_F_NISTP224_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
diff --git a/lib/libssl/src/crypto/ec/ecp_nistp256.c b/lib/libssl/src/crypto/ec/ecp_nistp256.c
index 7fe7be27de4..cd589ff6110 100644
--- a/lib/libssl/src/crypto/ec/ecp_nistp256.c
+++ b/lib/libssl/src/crypto/ec/ecp_nistp256.c
@@ -1737,7 +1737,7 @@ static NISTP256_PRE_COMP *
nistp256_pre_comp_new()
{
NISTP256_PRE_COMP *ret = NULL;
- ret = (NISTP256_PRE_COMP *) malloc(sizeof *ret);
+ ret = malloc(sizeof *ret);
if (!ret) {
ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
diff --git a/lib/libssl/src/crypto/ec/ecp_nistp521.c b/lib/libssl/src/crypto/ec/ecp_nistp521.c
index 5d5a747ee85..fc8703e4c80 100644
--- a/lib/libssl/src/crypto/ec/ecp_nistp521.c
+++ b/lib/libssl/src/crypto/ec/ecp_nistp521.c
@@ -1628,7 +1628,7 @@ static NISTP521_PRE_COMP *
nistp521_pre_comp_new()
{
NISTP521_PRE_COMP *ret = NULL;
- ret = (NISTP521_PRE_COMP *) malloc(sizeof(NISTP521_PRE_COMP));
+ ret = malloc(sizeof(NISTP521_PRE_COMP));
if (!ret) {
ECerr(EC_F_NISTP521_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
return ret;
diff --git a/lib/libssl/src/crypto/ecdh/ech_lib.c b/lib/libssl/src/crypto/ecdh/ech_lib.c
index 51fb7d6afb7..ae1999b8c37 100644
--- a/lib/libssl/src/crypto/ecdh/ech_lib.c
+++ b/lib/libssl/src/crypto/ecdh/ech_lib.c
@@ -129,7 +129,7 @@ static ECDH_DATA *ECDH_DATA_new_method(ENGINE *engine)
{
ECDH_DATA *ret;
- ret=(ECDH_DATA *)malloc(sizeof(ECDH_DATA));
+ ret = malloc(sizeof(ECDH_DATA));
if (ret == NULL)
{
ECDHerr(ECDH_F_ECDH_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/ecdsa/ecs_lib.c b/lib/libssl/src/crypto/ecdsa/ecs_lib.c
index 81842a11a6e..9436de4d608 100644
--- a/lib/libssl/src/crypto/ecdsa/ecs_lib.c
+++ b/lib/libssl/src/crypto/ecdsa/ecs_lib.c
@@ -108,7 +108,7 @@ static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine)
{
ECDSA_DATA *ret;
- ret=(ECDSA_DATA *)malloc(sizeof(ECDSA_DATA));
+ ret = malloc(sizeof(ECDSA_DATA));
if (ret == NULL)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/engine/eng_lib.c b/lib/libssl/src/crypto/engine/eng_lib.c
index 5ced58c86e0..ce8d7b30189 100644
--- a/lib/libssl/src/crypto/engine/eng_lib.c
+++ b/lib/libssl/src/crypto/engine/eng_lib.c
@@ -65,7 +65,7 @@ ENGINE *ENGINE_new(void)
{
ENGINE *ret;
- ret = (ENGINE *)malloc(sizeof(ENGINE));
+ ret = malloc(sizeof(ENGINE));
if(ret == NULL)
{
ENGINEerr(ENGINE_F_ENGINE_NEW, ERR_R_MALLOC_FAILURE);
@@ -152,8 +152,7 @@ static int int_cleanup_check(int create)
}
static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
{
- ENGINE_CLEANUP_ITEM *item = malloc(sizeof(
- ENGINE_CLEANUP_ITEM));
+ ENGINE_CLEANUP_ITEM *item = malloc(sizeof(ENGINE_CLEANUP_ITEM));
if(!item) return NULL;
item->cb = cb;
return item;
diff --git a/lib/libssl/src/crypto/engine/hw_cryptodev.c b/lib/libssl/src/crypto/engine/hw_cryptodev.c
index 7da9913d285..7700adf971d 100644
--- a/lib/libssl/src/crypto/engine/hw_cryptodev.c
+++ b/lib/libssl/src/crypto/engine/hw_cryptodev.c
@@ -908,7 +908,7 @@ crparam2bn(struct crparam *crp, BIGNUM *a)
if (bytes == 0)
return (-1);
- if ((pd = (u_int8_t *) malloc(bytes)) == NULL)
+ if ((pd = malloc(bytes)) == NULL)
return (-1);
for (i = 0; i < bytes; i++)
diff --git a/lib/libssl/src/crypto/err/err.c b/lib/libssl/src/crypto/err/err.c
index 4ab667e19a6..c20773d3109 100644
--- a/lib/libssl/src/crypto/err/err.c
+++ b/lib/libssl/src/crypto/err/err.c
@@ -1017,7 +1017,7 @@ ERR_get_state(void)
/* ret == the error state, if NULL, make a new one */
if (ret == NULL) {
- ret = (ERR_STATE *)malloc(sizeof(ERR_STATE));
+ ret = malloc(sizeof(ERR_STATE));
if (ret == NULL)
return (&fallback);
CRYPTO_THREADID_cpy(&ret->tid, &tid);
diff --git a/lib/libssl/src/crypto/evp/bio_b64.c b/lib/libssl/src/crypto/evp/bio_b64.c
index 465753cf16f..9a08d3356dc 100644
--- a/lib/libssl/src/crypto/evp/bio_b64.c
+++ b/lib/libssl/src/crypto/evp/bio_b64.c
@@ -113,7 +113,7 @@ b64_new(BIO *bi)
{
BIO_B64_CTX *ctx;
- ctx = (BIO_B64_CTX *)malloc(sizeof(BIO_B64_CTX));
+ ctx = malloc(sizeof(BIO_B64_CTX));
if (ctx == NULL)
return (0);
diff --git a/lib/libssl/src/crypto/evp/bio_enc.c b/lib/libssl/src/crypto/evp/bio_enc.c
index df817b9d8fe..965f2ab623d 100644
--- a/lib/libssl/src/crypto/evp/bio_enc.c
+++ b/lib/libssl/src/crypto/evp/bio_enc.c
@@ -108,7 +108,7 @@ enc_new(BIO *bi)
{
BIO_ENC_CTX *ctx;
- ctx = (BIO_ENC_CTX *)malloc(sizeof(BIO_ENC_CTX));
+ ctx = malloc(sizeof(BIO_ENC_CTX));
if (ctx == NULL)
return (0);
EVP_CIPHER_CTX_init(&ctx->cipher);
diff --git a/lib/libssl/src/crypto/evp/bio_ok.c b/lib/libssl/src/crypto/evp/bio_ok.c
index 882aaee0fb5..3ba40485a22 100644
--- a/lib/libssl/src/crypto/evp/bio_ok.c
+++ b/lib/libssl/src/crypto/evp/bio_ok.c
@@ -178,7 +178,7 @@ ok_new(BIO *bi)
{
BIO_OK_CTX *ctx;
- ctx = (BIO_OK_CTX *)malloc(sizeof(BIO_OK_CTX));
+ ctx = malloc(sizeof(BIO_OK_CTX));
if (ctx == NULL)
return (0);
diff --git a/lib/libssl/src/crypto/evp/p_lib.c b/lib/libssl/src/crypto/evp/p_lib.c
index 97d922d1bab..b13163b26f1 100644
--- a/lib/libssl/src/crypto/evp/p_lib.c
+++ b/lib/libssl/src/crypto/evp/p_lib.c
@@ -188,7 +188,7 @@ EVP_PKEY_new(void)
{
EVP_PKEY *ret;
- ret = (EVP_PKEY *)malloc(sizeof(EVP_PKEY));
+ ret = malloc(sizeof(EVP_PKEY));
if (ret == NULL) {
EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);
return (NULL);
diff --git a/lib/libssl/src/crypto/evp/p_open.c b/lib/libssl/src/crypto/evp/p_open.c
index 88c0a455443..c10d7959c38 100644
--- a/lib/libssl/src/crypto/evp/p_open.c
+++ b/lib/libssl/src/crypto/evp/p_open.c
@@ -88,7 +88,7 @@ EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
}
size = RSA_size(priv->pkey.rsa);
- key = (unsigned char *)malloc(size + 2);
+ key = malloc(size + 2);
if (key == NULL) {
/* ERROR */
EVPerr(EVP_F_EVP_OPENINIT, ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/ex_data.c b/lib/libssl/src/crypto/ex_data.c
index 5cd01c72d10..62da76fd0ee 100644
--- a/lib/libssl/src/crypto/ex_data.c
+++ b/lib/libssl/src/crypto/ex_data.c
@@ -343,8 +343,8 @@ def_add_index(EX_CLASS_ITEM *item, long argl, void *argp,
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 *)malloc(
- sizeof(CRYPTO_EX_DATA_FUNCS));
+ CRYPTO_EX_DATA_FUNCS *a = malloc(sizeof(CRYPTO_EX_DATA_FUNCS));
+
if (!a) {
CRYPTOerr(CRYPTO_F_DEF_ADD_INDEX, ERR_R_MALLOC_FAILURE);
return -1;
diff --git a/lib/libssl/src/crypto/lhash/lhash.c b/lib/libssl/src/crypto/lhash/lhash.c
index 932391fa1e6..bbb46508f1e 100644
--- a/lib/libssl/src/crypto/lhash/lhash.c
+++ b/lib/libssl/src/crypto/lhash/lhash.c
@@ -191,7 +191,7 @@ lh_insert(_LHASH *lh, void *data)
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
- if ((nn = (LHASH_NODE *)malloc(sizeof(LHASH_NODE))) == NULL) {
+ if ((nn = malloc(sizeof(LHASH_NODE))) == NULL) {
lh->error++;
return (NULL);
}
diff --git a/lib/libssl/src/crypto/modes/gcm128.c b/lib/libssl/src/crypto/modes/gcm128.c
index 25754ccd991..09b1949c2a1 100644
--- a/lib/libssl/src/crypto/modes/gcm128.c
+++ b/lib/libssl/src/crypto/modes/gcm128.c
@@ -1527,7 +1527,7 @@ GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block)
{
GCM128_CONTEXT *ret;
- if ((ret = (GCM128_CONTEXT *)malloc(sizeof(GCM128_CONTEXT))))
+ if ((ret = malloc(sizeof(GCM128_CONTEXT))))
CRYPTO_gcm128_init(ret,key,block);
return ret;
diff --git a/lib/libssl/src/crypto/objects/o_names.c b/lib/libssl/src/crypto/objects/o_names.c
index 169b8ae87da..908d947b4ed 100644
--- a/lib/libssl/src/crypto/objects/o_names.c
+++ b/lib/libssl/src/crypto/objects/o_names.c
@@ -166,7 +166,7 @@ OBJ_NAME_add(const char *name, int type, const char *data)
alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS;
- onp = (OBJ_NAME *)malloc(sizeof(OBJ_NAME));
+ onp = malloc(sizeof(OBJ_NAME));
if (onp == NULL) {
/* ERROR */
return (0);
diff --git a/lib/libssl/src/crypto/objects/obj_dat.c b/lib/libssl/src/crypto/objects/obj_dat.c
index 301c8a266b9..a71b167263f 100644
--- a/lib/libssl/src/crypto/objects/obj_dat.c
+++ b/lib/libssl/src/crypto/objects/obj_dat.c
@@ -276,16 +276,16 @@ OBJ_add_object(const ASN1_OBJECT *obj)
return (0);
if ((o = OBJ_dup(obj)) == NULL)
goto err;
- if (!(ao[ADDED_NID] = (ADDED_OBJ *)malloc(sizeof(ADDED_OBJ))))
+ if (!(ao[ADDED_NID] = malloc(sizeof(ADDED_OBJ))))
goto err2;
if ((o->length != 0) && (obj->data != NULL))
- if (!(ao[ADDED_DATA] = (ADDED_OBJ *)malloc(sizeof(ADDED_OBJ))))
+ if (!(ao[ADDED_DATA] = malloc(sizeof(ADDED_OBJ))))
goto err2;
if (o->sn != NULL)
- if (!(ao[ADDED_SNAME] = (ADDED_OBJ *)malloc(sizeof(ADDED_OBJ))))
+ if (!(ao[ADDED_SNAME] = malloc(sizeof(ADDED_OBJ))))
goto err2;
if (o->ln != NULL)
- if (!(ao[ADDED_LNAME] = (ADDED_OBJ *)malloc(sizeof(ADDED_OBJ))))
+ if (!(ao[ADDED_LNAME] = malloc(sizeof(ADDED_OBJ))))
goto err2;
for (i = ADDED_DATA; i <= ADDED_NID; i++) {
@@ -467,7 +467,7 @@ OBJ_txt2obj(const char *s, int no_name)
/* Work out total size */
j = ASN1_object_size(0, i, V_ASN1_OBJECT);
- if ((buf = (unsigned char *)malloc(j)) == NULL)
+ if ((buf = malloc(j)) == NULL)
return NULL;
p = buf;
@@ -756,7 +756,7 @@ OBJ_create(const char *oid, const char *sn, const char *ln)
if (i <= 0)
return (0);
- if ((buf = (unsigned char *)malloc(i)) == NULL) {
+ if ((buf = malloc(i)) == NULL) {
OBJerr(OBJ_F_OBJ_CREATE, ERR_R_MALLOC_FAILURE);
return (0);
}
diff --git a/lib/libssl/src/crypto/pem/pem_lib.c b/lib/libssl/src/crypto/pem/pem_lib.c
index 5938330d453..b2f4ae0c59a 100644
--- a/lib/libssl/src/crypto/pem/pem_lib.c
+++ b/lib/libssl/src/crypto/pem/pem_lib.c
@@ -358,7 +358,7 @@ PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x,
}
/* dzise + 8 bytes are needed */
/* actually it needs the cipher block size extra... */
- data = (unsigned char *)malloc((unsigned int)dsize + 20);
+ data = malloc((unsigned int)dsize + 20);
if (data == NULL) {
PEMerr(PEM_F_PEM_ASN1_WRITE_BIO, ERR_R_MALLOC_FAILURE);
goto err;
diff --git a/lib/libssl/src/crypto/pem/pem_seal.c b/lib/libssl/src/crypto/pem/pem_seal.c
index e6e73dd23db..21d63bb4963 100644
--- a/lib/libssl/src/crypto/pem/pem_seal.c
+++ b/lib/libssl/src/crypto/pem/pem_seal.c
@@ -85,7 +85,7 @@ PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
if (j > max)
max = j;
}
- s = (char *)reallocarray(NULL, max, 2);
+ s = reallocarray(NULL, max, 2);
if (s == NULL) {
PEMerr(PEM_F_PEM_SEALINIT, ERR_R_MALLOC_FAILURE);
goto err;
diff --git a/lib/libssl/src/crypto/pem/pem_sign.c b/lib/libssl/src/crypto/pem/pem_sign.c
index bfe7823e3d5..4197436bfc6 100644
--- a/lib/libssl/src/crypto/pem/pem_sign.c
+++ b/lib/libssl/src/crypto/pem/pem_sign.c
@@ -85,7 +85,7 @@ PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret, unsigned int *siglen,
int i, ret = 0;
unsigned int m_len;
- m = (unsigned char *)malloc(EVP_PKEY_size(pkey) + 2);
+ m = malloc(EVP_PKEY_size(pkey) + 2);
if (m == NULL) {
PEMerr(PEM_F_PEM_SIGNFINAL, ERR_R_MALLOC_FAILURE);
goto err;
diff --git a/lib/libssl/src/crypto/rsa/rsa_ameth.c b/lib/libssl/src/crypto/rsa/rsa_ameth.c
index 2c7e39bb1d3..f54c93c8f9c 100644
--- a/lib/libssl/src/crypto/rsa/rsa_ameth.c
+++ b/lib/libssl/src/crypto/rsa/rsa_ameth.c
@@ -201,7 +201,7 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv)
update_buflen(x->iqmp, &buf_len);
}
- m=(unsigned char *)malloc(buf_len+10);
+ m = malloc(buf_len+10);
if (m == NULL)
{
RSAerr(RSA_F_DO_RSA_PRINT,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/rsa/rsa_lib.c b/lib/libssl/src/crypto/rsa/rsa_lib.c
index 1ea5e7bc64e..b48acaf758e 100644
--- a/lib/libssl/src/crypto/rsa/rsa_lib.c
+++ b/lib/libssl/src/crypto/rsa/rsa_lib.c
@@ -125,7 +125,7 @@ RSA *RSA_new_method(ENGINE *engine)
{
RSA *ret;
- ret=(RSA *)malloc(sizeof(RSA));
+ ret = malloc(sizeof(RSA));
if (ret == NULL)
{
RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/rsa/rsa_saos.c b/lib/libssl/src/crypto/rsa/rsa_saos.c
index ee5473a184b..56ad9b46677 100644
--- a/lib/libssl/src/crypto/rsa/rsa_saos.c
+++ b/lib/libssl/src/crypto/rsa/rsa_saos.c
@@ -82,7 +82,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type,
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return(0);
}
- s=(unsigned char *)malloc((unsigned int)j+1);
+ s = malloc((unsigned int)j+1);
if (s == NULL)
{
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
@@ -117,7 +117,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype,
return(0);
}
- s=(unsigned char *)malloc((unsigned int)siglen);
+ s = malloc((unsigned int)siglen);
if (s == NULL)
{
RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/rsa/rsa_sign.c b/lib/libssl/src/crypto/rsa/rsa_sign.c
index f9772bbce70..c6f7b0a3a3f 100644
--- a/lib/libssl/src/crypto/rsa/rsa_sign.c
+++ b/lib/libssl/src/crypto/rsa/rsa_sign.c
@@ -120,7 +120,7 @@ int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
return(0);
}
if(type != NID_md5_sha1) {
- tmps=(unsigned char *)malloc((unsigned int)j+1);
+ tmps = malloc((unsigned int)j+1);
if (tmps == NULL)
{
RSAerr(RSA_F_RSA_SIGN,ERR_R_MALLOC_FAILURE);
@@ -169,7 +169,7 @@ int int_rsa_verify(int dtype, const unsigned char *m,
return 1;
}
- s=(unsigned char *)malloc((unsigned int)siglen);
+ s = malloc((unsigned int)siglen);
if (s == NULL)
{
RSAerr(RSA_F_INT_RSA_VERIFY,ERR_R_MALLOC_FAILURE);
diff --git a/lib/libssl/src/crypto/srp/srp_vfy.c b/lib/libssl/src/crypto/srp/srp_vfy.c
index 6ad80ef9927..b03d0064bfc 100644
--- a/lib/libssl/src/crypto/srp/srp_vfy.c
+++ b/lib/libssl/src/crypto/srp/srp_vfy.c
@@ -243,7 +243,7 @@ static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
SRP_VBASE *SRP_VBASE_new(char *seed_key)
{
- SRP_VBASE *vb = (SRP_VBASE *) malloc(sizeof(SRP_VBASE));
+ SRP_VBASE *vb = malloc(sizeof(SRP_VBASE));
if (vb == NULL)
return NULL;
@@ -283,7 +283,7 @@ static SRP_gN_cache *SRP_gN_new_init(const char *ch)
unsigned char tmp[MAX_LEN];
int len;
- SRP_gN_cache *newgN = (SRP_gN_cache *)malloc(sizeof(SRP_gN_cache));
+ SRP_gN_cache *newgN = malloc(sizeof(SRP_gN_cache));
if (newgN == NULL)
return NULL;
@@ -395,7 +395,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
{
/*we add this couple in the internal Stack */
- if ((gN = (SRP_gN *)malloc(sizeof(SRP_gN))) == NULL)
+ if ((gN = malloc(sizeof(SRP_gN))) == NULL)
goto err;
if (!(gN->id = BUF_strdup(pp[DB_srpid]))
diff --git a/lib/libssl/src/crypto/store/str_lib.c b/lib/libssl/src/crypto/store/str_lib.c
index c50620308a5..0f88664acd7 100644
--- a/lib/libssl/src/crypto/store/str_lib.c
+++ b/lib/libssl/src/crypto/store/str_lib.c
@@ -109,7 +109,7 @@ STORE_new_method(const STORE_METHOD *method)
return NULL;
}
- ret = (STORE *)malloc(sizeof(STORE));
+ ret = malloc(sizeof(STORE));
if (ret == NULL) {
STOREerr(STORE_F_STORE_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -1226,7 +1226,7 @@ struct STORE_attr_info_st {
STORE_ATTR_INFO *
STORE_ATTR_INFO_new(void)
{
- return (STORE_ATTR_INFO *)malloc(sizeof(STORE_ATTR_INFO));
+ return malloc(sizeof(STORE_ATTR_INFO));
}
static void
@@ -1489,7 +1489,8 @@ STORE_parse_attrs_start(OPENSSL_ITEM *attributes)
{
if (attributes) {
struct attr_list_ctx_st *context =
- (struct attr_list_ctx_st *)malloc(sizeof(struct attr_list_ctx_st));
+ malloc(sizeof(struct attr_list_ctx_st));
+
if (context)
context->attributes = attributes;
else
diff --git a/lib/libssl/src/crypto/store/str_mem.c b/lib/libssl/src/crypto/store/str_mem.c
index 0409fd198de..d59799196ae 100644
--- a/lib/libssl/src/crypto/store/str_mem.c
+++ b/lib/libssl/src/crypto/store/str_mem.c
@@ -224,8 +224,7 @@ static void *
mem_list_start(STORE *s, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
- struct mem_ctx_st *context =
- (struct mem_ctx_st *)malloc(sizeof(struct mem_ctx_st));
+ struct mem_ctx_st *context = malloc(sizeof(struct mem_ctx_st));
void *attribute_context = NULL;
STORE_ATTR_INFO *attrs = NULL;
diff --git a/lib/libssl/src/crypto/ts/ts_rsp_sign.c b/lib/libssl/src/crypto/ts/ts_rsp_sign.c
index 39d2efd3db7..e65a535a45d 100644
--- a/lib/libssl/src/crypto/ts/ts_rsp_sign.c
+++ b/lib/libssl/src/crypto/ts/ts_rsp_sign.c
@@ -928,7 +928,7 @@ ESS_add_signing_cert(PKCS7_SIGNER_INFO *si, ESS_SIGNING_CERT *sc)
int len;
len = i2d_ESS_SIGNING_CERT(sc, NULL);
- if (!(pp = (unsigned char *) malloc(len))) {
+ if (!(pp = malloc(len))) {
TSerr(TS_F_ESS_ADD_SIGNING_CERT, ERR_R_MALLOC_FAILURE);
goto err;
}
diff --git a/lib/libssl/src/crypto/ui/ui_lib.c b/lib/libssl/src/crypto/ui/ui_lib.c
index ff548f4bb8d..e23f19a838b 100644
--- a/lib/libssl/src/crypto/ui/ui_lib.c
+++ b/lib/libssl/src/crypto/ui/ui_lib.c
@@ -80,7 +80,7 @@ UI_new_method(const UI_METHOD *method)
{
UI *ret;
- ret = (UI *) malloc(sizeof(UI));
+ ret = malloc(sizeof(UI));
if (ret == NULL) {
UIerr(UI_F_UI_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return NULL;
@@ -149,7 +149,7 @@ general_allocate_prompt(UI *ui, const char *prompt, int prompt_freeable,
} 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 *) malloc(sizeof(UI_STRING)))) {
+ } else if ((ret = malloc(sizeof(UI_STRING)))) {
ret->out_string = prompt;
ret->flags = prompt_freeable ? OUT_STRING_FREEABLE : 0;
ret->input_flags = input_flags;
diff --git a/lib/libssl/src/crypto/x509/by_dir.c b/lib/libssl/src/crypto/x509/by_dir.c
index 554f6600dc9..40b0a1296a8 100644
--- a/lib/libssl/src/crypto/x509/by_dir.c
+++ b/lib/libssl/src/crypto/x509/by_dir.c
@@ -153,7 +153,7 @@ new_dir(X509_LOOKUP *lu)
{
BY_DIR *a;
- if ((a = (BY_DIR *)malloc(sizeof(BY_DIR))) == NULL)
+ if ((a = malloc(sizeof(BY_DIR))) == NULL)
return (0);
if ((a->buffer = BUF_MEM_new()) == NULL) {
free(a);
diff --git a/lib/libssl/src/crypto/x509/x509_lu.c b/lib/libssl/src/crypto/x509/x509_lu.c
index aec1121ffb0..a2219258dbd 100644
--- a/lib/libssl/src/crypto/x509/x509_lu.c
+++ b/lib/libssl/src/crypto/x509/x509_lu.c
@@ -67,7 +67,7 @@ X509_LOOKUP_new(X509_LOOKUP_METHOD *method)
{
X509_LOOKUP *ret;
- ret = (X509_LOOKUP *)malloc(sizeof(X509_LOOKUP));
+ ret = malloc(sizeof(X509_LOOKUP));
if (ret == NULL)
return NULL;
@@ -193,7 +193,7 @@ X509_STORE_new(void)
{
X509_STORE *ret;
- if ((ret = (X509_STORE *)malloc(sizeof(X509_STORE))) == NULL)
+ if ((ret = malloc(sizeof(X509_STORE))) == NULL)
return NULL;
ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
ret->cache = 1;
@@ -346,7 +346,7 @@ X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
if (x == NULL)
return 0;
- obj = (X509_OBJECT *)malloc(sizeof(X509_OBJECT));
+ obj = malloc(sizeof(X509_OBJECT));
if (obj == NULL) {
X509err(X509_F_X509_STORE_ADD_CERT, ERR_R_MALLOC_FAILURE);
return 0;
@@ -380,7 +380,7 @@ X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
if (x == NULL)
return 0;
- obj = (X509_OBJECT *)malloc(sizeof(X509_OBJECT));
+ obj = malloc(sizeof(X509_OBJECT));
if (obj == NULL) {
X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
return 0;
diff --git a/lib/libssl/src/crypto/x509/x509_req.c b/lib/libssl/src/crypto/x509/x509_req.c
index ae6fbd7d148..9ca09d134ad 100644
--- a/lib/libssl/src/crypto/x509/x509_req.c
+++ b/lib/libssl/src/crypto/x509/x509_req.c
@@ -84,7 +84,7 @@ X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
ri = ret->req_info;
ri->version->length = 1;
- ri->version->data = (unsigned char *)malloc(1);
+ ri->version->data = malloc(1);
if (ri->version->data == NULL)
goto err;
ri->version->data[0] = 0; /* version == 0 */
diff --git a/lib/libssl/src/ssl/pqueue.c b/lib/libssl/src/ssl/pqueue.c
index af8530064fe..d1c258a1791 100644
--- a/lib/libssl/src/ssl/pqueue.c
+++ b/lib/libssl/src/ssl/pqueue.c
@@ -70,7 +70,7 @@ typedef struct _pqueue {
pitem *
pitem_new(unsigned char *prio64be, void *data)
{
- pitem *item = (pitem *)malloc(sizeof(pitem));
+ pitem *item = malloc(sizeof(pitem));
if (item == NULL)
return NULL;
@@ -92,7 +92,7 @@ pitem_free(pitem *item)
pqueue_s *
pqueue_new(void)
{
- return (pqueue_s *)calloc(1, sizeof(pqueue_s));
+ return calloc(1, sizeof(pqueue_s));
}
void