diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2015-07-19 18:29:32 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2015-07-19 18:29:32 +0000 |
commit | c3a72a93fea3c87c773eec56f07ec509fe45a553 (patch) | |
tree | e896067c5ced703f850ffe85c2b326970c364b24 | |
parent | 7c3d71dc66acc3e42a2d0d14393f6c0af01abdb2 (diff) |
Drop stupid (int) casts for the arguments of malloc() and friends. This is
not 16-bit MS-DOS anymore.
ok bcook@ tedu@
-rw-r--r-- | lib/libssl/src/crypto/asn1/a_bitstr.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/asn1/a_int.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/asn1/a_sign.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/bio/bf_buff.c | 8 | ||||
-rw-r--r-- | lib/libssl/src/crypto/bio/bf_lbuf.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/ocsp/ocsp_ext.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/pem/pem_lib.c | 4 | ||||
-rw-r--r-- | lib/libssl/src/crypto/rsa/rsa_saos.c | 6 | ||||
-rw-r--r-- | lib/libssl/src/crypto/rsa/rsa_sign.c | 6 |
9 files changed, 24 insertions, 24 deletions
diff --git a/lib/libssl/src/crypto/asn1/a_bitstr.c b/lib/libssl/src/crypto/asn1/a_bitstr.c index 473a945e099..5575a5c9394 100644 --- a/lib/libssl/src/crypto/asn1/a_bitstr.c +++ b/lib/libssl/src/crypto/asn1/a_bitstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_bitstr.c,v 1.20 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: a_bitstr.c,v 1.21 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -155,7 +155,7 @@ c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len) if (len-- > 1) /* using one because of the bits left byte */ { - s = malloc((int)len); + s = malloc(len); if (s == NULL) { i = ERR_R_MALLOC_FAILURE; goto err; diff --git a/lib/libssl/src/crypto/asn1/a_int.c b/lib/libssl/src/crypto/asn1/a_int.c index af5d64d0568..7d17aae2a2d 100644 --- a/lib/libssl/src/crypto/asn1/a_int.c +++ b/lib/libssl/src/crypto/asn1/a_int.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_int.c,v 1.26 2015/03/19 14:00:22 tedu Exp $ */ +/* $OpenBSD: a_int.c,v 1.27 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -310,7 +310,7 @@ d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp, long length) /* We must malloc stuff, even for 0 bytes otherwise it * signifies a missing NULL parameter. */ - s = malloc((int)len + 1); + s = malloc(len + 1); if (s == NULL) { i = ERR_R_MALLOC_FAILURE; goto err; diff --git a/lib/libssl/src/crypto/asn1/a_sign.c b/lib/libssl/src/crypto/asn1/a_sign.c index 83e7f44d127..d9385312a7d 100644 --- a/lib/libssl/src/crypto/asn1/a_sign.c +++ b/lib/libssl/src/crypto/asn1/a_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_sign.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: a_sign.c,v 1.20 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -203,7 +203,7 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, inl = ASN1_item_i2d(asn, &buf_in, it); outll = outl = EVP_PKEY_size(pkey); - buf_out = malloc((unsigned int)outl); + buf_out = malloc(outl); if ((buf_in == NULL) || (buf_out == NULL)) { outl = 0; ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_MALLOC_FAILURE); @@ -229,7 +229,7 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, err: EVP_MD_CTX_cleanup(ctx); if (buf_in != NULL) { - OPENSSL_cleanse((char *)buf_in, (unsigned int)inl); + OPENSSL_cleanse((char *)buf_in, inl); free(buf_in); } if (buf_out != NULL) { diff --git a/lib/libssl/src/crypto/bio/bf_buff.c b/lib/libssl/src/crypto/bio/bf_buff.c index 639e3f318d0..588cc48a28c 100644 --- a/lib/libssl/src/crypto/bio/bf_buff.c +++ b/lib/libssl/src/crypto/bio/bf_buff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_buff.c,v 1.22 2015/07/19 01:18:17 beck Exp $ */ +/* $OpenBSD: bf_buff.c,v 1.23 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -339,7 +339,7 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) break; case BIO_C_SET_BUFF_READ_DATA: if (num > ctx->ibuf_size) { - p1 = malloc((int)num); + p1 = malloc(num); if (p1 == NULL) goto malloc_error; free(ctx->ibuf); @@ -369,12 +369,12 @@ buffer_ctrl(BIO *b, int cmd, long num, void *ptr) p1 = ctx->ibuf; p2 = ctx->obuf; if ((ibs > DEFAULT_BUFFER_SIZE) && (ibs != ctx->ibuf_size)) { - p1 = malloc((int)num); + p1 = malloc(num); if (p1 == NULL) goto malloc_error; } if ((obs > DEFAULT_BUFFER_SIZE) && (obs != ctx->obuf_size)) { - p2 = malloc((int)num); + p2 = malloc(num); if (p2 == NULL) { if (p1 != ctx->ibuf) free(p1); diff --git a/lib/libssl/src/crypto/bio/bf_lbuf.c b/lib/libssl/src/crypto/bio/bf_lbuf.c index e90b7f239fb..7978fdb347a 100644 --- a/lib/libssl/src/crypto/bio/bf_lbuf.c +++ b/lib/libssl/src/crypto/bio/bf_lbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bf_lbuf.c,v 1.12 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: bf_lbuf.c,v 1.13 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -280,7 +280,7 @@ linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) obs = (int)num; p = ctx->obuf; if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) { - p = malloc((int)num); + p = malloc(num); if (p == NULL) goto malloc_error; } diff --git a/lib/libssl/src/crypto/ocsp/ocsp_ext.c b/lib/libssl/src/crypto/ocsp/ocsp_ext.c index 7e69ad4fe08..edcf5bcca88 100644 --- a/lib/libssl/src/crypto/ocsp/ocsp_ext.c +++ b/lib/libssl/src/crypto/ocsp/ocsp_ext.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_ext.c,v 1.13 2014/10/28 05:46:56 miod Exp $ */ +/* $OpenBSD: ocsp_ext.c,v 1.14 2015/07/19 18:29:31 miod Exp $ */ /* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL * project. */ @@ -326,7 +326,7 @@ ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, void *data, if (data) { if ((i = i2d(data, NULL)) <= 0) goto err; - if (!(b = p = malloc((unsigned int)i))) + if (!(b = p = malloc(i))) goto err; if (i2d(data, &p) <= 0) goto err; @@ -335,7 +335,7 @@ ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d, void *data, (I2D_OF(ASN1_OBJECT))i2d, V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL, IS_SEQUENCE)) <= 0) goto err; - if (!(b = p = malloc((unsigned int)i))) + if (!(b = p = malloc(i))) goto err; if (i2d_ASN1_SET_OF_ASN1_OBJECT(sk, &p, (I2D_OF(ASN1_OBJECT))i2d, V_ASN1_SEQUENCE, diff --git a/lib/libssl/src/crypto/pem/pem_lib.c b/lib/libssl/src/crypto/pem/pem_lib.c index 221b308d717..6f8759a9ee9 100644 --- a/lib/libssl/src/crypto/pem/pem_lib.c +++ b/lib/libssl/src/crypto/pem/pem_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pem_lib.c,v 1.40 2015/07/16 02:14:48 miod Exp $ */ +/* $OpenBSD: pem_lib.c,v 1.41 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -370,7 +370,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 = malloc((unsigned int)dsize + 20); + data = malloc(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/rsa/rsa_saos.c b/lib/libssl/src/crypto/rsa/rsa_saos.c index adf459ee6df..3a07a7af4a4 100644 --- a/lib/libssl/src/crypto/rsa/rsa_saos.c +++ b/lib/libssl/src/crypto/rsa/rsa_saos.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_saos.c,v 1.16 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: rsa_saos.c,v 1.17 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -84,7 +84,7 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len, RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY); return 0; } - s = malloc((unsigned int)j + 1); + s = malloc(j + 1); if (s == NULL) { RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE); return 0; @@ -117,7 +117,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, return 0; } - s = malloc((unsigned int)siglen); + s = malloc(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 09d8ef329db..db63c5f038e 100644 --- a/lib/libssl/src/crypto/rsa/rsa_sign.c +++ b/lib/libssl/src/crypto/rsa/rsa_sign.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_sign.c,v 1.23 2015/06/20 01:07:25 doug Exp $ */ +/* $OpenBSD: rsa_sign.c,v 1.24 2015/07/19 18:29:31 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -121,7 +121,7 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len, return 0; } if (type != NID_md5_sha1) { - tmps = malloc((unsigned int)j + 1); + tmps = malloc(j + 1); if (tmps == NULL) { RSAerr(RSA_F_RSA_SIGN, ERR_R_MALLOC_FAILURE); return 0; @@ -166,7 +166,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, return 1; } - s = malloc((unsigned int)siglen); + s = malloc(siglen); if (s == NULL) { RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE); goto err; |