summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorbeck <>2014-04-17 13:37:50 +0000
committerbeck <>2014-04-17 13:37:50 +0000
commitbddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch)
tree7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libssl/ssl_lib.c
parentecec66222d758996a4ff2671ca5026d9ede5ef76 (diff)
downloadopenbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.gz
openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.bz2
openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.zip
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 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 6db3bd2993..589bd625bb 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -281,7 +281,7 @@ SSL
281 return (NULL); 281 return (NULL);
282 } 282 }
283 283
284 s = (SSL *)OPENSSL_malloc(sizeof(SSL)); 284 s = (SSL *)malloc(sizeof(SSL));
285 if (s == NULL) 285 if (s == NULL)
286 goto err; 286 goto err;
287 memset(s, 0, sizeof(SSL)); 287 memset(s, 0, sizeof(SSL));
@@ -380,7 +380,7 @@ err:
380 ssl_cert_free(s->cert); 380 ssl_cert_free(s->cert);
381 if (s->ctx != NULL) 381 if (s->ctx != NULL)
382 SSL_CTX_free(s->ctx); /* decrement reference count */ 382 SSL_CTX_free(s->ctx); /* decrement reference count */
383 OPENSSL_free(s); 383 free(s);
384 } 384 }
385 SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); 385 SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
386 return (NULL); 386 return (NULL);
@@ -558,24 +558,24 @@ SSL_free(SSL *s)
558 558
559#ifndef OPENSSL_NO_TLSEXT 559#ifndef OPENSSL_NO_TLSEXT
560 if (s->tlsext_hostname) 560 if (s->tlsext_hostname)
561 OPENSSL_free(s->tlsext_hostname); 561 free(s->tlsext_hostname);
562 if (s->initial_ctx) 562 if (s->initial_ctx)
563 SSL_CTX_free(s->initial_ctx); 563 SSL_CTX_free(s->initial_ctx);
564#ifndef OPENSSL_NO_EC 564#ifndef OPENSSL_NO_EC
565 if (s->tlsext_ecpointformatlist) 565 if (s->tlsext_ecpointformatlist)
566 OPENSSL_free(s->tlsext_ecpointformatlist); 566 free(s->tlsext_ecpointformatlist);
567 if (s->tlsext_ellipticcurvelist) 567 if (s->tlsext_ellipticcurvelist)
568 OPENSSL_free(s->tlsext_ellipticcurvelist); 568 free(s->tlsext_ellipticcurvelist);
569#endif /* OPENSSL_NO_EC */ 569#endif /* OPENSSL_NO_EC */
570 if (s->tlsext_opaque_prf_input) 570 if (s->tlsext_opaque_prf_input)
571 OPENSSL_free(s->tlsext_opaque_prf_input); 571 free(s->tlsext_opaque_prf_input);
572 if (s->tlsext_ocsp_exts) 572 if (s->tlsext_ocsp_exts)
573 sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts, 573 sk_X509_EXTENSION_pop_free(s->tlsext_ocsp_exts,
574 X509_EXTENSION_free); 574 X509_EXTENSION_free);
575 if (s->tlsext_ocsp_ids) 575 if (s->tlsext_ocsp_ids)
576 sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free); 576 sk_OCSP_RESPID_pop_free(s->tlsext_ocsp_ids, OCSP_RESPID_free);
577 if (s->tlsext_ocsp_resp) 577 if (s->tlsext_ocsp_resp)
578 OPENSSL_free(s->tlsext_ocsp_resp); 578 free(s->tlsext_ocsp_resp);
579#endif 579#endif
580 580
581 if (s->client_CA != NULL) 581 if (s->client_CA != NULL)
@@ -594,7 +594,7 @@ SSL_free(SSL *s)
594 594
595#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) 595#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
596 if (s->next_proto_negotiated) 596 if (s->next_proto_negotiated)
597 OPENSSL_free(s->next_proto_negotiated); 597 free(s->next_proto_negotiated);
598#endif 598#endif
599 599
600#ifndef OPENSSL_NO_SRTP 600#ifndef OPENSSL_NO_SRTP
@@ -602,7 +602,7 @@ SSL_free(SSL *s)
602 sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles); 602 sk_SRTP_PROTECTION_PROFILE_free(s->srtp_profiles);
603#endif 603#endif
604 604
605 OPENSSL_free(s); 605 free(s);
606} 606}
607 607
608void 608void
@@ -1703,7 +1703,7 @@ SSL_CTX
1703 SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); 1703 SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
1704 goto err; 1704 goto err;
1705 } 1705 }
1706 ret = (SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX)); 1706 ret = (SSL_CTX *)malloc(sizeof(SSL_CTX));
1707 if (ret == NULL) 1707 if (ret == NULL)
1708 goto err; 1708 goto err;
1709 1709
@@ -1862,7 +1862,7 @@ err2:
1862#if 0 1862#if 0
1863static void 1863static void
1864SSL_COMP_free(SSL_COMP *comp) 1864SSL_COMP_free(SSL_COMP *comp)
1865 { OPENSSL_free(comp); 1865 { free(comp);
1866} 1866}
1867#endif 1867#endif
1868 1868
@@ -1933,7 +1933,7 @@ SSL_CTX_free(SSL_CTX *a)
1933 1933
1934#ifndef OPENSSL_NO_PSK 1934#ifndef OPENSSL_NO_PSK
1935 if (a->psk_identity_hint) 1935 if (a->psk_identity_hint)
1936 OPENSSL_free(a->psk_identity_hint); 1936 free(a->psk_identity_hint);
1937#endif 1937#endif
1938#ifndef OPENSSL_NO_SRP 1938#ifndef OPENSSL_NO_SRP
1939 SSL_CTX_SRP_CTX_free(a); 1939 SSL_CTX_SRP_CTX_free(a);
@@ -1943,7 +1943,7 @@ SSL_CTX_free(SSL_CTX *a)
1943 ENGINE_finish(a->client_cert_engine); 1943 ENGINE_finish(a->client_cert_engine);
1944#endif 1944#endif
1945 1945
1946 OPENSSL_free(a); 1946 free(a);
1947} 1947}
1948 1948
1949void 1949void
@@ -2696,12 +2696,12 @@ ssl_clear_cipher_ctx(SSL *s)
2696{ 2696{
2697 if (s->enc_read_ctx != NULL) { 2697 if (s->enc_read_ctx != NULL) {
2698 EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); 2698 EVP_CIPHER_CTX_cleanup(s->enc_read_ctx);
2699 OPENSSL_free(s->enc_read_ctx); 2699 free(s->enc_read_ctx);
2700 s->enc_read_ctx = NULL; 2700 s->enc_read_ctx = NULL;
2701 } 2701 }
2702 if (s->enc_write_ctx != NULL) { 2702 if (s->enc_write_ctx != NULL) {
2703 EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); 2703 EVP_CIPHER_CTX_cleanup(s->enc_write_ctx);
2704 OPENSSL_free(s->enc_write_ctx); 2704 free(s->enc_write_ctx);
2705 s->enc_write_ctx = NULL; 2705 s->enc_write_ctx = NULL;
2706 } 2706 }
2707#ifndef OPENSSL_NO_COMP 2707#ifndef OPENSSL_NO_COMP
@@ -3095,7 +3095,7 @@ SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint)
3095 return 0; 3095 return 0;
3096 } 3096 }
3097 if (ctx->psk_identity_hint != NULL) 3097 if (ctx->psk_identity_hint != NULL)
3098 OPENSSL_free(ctx->psk_identity_hint); 3098 free(ctx->psk_identity_hint);
3099 if (identity_hint != NULL) { 3099 if (identity_hint != NULL) {
3100 ctx->psk_identity_hint = BUF_strdup(identity_hint); 3100 ctx->psk_identity_hint = BUF_strdup(identity_hint);
3101 if (ctx->psk_identity_hint == NULL) 3101 if (ctx->psk_identity_hint == NULL)
@@ -3119,7 +3119,7 @@ SSL_use_psk_identity_hint(SSL *s, const char *identity_hint)
3119 return 0; 3119 return 0;
3120 } 3120 }
3121 if (s->session->psk_identity_hint != NULL) 3121 if (s->session->psk_identity_hint != NULL)
3122 OPENSSL_free(s->session->psk_identity_hint); 3122 free(s->session->psk_identity_hint);
3123 if (identity_hint != NULL) { 3123 if (identity_hint != NULL) {
3124 s->session->psk_identity_hint = BUF_strdup(identity_hint); 3124 s->session->psk_identity_hint = BUF_strdup(identity_hint);
3125 if (s->session->psk_identity_hint == NULL) 3125 if (s->session->psk_identity_hint == NULL)