Rename a number of BUF_* functions to OPENSSL_*. Upstream did this in 7644a9aef8932ed4d1c3f25ed776c997702982be, so align with them. Add the new OPENSSL_* names and switch all callers witihn the library to match. Keep the old BUF_* names around for compatibility. Note there were two functions where we already had an OPENSSL_* version: OPENSSL_strdup and OPENSSL_strnlen. The former now gains a NULL check to align with BUF_strdup. The latter gets deduplicated; we had two implementations. Change-Id: Ia1cd4527a752fcd62e142ed1e1d7768d323279ba Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/38425 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc index 703c2bc..a53a5e3 100644 --- a/ssl/ssl_lib.cc +++ b/ssl/ssl_lib.cc
@@ -699,7 +699,7 @@ if (ctx->psk_identity_hint) { ssl->config->psk_identity_hint.reset( - BUF_strdup(ctx->psk_identity_hint.get())); + OPENSSL_strdup(ctx->psk_identity_hint.get())); if (ssl->config->psk_identity_hint == nullptr) { return nullptr; } @@ -2129,7 +2129,7 @@ OPENSSL_PUT_ERROR(SSL, SSL_R_SSL3_EXT_INVALID_SERVERNAME); return 0; } - ssl->hostname.reset(BUF_strdup(name)); + ssl->hostname.reset(OPENSSL_strdup(name)); if (ssl->hostname == nullptr) { OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE); return 0; @@ -2580,7 +2580,7 @@ // ECDHE_PSK can only spell empty hint. Having different capabilities is odd, // so we interpret empty and missing as identical. if (identity_hint != NULL && identity_hint[0] != '\0') { - out->reset(BUF_strdup(identity_hint)); + out->reset(OPENSSL_strdup(identity_hint)); if (*out == nullptr) { return 0; }