Split "helpers" from SSL target to "crypto_random" and rename
since it contains helpers mostly related to cryptographically secure random numbers and strings. BUG=webrtc:339300437 Change-Id: I10db939534b25dc792ac1600a4721d1b84521880 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/352620 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Philipp Hancke <phancke@meta.com> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/main@{#42441}
This commit is contained in:
parent
4918ae25f8
commit
4158678b46
@ -184,11 +184,11 @@ rtc_library("candidate") {
|
||||
"../p2p:p2p_constants",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crc32",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:ip_address",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:network_constants",
|
||||
"../rtc_base:socket_address",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:stringutils",
|
||||
"../rtc_base/system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/base:core_headers",
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#include "absl/base/attributes.h"
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "rtc_base/crc32.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
@ -115,11 +115,11 @@ rtc_source_set("stun_types") {
|
||||
"../../rtc_base:byte_order",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:crc32",
|
||||
"../../rtc_base:crypto_random",
|
||||
"../../rtc_base:digest",
|
||||
"../../rtc_base:ip_address",
|
||||
"../../rtc_base:logging",
|
||||
"../../rtc_base:socket_address",
|
||||
"../../rtc_base:ssl",
|
||||
"../../system_wrappers:metrics",
|
||||
"//third_party/abseil-cpp/absl/strings:string_view",
|
||||
]
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include "rtc_base/byte_order.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crc32.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
#include "system_wrappers/include/metrics.h"
|
||||
|
||||
@ -866,10 +866,10 @@ if (!build_with_chromium) {
|
||||
"../p2p:libstunprober",
|
||||
"../p2p:rtc_p2p",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:network",
|
||||
"../rtc_base:socket_address",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:ssl_adapter",
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base:timeutils",
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "absl/flags/parse.h"
|
||||
#include "p2p/base/basic_packet_socket_factory.h"
|
||||
#include "p2p/stunprober/stun_prober.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/network.h"
|
||||
#include "rtc_base/physical_socket_server.h"
|
||||
|
||||
16
p2p/BUILD.gn
16
p2p/BUILD.gn
@ -116,6 +116,7 @@ rtc_library("rtc_p2p") {
|
||||
"../rtc_base:callback_list",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crc32",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:dscp",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:ip_address",
|
||||
@ -277,12 +278,12 @@ rtc_library("basic_port_allocator") {
|
||||
"../api/transport:field_trial_based_config",
|
||||
"../api/units:time_delta",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:network",
|
||||
"../rtc_base:network_constants",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:stringutils",
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base/experiments:field_trial_parser",
|
||||
@ -332,6 +333,7 @@ rtc_library("connection") {
|
||||
"../rtc_base:callback_list",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crc32",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:dscp",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:ip_address",
|
||||
@ -346,7 +348,6 @@ rtc_library("connection") {
|
||||
"../rtc_base:safe_minmax",
|
||||
"../rtc_base:socket",
|
||||
"../rtc_base:socket_address",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:stringutils",
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base:timeutils",
|
||||
@ -492,7 +493,7 @@ rtc_library("ice_credentials_iterator") {
|
||||
deps = [
|
||||
":p2p_constants",
|
||||
":transport_description",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:crypto_random",
|
||||
]
|
||||
}
|
||||
|
||||
@ -656,6 +657,7 @@ rtc_library("port") {
|
||||
"../rtc_base:byte_buffer",
|
||||
"../rtc_base:callback_list",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:dscp",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:ip_address",
|
||||
@ -666,7 +668,6 @@ rtc_library("port") {
|
||||
"../rtc_base:network",
|
||||
"../rtc_base:rate_tracker",
|
||||
"../rtc_base:socket_address",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:stringutils",
|
||||
"../rtc_base:timeutils",
|
||||
"../rtc_base:weak_ptr",
|
||||
@ -698,6 +699,7 @@ rtc_library("port_allocator") {
|
||||
"../api:sequence_checker",
|
||||
"../api/transport:enums",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:network",
|
||||
"../rtc_base:socket_address",
|
||||
"../rtc_base:ssl",
|
||||
@ -788,9 +790,9 @@ rtc_library("stun_port") {
|
||||
"../api/transport:stun_types",
|
||||
"../rtc_base:async_packet_socket",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:ip_address",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:stringutils",
|
||||
"../rtc_base/experiments:field_trial_parser",
|
||||
"../rtc_base/network:received_packet",
|
||||
@ -811,8 +813,8 @@ rtc_library("stun_request") {
|
||||
"../api/transport:stun_types",
|
||||
"../api/units:time_delta",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:stringutils",
|
||||
"../rtc_base:timeutils",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
@ -1149,6 +1151,7 @@ if (rtc_include_tests) {
|
||||
"../rtc_base:byte_buffer",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:copy_on_write_buffer",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:digest",
|
||||
"../rtc_base:dscp",
|
||||
"../rtc_base:gunit_helpers",
|
||||
@ -1210,6 +1213,7 @@ rtc_library("p2p_server_utils") {
|
||||
"../rtc_base:async_udp_socket",
|
||||
"../rtc_base:byte_buffer",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:digest",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:rtc_base_tests_utils",
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "rtc_base/byte_buffer.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/net_helper.h"
|
||||
#include "rtc_base/network.h"
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
#include "p2p/base/fake_ice_transport.h"
|
||||
#include "p2p/base/packet_transport_internal.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/dscp.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/network/received_packet.h"
|
||||
#include "rtc_base/rtc_certificate.h"
|
||||
#include "rtc_base/ssl_adapter.h"
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "p2p/base/ice_credentials_iterator.h"
|
||||
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
|
||||
@ -32,13 +32,13 @@
|
||||
#include "p2p/base/test_turn_server.h"
|
||||
#include "p2p/client/basic_port_allocator.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/dscp.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/fake_mdns_responder.h"
|
||||
#include "rtc_base/fake_network.h"
|
||||
#include "rtc_base/firewall_socket_server.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/internal/default_socket_server.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/mdns_responder_interface.h"
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "p2p/base/stun_request.h"
|
||||
#include "rtc_base/byte_buffer.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/mdns_responder_interface.h"
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "p2p/base/ice_credentials_iterator.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "p2p/base/port_interface.h"
|
||||
#include "p2p/base/transport_description.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/network.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/ssl_certificate.h"
|
||||
|
||||
@ -46,10 +46,10 @@
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/byte_buffer.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/dscp.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/nat_server.h"
|
||||
#include "rtc_base/nat_socket_factory.h"
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
#include "api/task_queue/pending_task_safety_flag.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/memory_stream.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "p2p/base/port_allocator.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/experiments/field_trial_parser.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/network/received_packet.h"
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#include "p2p/base/mock_dns_resolving_packet_socket_factory.h"
|
||||
#include "p2p/base/test_stun_server.h"
|
||||
#include "rtc_base/async_packet_socket.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/network/received_packet.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/ssl_adapter.h"
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "absl/memory/memory.h"
|
||||
#include "api/task_queue/pending_task_safety_flag.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/string_encode.h"
|
||||
#include "rtc_base/time_utils.h" // For TimeMillis
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#include "p2p/base/basic_packet_socket_factory.h"
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "p2p/base/transport_description.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/third_party/sigslot/sigslot.h"
|
||||
#include "rtc_base/thread.h"
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include "api/candidate.h"
|
||||
#include "p2p/base/p2p_constants.h"
|
||||
#include "p2p/base/transport_description.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "p2p/base/async_stun_tcp_socket.h"
|
||||
#include "rtc_base/byte_buffer.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
#include "rtc_base/socket_adapters.h"
|
||||
|
||||
@ -31,8 +31,8 @@
|
||||
#include "p2p/base/turn_port.h"
|
||||
#include "p2p/base/udp_port.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/experiments/field_trial_parser.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/network_constants.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
13
pc/BUILD.gn
13
pc/BUILD.gn
@ -317,6 +317,7 @@ rtc_source_set("jsep_transport_controller") {
|
||||
"../rtc_base:callback_list",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:copy_on_write_buffer",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
@ -810,12 +811,12 @@ rtc_library("connection_context") {
|
||||
"../p2p:basic_packet_socket_factory",
|
||||
"../p2p:rtc_p2p",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:network",
|
||||
"../rtc_base:rtc_certificate_generator",
|
||||
"../rtc_base:socket_factory",
|
||||
"../rtc_base:socket_server",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base:timeutils",
|
||||
"../rtc_base/memory:always_valid_pointer",
|
||||
@ -1024,6 +1025,7 @@ rtc_source_set("sdp_offer_answer") {
|
||||
"../p2p:transport_description_factory",
|
||||
"../p2p:transport_info",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
@ -1141,6 +1143,7 @@ rtc_source_set("peer_connection") {
|
||||
"../p2p:transport_info",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:copy_on_write_buffer",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:ip_address",
|
||||
"../rtc_base:logging",
|
||||
@ -1311,6 +1314,7 @@ rtc_source_set("webrtc_sdp") {
|
||||
"../p2p:transport_description",
|
||||
"../p2p:transport_info",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:ip_address",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
@ -1576,6 +1580,7 @@ rtc_library("rtp_transmission_manager") {
|
||||
"../api:sequence_checker",
|
||||
"../media:media_channel",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:ssl",
|
||||
@ -1827,10 +1832,10 @@ rtc_library("rtp_sender") {
|
||||
"../media:media_channel",
|
||||
"../media:media_engine",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:threading",
|
||||
"../rtc_base/synchronization:mutex",
|
||||
"../rtc_base/third_party/sigslot",
|
||||
@ -2045,6 +2050,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../rtc_base:byte_order",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:copy_on_write_buffer",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:logging",
|
||||
"../rtc_base:macromagic",
|
||||
@ -2129,6 +2135,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../p2p:port_interface",
|
||||
"../p2p:rtc_p2p",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:rtc_base_tests_utils",
|
||||
"../rtc_base:socket_address",
|
||||
@ -2379,6 +2386,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../rtc_base:byte_buffer",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:copy_on_write_buffer",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:digest",
|
||||
"../rtc_base:event_tracer",
|
||||
"../rtc_base:gunit_helpers",
|
||||
@ -2596,6 +2604,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"../p2p:port_interface",
|
||||
"../p2p:rtc_p2p",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:gunit_helpers",
|
||||
"../rtc_base:ip_address",
|
||||
"../rtc_base:logging",
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "media/base/media_engine.h"
|
||||
#include "media/sctp/sctp_transport_factory.h"
|
||||
#include "pc/media_factory.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/internal/default_socket_server.h"
|
||||
#include "rtc_base/socket_server.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
|
||||
@ -33,9 +33,9 @@
|
||||
#include "pc/test/integration_test_helpers.h"
|
||||
#include "pc/test/mock_peer_connection_observers.h"
|
||||
#include "rtc_base/copy_on_write_buffer.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/virtual_socket_server.h"
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "p2p/base/transport_info.h"
|
||||
#include "pc/session_description.h"
|
||||
#include "pc/webrtc_sdp.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/net_helper.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/string_encode.h"
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
#include "rtc_base/callback_list.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/copy_on_write_buffer.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/rtc_certificate.h"
|
||||
#include "rtc_base/ssl_certificate.h"
|
||||
#include "rtc_base/ssl_stream_adapter.h"
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/byte_order.h"
|
||||
#include "rtc_base/copy_on_write_buffer.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/net_helper.h"
|
||||
#include "rtc_base/network/received_packet.h"
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#include "pc/sctp_transport.h"
|
||||
#include "pc/simulcast_description.h"
|
||||
#include "pc/webrtc_session_description_factory.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/net_helper.h"
|
||||
|
||||
@ -77,12 +77,12 @@
|
||||
#include "pc/test/fake_periodic_video_source.h"
|
||||
#include "pc/test/integration_test_helpers.h"
|
||||
#include "pc/test/mock_peer_connection_observers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/fake_mdns_responder.h"
|
||||
#include "rtc_base/fake_network.h"
|
||||
#include "rtc_base/firewall_socket_server.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/ssl_certificate.h"
|
||||
|
||||
@ -51,10 +51,10 @@
|
||||
#include "pc/test/frame_generator_capturer_video_track_source.h"
|
||||
#include "pc/test/mock_peer_connection_observers.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/fake_network.h"
|
||||
#include "rtc_base/firewall_socket_server.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/socket_address.h"
|
||||
#include "rtc_base/socket_factory.h"
|
||||
#include "rtc_base/ssl_certificate.h"
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
#include "api/rtp_transceiver_interface.h"
|
||||
#include "api/scoped_refptr.h"
|
||||
#include "pc/test/integration_test_helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#include "media/base/media_engine.h"
|
||||
#include "pc/legacy_stats_collector_interface.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/trace_event.h"
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
#include "pc/legacy_stats_collector_interface.h"
|
||||
#include "pc/video_rtp_receiver.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
#include "pc/used_ids.h"
|
||||
#include "pc/webrtc_session_description_factory.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/operations_chain.h"
|
||||
#include "rtc_base/rtc_certificate.h"
|
||||
|
||||
@ -97,13 +97,13 @@
|
||||
#include "pc/test/mock_peer_connection_observers.h"
|
||||
#include "pc/video_track_source.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/fake_mdns_responder.h"
|
||||
#include "rtc_base/fake_network.h"
|
||||
#include "rtc_base/firewall_socket_server.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/mdns_responder_interface.h"
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
#include "pc/simulcast_sdp_serializer.h"
|
||||
#include "rtc_base/arraysize.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/ip_address.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/net_helper.h"
|
||||
|
||||
@ -1413,7 +1413,7 @@ rtc_library("unique_id_generator") {
|
||||
"unique_id_generator.h",
|
||||
]
|
||||
deps = [
|
||||
":ssl",
|
||||
":crypto_random",
|
||||
":stringutils",
|
||||
"../api:array_view",
|
||||
"../api:sequence_checker",
|
||||
@ -1503,10 +1503,31 @@ rtc_source_set("digest") {
|
||||
}
|
||||
}
|
||||
|
||||
rtc_library("crypto_random") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"crypto_random.cc",
|
||||
"crypto_random.h",
|
||||
]
|
||||
deps = [
|
||||
":checks",
|
||||
":logging",
|
||||
"synchronization:mutex",
|
||||
"system:rtc_export",
|
||||
"//third_party/abseil-cpp/absl/strings:string_view",
|
||||
]
|
||||
|
||||
# If we are building the SSL library ourselves, we know it's BoringSSL.
|
||||
if (rtc_build_ssl) {
|
||||
deps += [ "//third_party/boringssl" ]
|
||||
} else {
|
||||
configs += [ ":external_ssl_library" ]
|
||||
}
|
||||
}
|
||||
|
||||
rtc_library("ssl") {
|
||||
visibility = [ "*" ]
|
||||
sources = [
|
||||
"helpers.cc",
|
||||
"helpers.h",
|
||||
"openssl_key_pair.cc",
|
||||
"openssl_key_pair.h",
|
||||
@ -1527,6 +1548,7 @@ rtc_library("ssl") {
|
||||
":buffer",
|
||||
":checks",
|
||||
":copy_on_write_buffer",
|
||||
":crypto_random",
|
||||
":digest",
|
||||
":logging",
|
||||
":macromagic",
|
||||
@ -1938,6 +1960,7 @@ if (rtc_include_tests) {
|
||||
":checks",
|
||||
":copy_on_write_buffer",
|
||||
":criticalsection",
|
||||
":crypto_random",
|
||||
":divide_round",
|
||||
":event_tracer",
|
||||
":frequency_tracker",
|
||||
@ -2082,9 +2105,9 @@ if (rtc_include_tests) {
|
||||
|
||||
sources = [
|
||||
"crc32_unittest.cc",
|
||||
"crypto_random_unittest.cc",
|
||||
"data_rate_limiter_unittest.cc",
|
||||
"fake_clock_unittest.cc",
|
||||
"helpers_unittest.cc",
|
||||
"ip_address_unittest.cc",
|
||||
"memory_usage_unittest.cc",
|
||||
"message_digest_unittest.cc",
|
||||
@ -2107,6 +2130,7 @@ if (rtc_include_tests) {
|
||||
":buffer_queue",
|
||||
":checks",
|
||||
":crc32",
|
||||
":crypto_random",
|
||||
":data_rate_limiter",
|
||||
":digest",
|
||||
":gunit_helpers",
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
#include "rtc_base/openssl_digest.h"
|
||||
|
||||
@ -8,13 +8,14 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
88
rtc_base/crypto_random.h
Normal file
88
rtc_base/crypto_random.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef RTC_BASE_CRYPTO_RANDOM_H_
|
||||
#define RTC_BASE_CRYPTO_RANDOM_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Interface for RNG implementations.
|
||||
class RandomGenerator {
|
||||
public:
|
||||
virtual ~RandomGenerator() {}
|
||||
virtual bool Init(const void* seed, size_t len) = 0;
|
||||
virtual bool Generate(void* buf, size_t len) = 0;
|
||||
};
|
||||
|
||||
// Sets the default random generator as the source of randomness. The default
|
||||
// source uses the OpenSSL RNG and provides cryptographically secure randomness.
|
||||
void SetDefaultRandomGenerator();
|
||||
|
||||
// Set a custom random generator. Results produced by CreateRandomXyz
|
||||
// are cryptographically random iff the output of the supplied generator is
|
||||
// cryptographically random.
|
||||
void SetRandomGenerator(std::unique_ptr<RandomGenerator> generator);
|
||||
|
||||
// For testing, we can return predictable data.
|
||||
void SetRandomTestMode(bool test);
|
||||
|
||||
// Initializes the RNG, and seeds it with the specified entropy.
|
||||
bool InitRandom(int seed);
|
||||
bool InitRandom(const char* seed, size_t len);
|
||||
|
||||
// Generates a (cryptographically) random string of the given length.
|
||||
// We generate base64 values so that they will be printable.
|
||||
RTC_EXPORT std::string CreateRandomString(size_t length);
|
||||
|
||||
// Generates a (cryptographically) random string of the given length.
|
||||
// We generate base64 values so that they will be printable.
|
||||
// Return false if the random number generator failed.
|
||||
RTC_EXPORT bool CreateRandomString(size_t length, std::string* str);
|
||||
|
||||
// Generates a (cryptographically) random string of the given length,
|
||||
// with characters from the given table. Return false if the random
|
||||
// number generator failed.
|
||||
// For ease of implementation, the function requires that the table
|
||||
// size evenly divide 256; otherwise, it returns false.
|
||||
RTC_EXPORT bool CreateRandomString(size_t length,
|
||||
absl::string_view table,
|
||||
std::string* str);
|
||||
|
||||
// Generates (cryptographically) random data of the given length.
|
||||
// Return false if the random number generator failed.
|
||||
bool CreateRandomData(size_t length, std::string* data);
|
||||
|
||||
// Generates a (cryptographically) random UUID version 4 string.
|
||||
std::string CreateRandomUuid();
|
||||
|
||||
// Generates a random id.
|
||||
uint32_t CreateRandomId();
|
||||
|
||||
// Generates a 64 bit random id.
|
||||
RTC_EXPORT uint64_t CreateRandomId64();
|
||||
|
||||
// Generates a random id > 0.
|
||||
uint32_t CreateRandomNonZeroId();
|
||||
|
||||
// Generates a random double between 0.0 (inclusive) and 1.0 (exclusive).
|
||||
double CreateRandomDouble();
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // RTC_BASE_CRYPTO_RANDOM_H_
|
||||
@ -8,12 +8,13 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "test/gmock.h"
|
||||
@ -7,82 +7,4 @@
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef RTC_BASE_HELPERS_H_
|
||||
#define RTC_BASE_HELPERS_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/system/rtc_export.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Interface for RNG implementations.
|
||||
class RandomGenerator {
|
||||
public:
|
||||
virtual ~RandomGenerator() {}
|
||||
virtual bool Init(const void* seed, size_t len) = 0;
|
||||
virtual bool Generate(void* buf, size_t len) = 0;
|
||||
};
|
||||
|
||||
// Sets the default random generator as the source of randomness. The default
|
||||
// source uses the OpenSSL RNG and provides cryptographically secure randomness.
|
||||
void SetDefaultRandomGenerator();
|
||||
|
||||
// Set a custom random generator. Results produced by CreateRandomXyz
|
||||
// are cryptographically random iff the output of the supplied generator is
|
||||
// cryptographically random.
|
||||
void SetRandomGenerator(std::unique_ptr<RandomGenerator> generator);
|
||||
|
||||
// For testing, we can return predictable data.
|
||||
void SetRandomTestMode(bool test);
|
||||
|
||||
// Initializes the RNG, and seeds it with the specified entropy.
|
||||
bool InitRandom(int seed);
|
||||
bool InitRandom(const char* seed, size_t len);
|
||||
|
||||
// Generates a (cryptographically) random string of the given length.
|
||||
// We generate base64 values so that they will be printable.
|
||||
RTC_EXPORT std::string CreateRandomString(size_t length);
|
||||
|
||||
// Generates a (cryptographically) random string of the given length.
|
||||
// We generate base64 values so that they will be printable.
|
||||
// Return false if the random number generator failed.
|
||||
RTC_EXPORT bool CreateRandomString(size_t length, std::string* str);
|
||||
|
||||
// Generates a (cryptographically) random string of the given length,
|
||||
// with characters from the given table. Return false if the random
|
||||
// number generator failed.
|
||||
// For ease of implementation, the function requires that the table
|
||||
// size evenly divide 256; otherwise, it returns false.
|
||||
RTC_EXPORT bool CreateRandomString(size_t length,
|
||||
absl::string_view table,
|
||||
std::string* str);
|
||||
|
||||
// Generates (cryptographically) random data of the given length.
|
||||
// Return false if the random number generator failed.
|
||||
bool CreateRandomData(size_t length, std::string* data);
|
||||
|
||||
// Generates a (cryptographically) random UUID version 4 string.
|
||||
std::string CreateRandomUuid();
|
||||
|
||||
// Generates a random id.
|
||||
uint32_t CreateRandomId();
|
||||
|
||||
// Generates a 64 bit random id.
|
||||
RTC_EXPORT uint64_t CreateRandomId64();
|
||||
|
||||
// Generates a random id > 0.
|
||||
uint32_t CreateRandomNonZeroId();
|
||||
|
||||
// Generates a random double between 0.0 (inclusive) and 1.0 (exclusive).
|
||||
double CreateRandomDouble();
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // RTC_BASE_HELPERS_H_
|
||||
#include "rtc_base/crypto_random.h"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
#include "rtc_base/openssl_digest.h"
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
#include "absl/strings/str_replace.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/fake_ssl_identity.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
#include "rtc_base/ssl_fingerprint.h"
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
#include "rtc_base/buffer_queue.h"
|
||||
#include "rtc_base/callback_list.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/memory/fifo_buffer.h"
|
||||
#include "rtc_base/memory_stream.h"
|
||||
#include "rtc_base/message_digest.h"
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
#include <memory>
|
||||
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/event.h"
|
||||
#include "rtc_base/fake_clock.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/thread.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/string_encode.h"
|
||||
#include "rtc_base/string_to_number.h"
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
#include "api/array_view.h"
|
||||
#include "api/task_queue/task_queue_base.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "test/gmock.h"
|
||||
|
||||
using ::testing::IsEmpty;
|
||||
|
||||
@ -843,7 +843,7 @@ rtc_library("fileutils") {
|
||||
":fileutils_override_api",
|
||||
":fileutils_override_impl",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:crypto_random",
|
||||
"../rtc_base:stringutils",
|
||||
"//third_party/abseil-cpp/absl/base:core_headers",
|
||||
"//third_party/abseil-cpp/absl/strings:string_view",
|
||||
@ -929,7 +929,7 @@ rtc_library("fileutils_unittests") {
|
||||
":fileutils",
|
||||
":test_support",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:ssl",
|
||||
"../rtc_base:crypto_random",
|
||||
"//third_party/abseil-cpp/absl/strings:string_view",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "rtc_base/string_utils.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/testsupport/file_utils_override.h"
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/crypto_random.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user