diff options
author | Rich Salz <rsalz@akamai.com> | 2015-12-16 16:12:24 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-12-16 16:14:49 -0500 |
commit | 7644a9aef8932ed4d1c3f25ed776c997702982be (patch) | |
tree | d8f1e7fca20ad12683a1e2e52c92b6999ada23a6 /ssl | |
parent | e4cf866322a4549c55153f9f135f9dadf4d3fc31 (diff) | |
download | openssl-new-7644a9aef8932ed4d1c3f25ed776c997702982be.tar.gz |
Rename some BUF_xxx to OPENSSL_xxx
Rename BUF_{strdup,strlcat,strlcpy,memdup,strndup,strnlen}
to OPENSSL_{strdup,strlcat,strlcpy,memdup,strndup,strnlen}
Add #define's for the old names.
Add CRYPTO_{memdup,strndup}, called by OPENSSL_{memdup,strndup} macros.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/packet_locl.h | 5 | ||||
-rw-r--r-- | ssl/s3_lib.c | 6 | ||||
-rw-r--r-- | ssl/ssl_asn1.c | 4 | ||||
-rw-r--r-- | ssl/ssl_cert.c | 2 | ||||
-rw-r--r-- | ssl/ssl_conf.c | 4 | ||||
-rw-r--r-- | ssl/ssl_lib.c | 12 | ||||
-rw-r--r-- | ssl/ssl_sess.c | 16 | ||||
-rw-r--r-- | ssl/statem/statem_clnt.c | 8 | ||||
-rw-r--r-- | ssl/statem/statem_srvr.c | 4 | ||||
-rw-r--r-- | ssl/t1_ext.c | 2 | ||||
-rw-r--r-- | ssl/t1_lib.c | 2 | ||||
-rw-r--r-- | ssl/tls_srp.c | 2 |
12 files changed, 32 insertions, 35 deletions
diff --git a/ssl/packet_locl.h b/ssl/packet_locl.h index cb61a93ad3..c0ab8257b7 100644 --- a/ssl/packet_locl.h +++ b/ssl/packet_locl.h @@ -408,8 +408,7 @@ __owur static inline int PACKET_memdup(const PACKET *pkt, unsigned char **data, if (length == 0) return 1; - *data = BUF_memdup(pkt->curr, length); - + *data = OPENSSL_memdup(pkt->curr, length); if (*data == NULL) return 0; @@ -432,7 +431,7 @@ __owur static inline int PACKET_strndup(const PACKET *pkt, char **data) OPENSSL_free(*data); /* This will succeed on an empty packet, unless pkt->curr == NULL. */ - *data = BUF_strndup((const char*)pkt->curr, PACKET_remaining(pkt)); + *data = OPENSSL_strndup((const char*)pkt->curr, PACKET_remaining(pkt)); return (*data != NULL); } diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index a61ca625f7..54ba298394 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -3836,7 +3836,7 @@ void ssl3_clear(SSL *s) #ifndef OPENSSL_NO_SRP static char *srp_password_from_info_cb(SSL *s, void *arg) { - return BUF_strdup(s->srp_ctx.info); + return OPENSSL_strdup(s->srp_ctx.info); } #endif @@ -3940,7 +3940,7 @@ long ssl3_ctrl(SSL *s, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTRL, SSL_R_SSL3_EXT_INVALID_SERVERNAME); return 0; } - if ((s->tlsext_hostname = BUF_strdup((char *)parg)) == NULL) { + if ((s->tlsext_hostname = OPENSSL_strdup((char *)parg)) == NULL) { SSLerr(SSL_F_SSL3_CTRL, ERR_R_INTERNAL_ERROR); return 0; } @@ -4359,7 +4359,7 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTX_CTRL, SSL_R_INVALID_SRP_USERNAME); return 0; } - if ((ctx->srp_ctx.login = BUF_strdup((char *)parg)) == NULL) { + if ((ctx->srp_ctx.login = OPENSSL_strdup((char *)parg)) == NULL) { SSLerr(SSL_F_SSL3_CTX_CTRL, ERR_R_INTERNAL_ERROR); return 0; } diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c index 1d11b21765..69c4d12a90 100644 --- a/ssl/ssl_asn1.c +++ b/ssl/ssl_asn1.c @@ -255,7 +255,7 @@ int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) /* Utility functions for d2i_SSL_SESSION */ -/* BUF_strndup an OCTET STRING */ +/* OPENSSL_strndup an OCTET STRING */ static int ssl_session_strndup(char **pdst, ASN1_OCTET_STRING *src) { @@ -263,7 +263,7 @@ static int ssl_session_strndup(char **pdst, ASN1_OCTET_STRING *src) *pdst = NULL; if (src == NULL) return 1; - *pdst = BUF_strndup((char *)src->data, src->length); + *pdst = OPENSSL_strndup((char *)src->data, src->length); if (*pdst == NULL) return 0; return 1; diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 80dc409478..41e34ce1d8 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -315,7 +315,7 @@ CERT *ssl_cert_dup(CERT *cert) goto err; #ifndef OPENSSL_NO_PSK if (cert->psk_identity_hint) { - ret->psk_identity_hint = BUF_strdup(cert->psk_identity_hint); + ret->psk_identity_hint = OPENSSL_strdup(cert->psk_identity_hint); if (ret->psk_identity_hint == NULL) goto err; } diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c index ce52569ce9..21aa2652fc 100644 --- a/ssl/ssl_conf.c +++ b/ssl/ssl_conf.c @@ -368,7 +368,7 @@ static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value) if (rv > 0 && c && cctx->flags & SSL_CONF_FLAG_REQUIRE_PRIVATE) { char **pfilename = &cctx->cert_filename[c->key - c->pkeys]; OPENSSL_free(*pfilename); - *pfilename = BUF_strdup(value); + *pfilename = OPENSSL_strdup(value); if (!*pfilename) rv = 0; } @@ -812,7 +812,7 @@ int SSL_CONF_CTX_set1_prefix(SSL_CONF_CTX *cctx, const char *pre) { char *tmp = NULL; if (pre) { - tmp = BUF_strdup(pre); + tmp = OPENSSL_strdup(pre); if (tmp == NULL) return 0; } diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index e9da27e90a..909b23ef6f 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -344,8 +344,8 @@ SSL *SSL_new(SSL_CTX *ctx) # ifndef OPENSSL_NO_EC if (ctx->tlsext_ecpointformatlist) { s->tlsext_ecpointformatlist = - BUF_memdup(ctx->tlsext_ecpointformatlist, - ctx->tlsext_ecpointformatlist_length); + OPENSSL_memdup(ctx->tlsext_ecpointformatlist, + ctx->tlsext_ecpointformatlist_length); if (!s->tlsext_ecpointformatlist) goto err; s->tlsext_ecpointformatlist_length = @@ -353,8 +353,8 @@ SSL *SSL_new(SSL_CTX *ctx) } if (ctx->tlsext_ellipticcurvelist) { s->tlsext_ellipticcurvelist = - BUF_memdup(ctx->tlsext_ellipticcurvelist, - ctx->tlsext_ellipticcurvelist_length); + OPENSSL_memdup(ctx->tlsext_ellipticcurvelist, + ctx->tlsext_ellipticcurvelist_length); if (!s->tlsext_ellipticcurvelist) goto err; s->tlsext_ellipticcurvelist_length = @@ -3042,7 +3042,7 @@ int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *identity_hint) } OPENSSL_free(ctx->cert->psk_identity_hint); if (identity_hint != NULL) { - ctx->cert->psk_identity_hint = BUF_strdup(identity_hint); + ctx->cert->psk_identity_hint = OPENSSL_strdup(identity_hint); if (ctx->cert->psk_identity_hint == NULL) return 0; } else @@ -3061,7 +3061,7 @@ int SSL_use_psk_identity_hint(SSL *s, const char *identity_hint) } OPENSSL_free(s->cert->psk_identity_hint); if (identity_hint != NULL) { - s->cert->psk_identity_hint = BUF_strdup(identity_hint); + s->cert->psk_identity_hint = OPENSSL_strdup(identity_hint); if (s->cert->psk_identity_hint == NULL) return 0; } else diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index aff615e0e6..baf846deb7 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -249,13 +249,13 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) #ifndef OPENSSL_NO_PSK if (src->psk_identity_hint) { - dest->psk_identity_hint = BUF_strdup(src->psk_identity_hint); + dest->psk_identity_hint = OPENSSL_strdup(src->psk_identity_hint); if (dest->psk_identity_hint == NULL) { goto err; } } if (src->psk_identity) { - dest->psk_identity = BUF_strdup(src->psk_identity); + dest->psk_identity = OPENSSL_strdup(src->psk_identity); if (dest->psk_identity == NULL) { goto err; } @@ -274,7 +274,7 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) } if (src->tlsext_hostname) { - dest->tlsext_hostname = BUF_strdup(src->tlsext_hostname); + dest->tlsext_hostname = OPENSSL_strdup(src->tlsext_hostname); if (dest->tlsext_hostname == NULL) { goto err; } @@ -282,14 +282,14 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) #ifndef OPENSSL_NO_EC if (src->tlsext_ecpointformatlist) { dest->tlsext_ecpointformatlist = - BUF_memdup(src->tlsext_ecpointformatlist, + OPENSSL_memdup(src->tlsext_ecpointformatlist, src->tlsext_ecpointformatlist_length); if (dest->tlsext_ecpointformatlist == NULL) goto err; } if (src->tlsext_ellipticcurvelist) { dest->tlsext_ellipticcurvelist = - BUF_memdup(src->tlsext_ellipticcurvelist, + OPENSSL_memdup(src->tlsext_ellipticcurvelist, src->tlsext_ellipticcurvelist_length); if (dest->tlsext_ellipticcurvelist == NULL) goto err; @@ -297,7 +297,7 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) #endif if (ticket != 0) { - dest->tlsext_tick = BUF_memdup(src->tlsext_tick, src->tlsext_ticklen); + dest->tlsext_tick = OPENSSL_memdup(src->tlsext_tick, src->tlsext_ticklen); if(dest->tlsext_tick == NULL) goto err; } else { @@ -307,7 +307,7 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) #ifndef OPENSSL_NO_SRP if (src->srp_username) { - dest->srp_username = BUF_strdup(src->srp_username); + dest->srp_username = OPENSSL_strdup(src->srp_username); if (dest->srp_username == NULL) { goto err; } @@ -475,7 +475,7 @@ int ssl_get_new_session(SSL *s, int session) sess_id_done: if (s->tlsext_hostname) { - ss->tlsext_hostname = BUF_strdup(s->tlsext_hostname); + ss->tlsext_hostname = OPENSSL_strdup(s->tlsext_hostname); if (ss->tlsext_hostname == NULL) { SSLerr(SSL_F_SSL_GET_NEW_SESSION, ERR_R_INTERNAL_ERROR); SSL_SESSION_free(ss); diff --git a/ssl/statem/statem_clnt.c b/ssl/statem/statem_clnt.c index 2c2a5215cc..56f6eaf8c5 100644 --- a/ssl/statem/statem_clnt.c +++ b/ssl/statem/statem_clnt.c @@ -2289,9 +2289,8 @@ int tls_construct_client_key_exchange(SSL *s) SSL_R_PSK_IDENTITY_NOT_FOUND); goto psk_err; } - OPENSSL_free(s->s3->tmp.psk); - s->s3->tmp.psk = BUF_memdup(psk, psklen); + s->s3->tmp.psk = OPENSSL_memdup(psk, psklen); OPENSSL_cleanse(psk, psklen); if (s->s3->tmp.psk == NULL) { @@ -2300,7 +2299,6 @@ int tls_construct_client_key_exchange(SSL *s) } s->s3->tmp.psklen = psklen; - identitylen = strlen(identity); if (identitylen > PSK_MAX_IDENTITY_LEN) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, @@ -2308,7 +2306,7 @@ int tls_construct_client_key_exchange(SSL *s) goto psk_err; } OPENSSL_free(s->session->psk_identity); - s->session->psk_identity = BUF_strdup(identity); + s->session->psk_identity = OPENSSL_strdup(identity); if (s->session->psk_identity == NULL) { OPENSSL_cleanse(identity, sizeof(identity)); goto memerr; @@ -2658,7 +2656,7 @@ psk_err: goto err; } OPENSSL_free(s->session->srp_username); - s->session->srp_username = BUF_strdup(s->srp_ctx.login); + s->session->srp_username = OPENSSL_strdup(s->srp_ctx.login); if (s->session->srp_username == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c index f4c5e8c238..83e56eac31 100644 --- a/ssl/statem/statem_srvr.c +++ b/ssl/statem/statem_srvr.c @@ -2181,7 +2181,7 @@ MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt) } OPENSSL_free(s->s3->tmp.psk); - s->s3->tmp.psk = BUF_memdup(psk, psklen); + s->s3->tmp.psk = OPENSSL_memdup(psk, psklen); OPENSSL_cleanse(psk, psklen); if (s->s3->tmp.psk == NULL) { @@ -2534,7 +2534,7 @@ MSG_PROCESS_RETURN tls_process_client_key_exchange(SSL *s, PACKET *pkt) goto f_err; } OPENSSL_free(s->session->srp_username); - s->session->srp_username = BUF_strdup(s->srp_ctx.login); + s->session->srp_username = OPENSSL_strdup(s->srp_ctx.login); if (s->session->srp_username == NULL) { SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; diff --git a/ssl/t1_ext.c b/ssl/t1_ext.c index 396ad7e171..2ffe271d97 100644 --- a/ssl/t1_ext.c +++ b/ssl/t1_ext.c @@ -183,7 +183,7 @@ int custom_exts_copy(custom_ext_methods *dst, const custom_ext_methods *src) { if (src->meths_count) { dst->meths = - BUF_memdup(src->meths, + OPENSSL_memdup(src->meths, sizeof(custom_ext_method) * src->meths_count); if (dst->meths == NULL) return 0; diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 571a891843..efa04410f2 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -2577,7 +2577,7 @@ static int ssl_scan_serverhello_tlsext(SSL *s, PACKET *pkt, int *al) if (!s->hit && tlsext_servername == 1) { if (s->tlsext_hostname) { if (s->session->tlsext_hostname == NULL) { - s->session->tlsext_hostname = BUF_strdup(s->tlsext_hostname); + s->session->tlsext_hostname = OPENSSL_strdup(s->tlsext_hostname); if (!s->session->tlsext_hostname) { *al = SSL_AD_UNRECOGNIZED_NAME; return 0; diff --git a/ssl/tls_srp.c b/ssl/tls_srp.c index 64a3f23df7..e3763b0f67 100644 --- a/ssl/tls_srp.c +++ b/ssl/tls_srp.c @@ -179,7 +179,7 @@ int SSL_SRP_CTX_init(struct ssl_st *s) goto err; } if ((ctx->srp_ctx.login != NULL) && - ((s->srp_ctx.login = BUF_strdup(ctx->srp_ctx.login)) == NULL)) { + ((s->srp_ctx.login = OPENSSL_strdup(ctx->srp_ctx.login)) == NULL)) { SSLerr(SSL_F_SSL_SRP_CTX_INIT, ERR_R_INTERNAL_ERROR); goto err; } |