diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2014-04-17 13:37:51 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2014-04-17 13:37:51 +0000 |
commit | 798a6f0972ce4f8ea25aa987dc43e626dc6d4087 (patch) | |
tree | 557371c7b1514332c466ec6233d3e6af96c88520 /lib/libssl | |
parent | eea79ffdb77e3dd4cdbd3f98ed1b44d9522496fa (diff) |
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/bio_ssl.c | 4 | ||||
-rw-r--r-- | lib/libssl/d1_both.c | 24 | ||||
-rw-r--r-- | lib/libssl/d1_clnt.c | 10 | ||||
-rw-r--r-- | lib/libssl/d1_lib.c | 26 | ||||
-rw-r--r-- | lib/libssl/d1_pkt.c | 18 | ||||
-rw-r--r-- | lib/libssl/d1_srvr.c | 12 | ||||
-rw-r--r-- | lib/libssl/s23_srvr.c | 4 | ||||
-rw-r--r-- | lib/libssl/s3_both.c | 8 | ||||
-rw-r--r-- | lib/libssl/s3_clnt.c | 22 | ||||
-rw-r--r-- | lib/libssl/s3_lib.c | 28 | ||||
-rw-r--r-- | lib/libssl/s3_srvr.c | 24 | ||||
-rw-r--r-- | lib/libssl/ssl_asn1.c | 30 | ||||
-rw-r--r-- | lib/libssl/ssl_cert.c | 10 | ||||
-rw-r--r-- | lib/libssl/ssl_ciph.c | 34 | ||||
-rw-r--r-- | lib/libssl/ssl_lib.c | 34 | ||||
-rw-r--r-- | lib/libssl/ssl_sess.c | 32 | ||||
-rw-r--r-- | lib/libssl/t1_enc.c | 18 | ||||
-rw-r--r-- | lib/libssl/t1_lib.c | 56 |
18 files changed, 197 insertions, 197 deletions
diff --git a/lib/libssl/bio_ssl.c b/lib/libssl/bio_ssl.c index 65077aaa00d..35463c73d45 100644 --- a/lib/libssl/bio_ssl.c +++ b/lib/libssl/bio_ssl.c @@ -105,7 +105,7 @@ ssl_new(BIO *bi) { 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); @@ -134,7 +134,7 @@ ssl_free(BIO *a) a->flags = 0; } if (a->ptr != NULL) - OPENSSL_free(a->ptr); + free(a->ptr); return (1); } diff --git a/lib/libssl/d1_both.c b/lib/libssl/d1_both.c index 731245c6a6c..2f7dc283a03 100644 --- a/lib/libssl/d1_both.c +++ b/lib/libssl/d1_both.c @@ -179,14 +179,14 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) 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; } } @@ -196,11 +196,11 @@ dtls1_hm_fragment_new(unsigned long frag_len, int reassembly) /* 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)); @@ -220,10 +220,10 @@ dtls1_hm_fragment_free(hm_fragment *frag) 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) */ @@ -636,7 +636,7 @@ dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) { is_complete); if (is_complete) { - OPENSSL_free(frag->reassembly); + free(frag->reassembly); frag->reassembly = NULL; } @@ -660,7 +660,7 @@ err: if (frag != NULL) dtls1_hm_fragment_free(frag); if (item != NULL) - OPENSSL_free(item); + free(item); *ok = 0; return i; } @@ -742,7 +742,7 @@ err: if (frag != NULL) dtls1_hm_fragment_free(frag); if (item != NULL) - OPENSSL_free(item); + free(item); *ok = 0; return i; } diff --git a/lib/libssl/d1_clnt.c b/lib/libssl/d1_clnt.c index 1b7cbaec15d..3f159eed263 100644 --- a/lib/libssl/d1_clnt.c +++ b/lib/libssl/d1_clnt.c @@ -1317,7 +1317,7 @@ dtls1_send_client_key_exchange(SSL *s) NULL, 0, NULL); encodedPoint = (unsigned char *) - OPENSSL_malloc(encoded_pt_len * + malloc(encoded_pt_len * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); @@ -1347,7 +1347,7 @@ dtls1_send_client_key_exchange(SSL *s) /* 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); @@ -1393,7 +1393,7 @@ dtls1_send_client_key_exchange(SSL *s) 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) { @@ -1403,7 +1403,7 @@ dtls1_send_client_key_exchange(SSL *s) } 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, @@ -1460,7 +1460,7 @@ err: #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); diff --git a/lib/libssl/d1_lib.c b/lib/libssl/d1_lib.c index 73c44c807a9..7da57b0a36e 100644 --- a/lib/libssl/d1_lib.c +++ b/lib/libssl/d1_lib.c @@ -100,7 +100,7 @@ dtls1_new(SSL *s) 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; */ @@ -128,7 +128,7 @@ dtls1_new(SSL *s) 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); } @@ -147,39 +147,39 @@ dtls1_clear_queues(SSL *s) 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); } } @@ -197,7 +197,7 @@ dtls1_free(SSL *s) pqueue_free(s->d1->sent_messages); pqueue_free(s->d1->buffered_app_data.q); - OPENSSL_free(s->d1); + free(s->d1); s->d1 = NULL; } diff --git a/lib/libssl/d1_pkt.c b/lib/libssl/d1_pkt.c index cb5f2c3199c..69f3d457347 100644 --- a/lib/libssl/d1_pkt.c +++ b/lib/libssl/d1_pkt.c @@ -200,7 +200,7 @@ dtls1_copy_record(SSL *s, pitem *item) 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; @@ -224,11 +224,11 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) 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); @@ -253,7 +253,7 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) /* 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); } @@ -265,7 +265,7 @@ dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) 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); } @@ -283,7 +283,7 @@ dtls1_retrieve_buffered_record(SSL *s, record_pqueue *queue) if (item) { dtls1_copy_record(s, item); - OPENSSL_free(item->data); + free(item->data); pitem_free(item); return (1); @@ -360,14 +360,14 @@ dtls1_get_buffered_record(SSL *s) 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++; */ @@ -810,7 +810,7 @@ start: dtls1_copy_record(s, item); - OPENSSL_free(item->data); + free(item->data); pitem_free(item); } } diff --git a/lib/libssl/d1_srvr.c b/lib/libssl/d1_srvr.c index 6040dd96ca8..9b87dcd0676 100644 --- a/lib/libssl/d1_srvr.c +++ b/lib/libssl/d1_srvr.c @@ -1188,7 +1188,7 @@ dtls1_send_server_key_exchange(SSL *s) 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)) { @@ -1289,7 +1289,7 @@ dtls1_send_server_key_exchange(SSL *s) memcpy((unsigned char*)p, (unsigned char *)encodedPoint, encodedlen); - OPENSSL_free(encodedPoint); + free(encodedPoint); p += encodedlen; } #endif @@ -1398,7 +1398,7 @@ f_err: 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); @@ -1564,7 +1564,7 @@ dtls1_send_newsession_ticket(SSL *s) 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; @@ -1580,7 +1580,7 @@ dtls1_send_newsession_ticket(SSL *s) 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 { @@ -1624,7 +1624,7 @@ dtls1_send_newsession_ticket(SSL *s) 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; diff --git a/lib/libssl/s23_srvr.c b/lib/libssl/s23_srvr.c index 35651183b77..8010d72fa72 100644 --- a/lib/libssl/s23_srvr.c +++ b/lib/libssl/s23_srvr.c @@ -533,10 +533,10 @@ ssl23_get_client_hello(SSL *s) 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); } diff --git a/lib/libssl/s3_both.c b/lib/libssl/s3_both.c index 5642e6c175a..12b38c4596a 100644 --- a/lib/libssl/s3_both.c +++ b/lib/libssl/s3_both.c @@ -650,7 +650,7 @@ ssl3_setup_read_buffer(SSL *s) 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; @@ -690,7 +690,7 @@ ssl3_setup_write_buffer(SSL *s) 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; @@ -718,7 +718,7 @@ int 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; @@ -728,7 +728,7 @@ int 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; diff --git a/lib/libssl/s3_clnt.c b/lib/libssl/s3_clnt.c index 88be294ab78..26bdef6b4fc 100644 --- a/lib/libssl/s3_clnt.c +++ b/lib/libssl/s3_clnt.c @@ -1222,7 +1222,7 @@ ssl3_get_key_exchange(SSL *s) 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 @@ -1288,7 +1288,7 @@ ssl3_get_key_exchange(SSL *s) 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); @@ -1913,10 +1913,10 @@ ssl3_get_new_session_ticket(SSL *s) 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; @@ -1988,7 +1988,7 @@ ssl3_get_cert_status(SSL *s) 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; @@ -2449,7 +2449,7 @@ ssl3_send_client_key_exchange(SSL *s) NULL, 0, NULL); encodedPoint = - (unsigned char *)OPENSSL_malloc( + (unsigned char *)malloc( encoded_pt_len * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); @@ -2479,7 +2479,7 @@ ssl3_send_client_key_exchange(SSL *s) /* 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); @@ -2584,7 +2584,7 @@ ssl3_send_client_key_exchange(SSL *s) 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, @@ -2636,7 +2636,7 @@ ssl3_send_client_key_exchange(SSL *s) 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) { @@ -2646,7 +2646,7 @@ ssl3_send_client_key_exchange(SSL *s) } 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, @@ -2696,7 +2696,7 @@ err: #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); diff --git a/lib/libssl/s3_lib.c b/lib/libssl/s3_lib.c index 68a4b8ca2de..8df07a1e4c7 100644 --- a/lib/libssl/s3_lib.c +++ b/lib/libssl/s3_lib.c @@ -2946,7 +2946,7 @@ ssl3_new(SSL *s) { 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)); @@ -2970,9 +2970,9 @@ ssl3_free(SSL *s) #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); @@ -2981,7 +2981,7 @@ ssl3_free(SSL *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); @@ -3002,7 +3002,7 @@ ssl3_free(SSL *s) SSL_SRP_CTX_free(s); #endif OPENSSL_cleanse(s->s3, sizeof *s->s3); - OPENSSL_free(s->s3); + free(s->s3); s->s3 = NULL; } @@ -3015,10 +3015,10 @@ ssl3_clear(SSL *s) #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 @@ -3027,7 +3027,7 @@ ssl3_clear(SSL *s) 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 @@ -3078,7 +3078,7 @@ ssl3_clear(SSL *s) #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; } @@ -3236,7 +3236,7 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) 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; @@ -3269,9 +3269,9 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) 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) { @@ -3313,7 +3313,7 @@ ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) 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; @@ -3537,7 +3537,7 @@ ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) 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; diff --git a/lib/libssl/s3_srvr.c b/lib/libssl/s3_srvr.c index cc46e241d4f..927b0d7db1e 100644 --- a/lib/libssl/s3_srvr.c +++ b/lib/libssl/s3_srvr.c @@ -1760,7 +1760,7 @@ ssl3_send_server_key_exchange(SSL *s) 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)) { @@ -1891,7 +1891,7 @@ ssl3_send_server_key_exchange(SSL *s) p += 1; memcpy((unsigned char*)p, (unsigned char *)encodedPoint, encodedlen); - OPENSSL_free(encodedPoint); + free(encodedPoint); encodedPoint = NULL; p += encodedlen; } @@ -2012,7 +2012,7 @@ f_err: 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); @@ -2706,7 +2706,7 @@ ssl3_get_client_key_exchange(SSL *s) 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, @@ -2715,7 +2715,7 @@ ssl3_get_client_key_exchange(SSL *s) } 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) { @@ -2752,7 +2752,7 @@ ssl3_get_client_key_exchange(SSL *s) 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, @@ -3314,7 +3314,7 @@ ssl3_send_newsession_ticket(SSL *s) */ if (slen_full > 0xFF00) return -1; - senc = OPENSSL_malloc(slen_full); + senc = malloc(slen_full); if (!senc) return -1; p = senc; @@ -3327,7 +3327,7 @@ ssl3_send_newsession_ticket(SSL *s) const_p = senc; sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); if (sess == NULL) { - OPENSSL_free(senc); + free(senc); return -1; } @@ -3337,7 +3337,7 @@ ssl3_send_newsession_ticket(SSL *s) slen = i2d_SSL_SESSION(sess, NULL); if (slen > slen_full) { /* shouldn't ever happen */ - OPENSSL_free(senc); + free(senc); return -1; } p = senc; @@ -3372,7 +3372,7 @@ ssl3_send_newsession_ticket(SSL *s) 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 { @@ -3426,7 +3426,7 @@ ssl3_send_newsession_ticket(SSL *s) 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 */ @@ -3529,7 +3529,7 @@ ssl3_get_next_proto(SSL *s) 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; diff --git a/lib/libssl/ssl_asn1.c b/lib/libssl/ssl_asn1.c index 28e295f6a44..60ee189f298 100644 --- a/lib/libssl/ssl_asn1.c +++ b/lib/libssl/ssl_asn1.c @@ -145,7 +145,7 @@ i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) /* 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; @@ -375,7 +375,7 @@ long length) 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; } @@ -385,7 +385,7 @@ long length) 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; } @@ -439,7 +439,7 @@ long length) 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 @@ -453,13 +453,13 @@ long length) 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 @@ -469,7 +469,7 @@ long length) 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 @@ -493,7 +493,7 @@ long length) 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 @@ -503,7 +503,7 @@ long length) 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 @@ -515,7 +515,7 @@ long length) 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 @@ -528,7 +528,7 @@ long length) 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 @@ -539,7 +539,7 @@ long length) 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 @@ -551,7 +551,7 @@ long length) 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) @@ -575,7 +575,7 @@ long 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 @@ -586,7 +586,7 @@ long length) 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 diff --git a/lib/libssl/ssl_cert.c b/lib/libssl/ssl_cert.c index 72b5d8d2bd0..87dc80be20f 100644 --- a/lib/libssl/ssl_cert.c +++ b/lib/libssl/ssl_cert.c @@ -180,7 +180,7 @@ CERT { 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); @@ -199,7 +199,7 @@ CERT 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); @@ -387,7 +387,7 @@ ssl_cert_free(CERT *c) EVP_PKEY_free(c->pkeys[i].publickey); #endif } - OPENSSL_free(c); + free(c); } int @@ -422,7 +422,7 @@ SESS_CERT { 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; @@ -483,7 +483,7 @@ ssl_sess_cert_free(SESS_CERT *sc) EC_KEY_free(sc->peer_ecdh_tmp); #endif - OPENSSL_free(sc); + free(sc); } int diff --git a/lib/libssl/ssl_ciph.c b/lib/libssl/ssl_ciph.c index 4bd3be0d41f..b56a93d4cbf 100644 --- a/lib/libssl/ssl_ciph.c +++ b/lib/libssl/ssl_ciph.c @@ -456,12 +456,12 @@ load_builtin_compressions(void) 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; @@ -1037,7 +1037,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) 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); @@ -1061,7 +1061,7 @@ ssl_cipher_strength_sort(CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p) 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); } @@ -1336,7 +1336,7 @@ STACK_OF(SSL_CIPHER) #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 */ @@ -1380,7 +1380,7 @@ STACK_OF(SSL_CIPHER) /* 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; } @@ -1398,9 +1398,9 @@ STACK_OF(SSL_CIPHER) */ 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 */ } @@ -1425,11 +1425,11 @@ STACK_OF(SSL_CIPHER) 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); } @@ -1438,7 +1438,7 @@ STACK_OF(SSL_CIPHER) * if we cannot get one. */ if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL) { - OPENSSL_free(co_list); + free(co_list); return (NULL); } @@ -1454,7 +1454,7 @@ STACK_OF(SSL_CIPHER) #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) { @@ -1642,9 +1642,9 @@ char 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"); @@ -1767,19 +1767,19 @@ SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) } 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); diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c index 6db3bd29933..589bd625bb4 100644 --- a/lib/libssl/ssl_lib.c +++ b/lib/libssl/ssl_lib.c @@ -281,7 +281,7 @@ SSL return (NULL); } - s = (SSL *)OPENSSL_malloc(sizeof(SSL)); + s = (SSL *)malloc(sizeof(SSL)); if (s == NULL) goto err; memset(s, 0, sizeof(SSL)); @@ -380,7 +380,7 @@ err: 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); @@ -558,24 +558,24 @@ SSL_free(SSL *s) #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) @@ -594,7 +594,7 @@ SSL_free(SSL *s) #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 @@ -602,7 +602,7 @@ SSL_free(SSL *s) sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); #endif - OPENSSL_free(s); + free(s); } void @@ -1703,7 +1703,7 @@ SSL_CTX 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; @@ -1862,7 +1862,7 @@ err2: #if 0 static void SSL_COMP_free(SSL_COMP *comp) - { OPENSSL_free(comp); + { free(comp); } #endif @@ -1933,7 +1933,7 @@ SSL_CTX_free(SSL_CTX *a) #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); @@ -1943,7 +1943,7 @@ SSL_CTX_free(SSL_CTX *a) ENGINE_finish(a->client_cert_engine); #endif - OPENSSL_free(a); + free(a); } void @@ -2696,12 +2696,12 @@ ssl_clear_cipher_ctx(SSL *s) { 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 @@ -3095,7 +3095,7 @@ SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) 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) @@ -3119,7 +3119,7 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint) 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) diff --git a/lib/libssl/ssl_sess.c b/lib/libssl/ssl_sess.c index 0b1c655820d..f9f6ee5ecbf 100644 --- a/lib/libssl/ssl_sess.c +++ b/lib/libssl/ssl_sess.c @@ -195,7 +195,7 @@ SSL_SESSION { 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); @@ -371,8 +371,8 @@ ssl_get_new_session(SSL *s, int session) #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; @@ -382,8 +382,8 @@ ssl_get_new_session(SSL *s, int session) } 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; @@ -719,30 +719,30 @@ SSL_SESSION_free(SSL_SESSION *ss) 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 @@ -768,7 +768,7 @@ SSL_set_session(SSL *s, SSL_SESSION *session) #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'; @@ -900,11 +900,11 @@ SSL_set_session_ticket_ext(SSL *s, void *ext_data, int ext_len) { 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; diff --git a/lib/libssl/t1_enc.c b/lib/libssl/t1_enc.c index 71d9f164b48..fb471b2f14f 100644 --- a/lib/libssl/t1_enc.c +++ b/lib/libssl/t1_enc.c @@ -367,7 +367,7 @@ tls1_change_cipher_state(SSL *s, int which) 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 */ @@ -387,7 +387,7 @@ tls1_change_cipher_state(SSL *s, int which) } 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; } @@ -592,7 +592,7 @@ tls1_setup_key_block(SSL *s) 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; } @@ -600,7 +600,7 @@ tls1_setup_key_block(SSL *s) 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; } @@ -642,7 +642,7 @@ tls1_setup_key_block(SSL *s) err: if (p2) { OPENSSL_cleanse(p2, num); - OPENSSL_free(p2); + free(p2); } return (ret); } @@ -1074,7 +1074,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, 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; @@ -1088,7 +1088,7 @@ tls1_export_keying_material(SSL *s, unsigned char *out, size_t olen, vallen += 2 + contextlen; } - val = OPENSSL_malloc(vallen); + val = malloc(vallen); if (val == NULL) goto err2; currentvalpos = 0; @@ -1145,9 +1145,9 @@ err2: rv = 0; ret: if (buff != NULL) - OPENSSL_free(buff); + free(buff); if (val != NULL) - OPENSSL_free(val); + free(val); return (rv); } diff --git a/lib/libssl/t1_lib.c b/lib/libssl/t1_lib.c index c3d62957ae3..7ecf7e06588 100644 --- a/lib/libssl/t1_lib.c +++ b/lib/libssl/t1_lib.c @@ -162,7 +162,7 @@ tls1_free(SSL *s) { #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); @@ -515,7 +515,7 @@ unsigned char 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, @@ -1037,14 +1037,14 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, *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; @@ -1081,7 +1081,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, *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'; @@ -1105,11 +1105,11 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, } 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; } @@ -1140,7 +1140,7 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, 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; } @@ -1172,9 +1172,9 @@ ssl_parse_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char *d, } 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) { @@ -1432,8 +1432,8 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, } 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; } @@ -1478,9 +1478,9 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, } 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); @@ -1522,7 +1522,7 @@ ssl_parse_serverhello_tlsext(SSL *s, unsigned char **p, unsigned char *d, int n, *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; @@ -1619,8 +1619,8 @@ ssl_prepare_clienthello_tlsext(SSL *s) 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; } @@ -1631,9 +1631,9 @@ ssl_prepare_clienthello_tlsext(SSL *s) /* 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; @@ -1660,10 +1660,10 @@ ssl_prepare_clienthello_tlsext(SSL *s) 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) { @@ -1698,8 +1698,8 @@ ssl_prepare_serverhello_tlsext(SSL *s) 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; } @@ -1752,7 +1752,7 @@ ssl_check_clienthello_tlsext_early(SSL *s) } 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) { @@ -1762,7 +1762,7 @@ ssl_check_clienthello_tlsext_early(SSL *s) * 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) { @@ -1937,7 +1937,7 @@ ssl_check_serverhello_tlsext(SSL *s) * 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; @@ -2156,7 +2156,7 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, /* 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; @@ -2169,7 +2169,7 @@ tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, 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 |