Move `crypto/bio/internal.h` into the `bssl` namespace. The CL, except for the `crypto/bio/internal.h` change and moving the `using` declaration to the right place in `crypto/bio/socket.cc` as the tool got confused by `OPENSSL_MSVC_PRAGMA` use, was generated entirely automatically using `util/move_symbol_into_namespace.pl`. Bug: 42220000 Change-Id: I2241c87d45c726259d1472d2e2061c1bee7ac59b Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/85708 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: Rudolf Polzer <rpolzer@google.com>
diff --git a/crypto/bio/connect.cc b/crypto/bio/connect.cc index 2ef74be..511a46f 100644 --- a/crypto/bio/connect.cc +++ b/crypto/bio/connect.cc
@@ -37,6 +37,8 @@ #include "internal.h" +using namespace bssl; + enum { BIO_CONN_S_BEFORE, BIO_CONN_S_BLOCKED_CONNECT,
diff --git a/crypto/bio/errno.cc b/crypto/bio/errno.cc index 6c0df07..6e31fac 100644 --- a/crypto/bio/errno.cc +++ b/crypto/bio/errno.cc
@@ -19,7 +19,9 @@ #include "internal.h" -int bio_errno_should_retry(int return_value) { +using namespace bssl; + +int bssl::bio_errno_should_retry(int return_value) { if (return_value != -1) { return 0; }
diff --git a/crypto/bio/fd.cc b/crypto/bio/fd.cc index bbbd8a1..4d707b5 100644 --- a/crypto/bio/fd.cc +++ b/crypto/bio/fd.cc
@@ -44,6 +44,8 @@ #define BORINGSSL_WRITE write #endif +using namespace bssl; + BIO *BIO_new_fd(int fd, int close_flag) { BIO *ret = BIO_new(BIO_s_fd()); if (ret == nullptr) {
diff --git a/crypto/bio/internal.h b/crypto/bio/internal.h index 3a0b961..29d2919 100644 --- a/crypto/bio/internal.h +++ b/crypto/bio/internal.h
@@ -35,10 +35,6 @@ #endif #endif // !OPENSSL_NO_SOCK -#if defined(__cplusplus) -extern "C" { -#endif - struct bio_method_st { int type; @@ -79,6 +75,8 @@ uint64_t num_read, num_write; }; +BSSL_NAMESPACE_BEGIN + #if !defined(OPENSSL_NO_SOCK) // bio_ip_and_port_to_socket_and_addr creates a socket and fills in |*out_addr| @@ -112,9 +110,7 @@ // and |errno| indicates that it's non-fatal. int bio_errno_should_retry(int return_value); +BSSL_NAMESPACE_END -#if defined(__cplusplus) -} // extern C -#endif #endif // OPENSSL_HEADER_CRYPTO_BIO_INTERNAL_H
diff --git a/crypto/bio/socket.cc b/crypto/bio/socket.cc index acf595a..7efc674 100644 --- a/crypto/bio/socket.cc +++ b/crypto/bio/socket.cc
@@ -29,10 +29,10 @@ #include "internal.h" +using namespace bssl; + #if !defined(OPENSSL_WINDOWS) -static int closesocket(int sock) { - return close(sock); -} +static int closesocket(int sock) { return close(sock); } #endif static int sock_free(BIO *bio) {
diff --git a/crypto/bio/socket_helper.cc b/crypto/bio/socket_helper.cc index 7d1e2a3..187d956 100644 --- a/crypto/bio/socket_helper.cc +++ b/crypto/bio/socket_helper.cc
@@ -38,11 +38,13 @@ #include "../internal.h" -int bio_ip_and_port_to_socket_and_addr(int *out_sock, - struct sockaddr_storage *out_addr, - socklen_t *out_addr_length, - const char *hostname, - const char *port_str) { +using namespace bssl; + +int bssl::bio_ip_and_port_to_socket_and_addr(int *out_sock, + struct sockaddr_storage *out_addr, + socklen_t *out_addr_length, + const char *hostname, + const char *port_str) { struct addrinfo hint, *result, *cur; int ret; @@ -88,7 +90,7 @@ return ret; } -int bio_socket_nbio(int sock, int on) { +int bssl::bio_socket_nbio(int sock, int on) { #if defined(OPENSSL_WINDOWS) u_long arg = on; @@ -107,9 +109,9 @@ #endif } -void bio_clear_socket_error(void) {} +void bssl::bio_clear_socket_error(void) {} -int bio_sock_error(int sock) { +int bssl::bio_sock_error(int sock) { int error; socklen_t error_size = sizeof(error); @@ -119,7 +121,7 @@ return error; } -int bio_socket_should_retry(int return_value) { +int bssl::bio_socket_should_retry(int return_value) { #if defined(OPENSSL_WINDOWS) return return_value == -1 && WSAGetLastError() == WSAEWOULDBLOCK; #else