id
stringlengths
27
29
content
stringlengths
226
3.24k
codereview_new_cpp_data_5962
WriterProxy::WriterProxy( , locators_entry_(loc_alloc.max_unicast_locators, loc_alloc.max_multicast_locators) , is_datasharing_writer_(false) , received_at_least_one_heartbeat_(false) - , state_(StateCode::IDLE) { //Create Events ResourceEvent& event_manager = reader_->getRTPSParticipant()...
codereview_new_cpp_data_5963
TEST_F(XMLParserTests, regressions) std::unique_ptr<BaseNode> root; EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/12736.xml", root)); - EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/13418.xml", root)); - EXPECT_EQ(XMLP_ret::XML_ERROR, XMLParser::loadXML("regressions/...
codereview_new_cpp_data_5964
class BarType std::array<char, 256> message_; }; int process_id() { #if defined(__cplusplus_winrt) I'd add a brief comment here on why `SystemInfo.cpp` cannot be included here. class BarType std::array<char, 256> message_; }; +// NOTE: This function is duplicated from SystemInfo because it is no...
codereview_new_cpp_data_5965
TEST(DDSBasic, DeleteDisabledEntities) } /** - * This test checks a race condition on when calling DomainParticipantImpl::create_instance_handle() * from different threads simultaneously. This was resulting in a `free(): invalid pointer` crash * when deleting publishers created this way, as there was a clash i...
codereview_new_cpp_data_5966
TEST(RTPS, MultithreadedWriterCreation) writer_attr.flow_controller_name = flow_controller_name; eprosima::fastrtps::rtps::RTPSWriter* writer = eprosima::fastrtps::rtps::RTPSDomain::createRTPSWriter( rtps_participant, writer_attr, history, nullptr); - ...
codereview_new_cpp_data_5967
TEST_F(XMLParserTests, getXMLOwnershipStrengthQos) titleElement = xml_doc.RootElement(); EXPECT_EQ(XMLP_ret::XML_OK, XMLParserTest::propertiesPolicy_wrapper(titleElement, ownership_strength_policy, ident)); - EXPECT_EQ(ownership_strength_policy.value, 0); sprintf(xm...
codereview_new_cpp_data_5968
bool HelloWorldSubscriber::init( { rqos.durability().kind = TRANSIENT_LOCAL_DURABILITY_QOS; // mimic publisher behaviour. Assure the user see all samples are received rqos.history().kind = KEEP_ALL_HISTORY_QOS; } else If set with both reliability and durability, please add it...
codereview_new_cpp_data_5969
-// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. Being a new file the copyright should be the current year ```suggestion // Copyright 2022 Proyectos y...
codereview_new_cpp_data_5970
* */ #include <fastdds/rtps/common/Property.h> #include <fastdds/utils/QosConverters.hpp> -#include <string> namespace eprosima { namespace fastdds { In case that [eProsima's code style](https://github.com/eProsima/cpp-style#code-style-for-eprosima-open-source-c-projects) does not specify a rule, the [Goo...
codereview_new_cpp_data_5971
*/ #include <string> #include <fastdds/rtps/common/Property.h> #include <fastdds/utils/QosConverters.hpp> A blank line should separate the C++ standard headers from the project's ones. Sorry for the inconvenience :grimacing: */ #include <string> + #include <fastdds/rtps/common/Property.h> #include ...
codereview_new_cpp_data_5972
fastrtps::TopicAttributes DataReaderImpl::topic_attributes() const DataReaderListener* DataReaderImpl::get_listener_for( const StatusMask& status) { - std::lock_guard<std::mutex> _(listener_mutex_); - - if (listener_ != nullptr && - user_datareader_->get_status_mask().is_active(status)) ...
codereview_new_cpp_data_5973
ReceiverResource::ReceiverResource( rValueResource.mValid = false; max_message_size_ = rValueResource.max_message_size_; active_callbacks_ = rValueResource.active_callbacks_; } bool ReceiverResource::SupportsLocator( Should we set `rValueResource.active_callbacks_` to 0 ? ReceiverResource::Receiv...
codereview_new_cpp_data_5974
void RTPSParticipantImpl::enable() void RTPSParticipantImpl::disable() { - // Disabling even thread disables participant announcement mp_event_thr.stop_thread(); // Disable Retries on Transports ```suggestion // Disabling event thread disables participant announcement ``` void RTPSParticipa...
codereview_new_cpp_data_5975
DataReaderImpl::~DataReaderImpl() bool DataReaderImpl::can_be_deleted() const { - { - std::lock_guard<std::recursive_mutex> _(get_conditions_mutex()); - if (!read_conditions_.empty()) - { - logWarning(DATA_READER, "DataReader " << guid() << " has ReadConditions not yet deleted"...
codereview_new_cpp_data_5976
ReturnCode_t DataReaderImpl::get_first_untaken_info( uint64_t DataReaderImpl::get_unread_count( bool mark_as_read) { - bool ret_val = reader_ ? history_.get_unread_count(mark_as_read) : 0; if (mark_as_read) { try_notify_read_conditions(); ```suggestion uint64_t ret_val = reader_ ...
codereview_new_cpp_data_5977
void DataReaderHistory::check_and_remove_instance( instance->alive_writers.empty() && instance_info->first.isDefined()) { - if ((InstanceStateKind::ALIVE_INSTANCE_STATE != instance_info->second->instance_state) && - instance_info->first.isDefined()) - { - ...
codereview_new_cpp_data_5978
void DataReaderHistory::check_and_remove_instance( instance->alive_writers.empty() && instance_info->first.isDefined()) { - if ((InstanceStateKind::ALIVE_INSTANCE_STATE != instance_info->second->instance_state) && - instance_info->first.isDefined()) - { - ...
codereview_new_cpp_data_5979
bool StatefulReader::processDataMsg( if (!change_pool_->reserve_cache(change_to_add)) { logWarning(RTPS_MSG_IN, - IDSTRING "Reached the specified maximum number samples allowed by this DataReader QoS. Rejecting change for reader: " << ...
codereview_new_cpp_data_5980
bool StatelessReader::processDataMsg( if (!change_pool_->reserve_cache(change_to_add)) { logWarning(RTPS_MSG_IN, - IDSTRING "Reached the specified maximum number samples allowed by this DataReader QoS. Rejecting change for reader: " << ...
codereview_new_cpp_data_5981
TEST(DataWriterTests, InstancePolicyAllocationConsistency) DataWriter* data_writer1 = publisher->create_datawriter(topic, qos); ASSERT_EQ(data_writer1, nullptr); // Next QoS config checks that if user sets max_samples < ( max_instances * max_samples_per_instance ) , // create_datareader() should ...
codereview_new_cpp_data_5982
TEST(TopicTests, InstancePolicyAllocationConsistency) Topic* topic1 = participant->create_topic("footopic1", type.get_type_name(), qos); ASSERT_EQ(topic1, nullptr); // Next QoS config checks that if user sets max_samples < ( max_instances * max_samples_per_instance ) , // create_datareader() shou...
codereview_new_cpp_data_5983
ReturnCode_t DataWriterImpl::check_qos_including_resource_limits( const DataWriterQos& qos, const TypeSupport& type) { - ReturnCode_t check_qos_return; - check_qos_return = check_qos(qos); - if (!check_qos_return) { - return check_qos_return; } - if (type->m_isGetKeyDefi...
codereview_new_cpp_data_5984
bool DiscoveryDataBase::server_acked_by_my_servers() // Find the server's participant and check whether all its servers have ACKed the server's DATA(p) auto this_server = participants_.find(server_guid_prefix_); - // check is always there assert(this_server != participants_.end()); for (auto...
codereview_new_cpp_data_5985
void PDPServer::announceParticipantState( return; } } - - } else { We can remove these empty lines. void PDPServer::announceParticipantState( return; } } } else ...
codereview_new_cpp_data_5986
int main( if (participant != nullptr) { - if (subscriber != nullptr) { - if (reader != nullptr) - { - subscriber->delete_datareader(reader); - } - - participant->delete_subscriber(subscriber); - } - - if (topic != null...
codereview_new_cpp_data_5987
void PDPServer::announceParticipantState( std::vector<GUID_t> remote_readers; LocatorList locators; { - std::vector<GuidPrefix_t> direct_clients_and_servers = discovery_db_.direct_clients_and_servers(); - for (GuidPrefix_t participant_prefix: direct_clients_and_server...
codereview_new_cpp_data_5988
bool DiscoveryDataBase::server_acked_by_my_servers() // Find the server's participant and check whether all its servers have ACKed the server's DATA(p) auto this_server = participants_.find(server_guid_prefix_); - if (this_server == participants_.end()) - { - return false; - } for (a...
codereview_new_cpp_data_5989
void set_and_check_with_environment_file( assert(res); std::smatch::iterator it = mr.cbegin(); - // Check whether the address is IPv4 auto address = (++it)->str(); - assert(fastrtps::rtps::IPLocator::isIPv4(address)); fastrtps::rtps::IPLocator::setIPv4(locator, addre...
codereview_new_cpp_data_5990
ReturnCode_t DomainParticipantImpl::delete_topic( assert(it != topics_.end() && "Topic found by handle but factory not found"); TopicProxy* proxy = dynamic_cast<TopicProxy*>(topic->get_impl()); auto ret_code = it->second->delete_topic(proxy); if (ReturnCode_t::RETCODE_OK == ret_co...
codereview_new_cpp_data_6114
void GetDeviceType(const std::unordered_map<std::string, std::string>& params, s *device_type = "gpu"; } else if (value == std::string("cuda")) { *device_type = "cuda"; - } else if (value == std::string("cuda_exp")) { - Log::Warning( - "Found device_type='cuda_exp' passed through para...
codereview_new_cpp_data_6115
TreeLearner* TreeLearner::CreateTreeLearner(const std::string& learner_type, con if (config->num_gpu == 1) { return new CUDASingleGPUTreeLearner(config, boosting_on_cuda); } else { - Log::Fatal("cuda only supports training on a single GPU."); } } else { - Log::Fatal("cuda...
codereview_new_cpp_data_6130
void Metadata::SetInitScore(const double* init_score, data_size_t len) { void Metadata::InsertInitScores(const double* init_scores, data_size_t start_index, data_size_t len, data_size_t source_size) { if (num_init_score_ <= 0) { - Log::Fatal("Inserting intiial score data into dataset with no initial scores");...
codereview_new_cpp_data_6131
void Metadata::Init(data_size_t num_data, int32_t has_weights, int32_t has_init_ num_data_ = num_data; label_ = std::vector<label_t>(num_data_); if (has_weights) { - weights_ = std::vector<label_t>(num_data_, 0.0f); num_weights_ = num_data_; weight_load_from_file_ = false; } if (has_init_sc...
codereview_new_cpp_data_6233
auto PythonServer::FillListPlayers(std::vector<PlayerSetupData>& players) const const py::extract<py::list> py_players(r); if (py_players.check()) { py::stl_input_iterator<PlayerSetupData> players_begin(py_players), players_end; - players.reserve(std::distance(players_begin, players_end)); ...
codereview_new_cpp_data_6238
namespace { for (MeterType meter = MeterType(0); meter <= MeterType::METER_SPEED; // the meter(s) after MeterType::METER_SPEED are part-specific meter = MeterType(int(meter) + 1)) { - col_types[{std::string{to_string(meter)}, UserStringNop("METERS_S...
codereview_new_cpp_data_6239
namespace parse { std::string MeterToNameWrapper(MeterType meter) { - return std::string().append(ValueRef::MeterToName(meter)); } BOOST_PHOENIX_ADAPT_FUNCTION(std::string, MeterToName_, MeterToNameWrapper, 1) ```suggestion std::string MeterToNameWrapper(MeterType meter) { return ...
codereview_new_cpp_data_6240
#include "../util/i18n.h" namespace ValueRef { - const std::string_view MeterToName(const MeterType meter); } UniverseObject::UniverseObject(UniverseObjectType type, std::string name, ```suggestion std::string_view MeterToName(const MeterType meter); ``` #include "../util/i18n.h" namespace Valu...
codereview_new_cpp_data_6241
void ShipDesign::BuildStatCaches() { { m_num_part_classes[part_class]++; } } - // ensure tags are unique std::sort(tags.begin(), tags.end()); auto last = std::unique(tags.begin(), tags.end()); - tags.erase(last, tags.end()); // compile concatenated tags into contiguous storage ...
codereview_new_cpp_data_6244
namespace { return 0; } - if (!empire->ProducibleItem(BuildType::BT_BUILDING, item_name, location_id)) { - ErrorLogger() << "IssueEnqueueBuildingProductionOrder : specified item_name and location_id that don't indicate an item that can be built at that location"; - ...
codereview_new_cpp_data_6257
static S2N_RESULT s2n_generate_client_session_id(struct s2n_connection *conn) /* Only generate the session id for TLS1.3 if in middlebox compatibility mode * - * actual_protocol_version is used here so the session id is generated if TLS1.3 - * was not negotiated, even if the client supports it */ ...
codereview_new_cpp_data_6258
static S2N_RESULT s2n_generate_client_session_id(struct s2n_connection *conn) /* Only generate the session id for TLS1.3 if in middlebox compatibility mode * - * actual_protocol_version is used here so the session id is generated if TLS1.3 - * was not negotiated, even if the client supports it */ ...
codereview_new_cpp_data_6259
int main(int argc, char **argv) EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT)); struct s2n_stuffer *hello_stuffer = &conn->handshake.io; conn->actual_protocol_version = S2N_TLS12; EXPECT_SUCCESS(s2n_client_hello_send(conn)); ...
codereview_new_cpp_data_6260
int main(int argc, char **argv) EXPECT_NOT_NULL(conn = s2n_connection_new(S2N_CLIENT)); struct s2n_stuffer *hello_stuffer = &conn->handshake.io; conn->actual_protocol_version = S2N_TLS12; EXPECT_SUCCESS(s2n_client_hello_send(conn)); ...
codereview_new_cpp_data_6262
static int s2n_parse_x509_extension(struct s2n_cert *cert, const uint8_t *oid, */ int len = ASN1_STRING_length(asn1_str); if (ext_value != NULL) { POSIX_ENSURE(*ext_value_len >= (uint32_t) len, S2N_ERR_INSUFFICIENT_MEM_SIZE); /* ASN1_STRING_data(...
codereview_new_cpp_data_6263
int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *co } /* Users can enable OCSP status requests via s2n_config_set_status_request_type. - * However, s2n_config_set_verification_ca_location can also enable OCSP status - * requests. To ensure backwards compatibility, this ...
codereview_new_cpp_data_6264
int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *co conn->multirecord_send = true; } - /* Users can enable OCSP status requests via s2n_config_set_status_request_type. - * To ensure backwards compatibility, s2n_config_set_verification_ca_location can - * also ena...
codereview_new_cpp_data_6265
int s2n_set_cipher_as_client(struct s2n_connection *conn, uint8_t wire[S2N_TLS_C static int s2n_wire_ciphers_contain(const uint8_t *match, const uint8_t *wire, uint32_t count, uint32_t cipher_suite_len) { - for (size_t i = 0; i < count; i++) { const uint8_t *theirs = wire + (i * cipher_suite_len) + (ci...
codereview_new_cpp_data_6266
S2N_RESULT s2n_early_data_record_bytes(struct s2n_connection *conn, ssize_t data if (data_len < 0 || !s2n_is_early_data_io(conn)) { return S2N_RESULT_OK; } /* Ensure the bytes read are within the bounds of what we can actually record. */ if ((size_t) data_len > (UINT64_MAX - conn->early_...
codereview_new_cpp_data_6267
S2N_RESULT s2n_protocol_preferences_set(struct s2n_blob *application_protocols, */ RESULT_GUARD_POSIX(s2n_realloc(&new_protocols, 0)); for (size_t i = 0; i < (size_t) protocol_count; i++) { const uint8_t *protocol = (const uint8_t *) protocols[i]; size_t length = strlen(protocols[i]...
codereview_new_cpp_data_6268
S2N_RESULT s2n_record_write(struct s2n_connection *conn, uint8_t content_type, s iov.iov_len = in->size; int written = s2n_record_writev(conn, content_type, &iov, 1, 0, in->size); RESULT_GUARD_POSIX(written); - RESULT_ENSURE(written == (int) in->size, S2N_ERR_FRAGMENT_LENGTH_TOO_LARGE); return S...
codereview_new_cpp_data_6269
int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, si POSIX_ENSURE_REF(session); const int len = s2n_connection_get_session_length(conn); const size_t size = len; - if (len == 0) { return 0; } - POSIX_ENSURE(size < max_length, S2N_ERR_SERIALIZED_SESSI...
codereview_new_cpp_data_6270
int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, si POSIX_ENSURE_REF(session); const int len = s2n_connection_get_session_length(conn); const size_t size = len; - if (len == 0) { return 0; } - POSIX_ENSURE(size < max_length, S2N_ERR_SERIALIZED_SESSI...
codereview_new_cpp_data_6271
static S2N_RESULT s2n_verify_host_information_common_name(struct s2n_connection *cn_found = true; char peer_cn[255] = { 0 }; - uint32_t len = ASN1_STRING_length(common_name); - - RESULT_ENSURE_GT(len, 0); RESULT_ENSURE_LTE(len, s2n_array_len(peer_cn) - 1); RESULT_CHECKED_MEMCPY(peer_cn, ASN...
codereview_new_cpp_data_6272
int s2n_set_cipher_as_client(struct s2n_connection *conn, uint8_t wire[S2N_TLS_C static int s2n_wire_ciphers_contain(const uint8_t *match, const uint8_t *wire, uint32_t count, uint32_t cipher_suite_len) { - for (size_t i = 0; i < (size_t) count; i++) { const uint8_t *theirs = wire + (i * cipher_suite_l...
codereview_new_cpp_data_6273
int s2n_connection_get_peer_cert_chain(const struct s2n_connection *conn, struct int cert_count = sk_X509_num(cert_chain_validated); - /* Check to ensure cert_count is non-negative before casting */ POSIX_ENSURE_GTE(cert_count, 0); for (size_t cert_idx = 0; cert_idx < (size_t) cert_count; cert_...
codereview_new_cpp_data_6274
S2N_RESULT s2n_protocol_preferences_set(struct s2n_blob *application_protocols, */ RESULT_GUARD_POSIX(s2n_realloc(&new_protocols, 0)); - /* Check to ensure protocol_count is non-negative */ RESULT_ENSURE_GTE(protocol_count, 0); for (size_t i = 0; i < (size_t) protocol_count; i++) { nit: Sa...
codereview_new_cpp_data_6275
S2N_RESULT s2n_protocol_preferences_set(struct s2n_blob *application_protocols, * s2n_realloc will just update the size field here */ RESULT_GUARD_POSIX(s2n_realloc(&new_protocols, 0)); - RESULT_ENSURE_GTE(protocol_count, 0); for (size_t i = 0; i < (size_t) protocol_count; i++) { nit ```...
codereview_new_cpp_data_6276
int main(int argc, char **argv) } uint16_t prime = 257; - for (uint32_t i = 0; i < (size_t) 0xFFFFFF - prime; i += prime) { EXPECT_SUCCESS(s2n_stuffer_write_network_order(&stuffer, i, byte_length)); EXPECT_SUCCESS(s2n_stuffer_read_uint24(&stuffer...
codereview_new_cpp_data_6277
int s2n_verify_cbc(struct s2n_connection *conn, struct s2n_hmac_state *hmac, str /* Check the maximum amount that could theoretically be padding */ uint32_t check = MIN(255, (payload_and_padding_size - 1)); uint32_t cutoff = check - padding_length; for (size_t i = 0, j = decrypted->size - 1 - che...
codereview_new_cpp_data_6278
int main(int argc, char **argv) EXPECT_BYTEARRAY_EQUAL(client_hello->extensions.raw.data, client_extensions, client_extensions_len); /* Verify s2n_client_hello_get_extensions_length correct */ - EXPECT_EQUAL(s2n_client_hello_get_extensions_length(client_hello), (ssize_t) client_extensions_le...
codereview_new_cpp_data_6279
int s2n_fd_set_non_blocking(int fd) static int buffer_read(void *io_context, uint8_t *buf, uint32_t len) { struct s2n_stuffer *in_buf; - uint32_t n_read, n_avail; if (buf == NULL) { return 0; Do we have concerns about masking internal errors here? It should never be the case that read_curso...
codereview_new_cpp_data_6280
int s2n_io_pair_shutdown_one_end(struct s2n_test_io_pair *io_pair, int mode_to_c void s2n_print_connection(struct s2n_connection *conn, const char *marker) { - size_t i; printf("marker: %s\n", marker); printf("HEADER IN Stuffer (write: %d, read: %d, size: %d)\n", conn->header_in.write_cursor, conn->...
codereview_new_cpp_data_6281
int s2n_verify_cbc(struct s2n_connection *conn, struct s2n_hmac_state *hmac, str /* Check the maximum amount that could theoretically be padding */ uint32_t check = MIN(255, (payload_and_padding_size - 1)); - /*Check to ensure check >= padding_length*/ POSIX_ENSURE_GTE(check, padding_length); ...
codereview_new_cpp_data_6282
static int s2n_cbc_cipher_3des_encrypt(struct s2n_session_key *key, struct s2n_b /* len is set by EVP_EncryptUpdate and checked post operation */ int len = 0; POSIX_GUARD_OSSL(EVP_EncryptUpdate(key->evp_cipher_ctx, out->data, &len, in->data, in->size), S2N_ERR_ENCRYPT); - S2N_ERROR_IF(len != (int) in...
codereview_new_cpp_data_6283
static int s2n_cbc_cipher_aes_encrypt(struct s2n_session_key *key, struct s2n_bl /* len is set by EVP_EncryptUpdate and checked post operation */ int len = 0; POSIX_GUARD_OSSL(EVP_EncryptUpdate(key->evp_cipher_ctx, out->data, &len, in->data, in->size), S2N_ERR_ENCRYPT); - S2N_ERROR_IF(len != (int) in...
codereview_new_cpp_data_6284
static int s2n_parse_x509_extension(struct s2n_cert *cert, const uint8_t *oid, /* ASN1_STRING_length() returns the length of the content of `asn1_str`. * Ref: https://www.openssl.org/docs/man1.1.0/man3/ASN1_STRING_length.html. */ - uint32_t len = ASN1_STRING_length(asn...
codereview_new_cpp_data_6285
static int s2n_rsa_encrypt(const struct s2n_pkey *pub, struct s2n_blob *in, stru /* Safety: RSA_public_encrypt does not mutate the key */ int r = RSA_public_encrypt(in->size, (unsigned char *) in->data, (unsigned char *) out->data, s2n_unsafe_rsa_get_non_const(pub_key), RSA_PKCS1_PADDING); - ...
codereview_new_cpp_data_6286
static int s2n_parse_x509_extension(struct s2n_cert *cert, const uint8_t *oid, * X509_get_ext_count returns the number of extensions in the x509 certificate. * Ref: https://www.openssl.org/docs/man1.1.0/man3/X509_get_ext_count.html. */ - size_t ext_count = X509_get_ext_count(x509_cert); - POSI...
codereview_new_cpp_data_6287
/* The valid_public_key in the corpus directory was generated by taking the first public * key (count = 0) from kyber_r3.kat and prepending KYBER_512_R3_PUBLIC_KEY_BYTES as two * hex-encoded bytes. This is how we would expect it to appear on the wire. */ -static struct s2n_kem_params kem_params = { .kem = &s2n_ky...
codereview_new_cpp_data_6288
* A valid ciphertext to provide to s2n_kem_recv_ciphertext (as it would have appeared on * the wire) was generated by taking the corresponding KAT ciphertext (count = 0) and * prepending KYBER_512_R3_CIPHERTEXT_BYTES as two hex-encoded bytes. */ -static struct s2n_kem_params kem_params = { .kem = &s2n_kyber_512_...
codereview_new_cpp_data_6289
bool s2n_kem_preferences_includes_tls13_kem_group(const struct s2n_kem_preferenc return false; } -/* Whether the client should include the length prefix in the PQ TLS 1.3 KEM KeyShares that it sends. Earlier drafts of - * the PQ TLS 1.3 standard required length prefixing, and later drafts removed this length p...
codereview_new_cpp_data_6290
static int s2n_server_key_share_recv_pq_hybrid(struct s2n_connection *conn, uint POSIX_ENSURE(s2n_stuffer_data_available(extension) == actual_hybrid_share_size, S2N_ERR_BAD_KEY_SHARE); struct s2n_kem_params *client_kem_params = &conn->kex_params.client_kem_group_params.kem_params; - POSIX_GUARD(s2n_is_t...
codereview_new_cpp_data_6291
const struct s2n_kem_group *ALL_SUPPORTED_KEM_GROUPS[S2N_SUPPORTED_KEM_GROUPS_CO * The old format is used by draft 0 of the Hybrid PQ TLS 1.3 specification, and all revisions of the Hybrid PQ TLS 1.2 * draft specification. Only draft revisions 1-5 of the Hybrid PQ TLS 1.3 specification use the new format. */ -in...
codereview_new_cpp_data_6292
const struct s2n_kem_group *ALL_SUPPORTED_KEM_GROUPS[S2N_SUPPORTED_KEM_GROUPS_CO * The old format is used by draft 0 of the Hybrid PQ TLS 1.3 specification, and all revisions of the Hybrid PQ TLS 1.2 * draft specification. Only draft revisions 1-5 of the Hybrid PQ TLS 1.3 specification use the new format. */ -in...
codereview_new_cpp_data_6293
static int s2n_client_key_share_recv_pq_hybrid(struct s2n_connection *conn, stru bool is_hybrid_share_length_prefixed = 0; uint16_t actual_hybrid_share_size = key_share->blob.size; - POSIX_GUARD(s2n_is_tls13_hybrid_kem_length_prefixed(actual_hybrid_share_size, kem_group, &is_hybrid_share_length_prefixed...
codereview_new_cpp_data_6294
* A valid ciphertext to provide to s2n_kem_recv_ciphertext (as it would have appeared on * the wire) was generated by taking the corresponding KAT ciphertext (count = 0) and * prepending KYBER_512_R3_CIPHERTEXT_BYTES as two hex-encoded bytes. */ -static struct s2n_kem_params kyber_r3_draft0_params = { .kem = &s2...
codereview_new_cpp_data_6295
static int s2n_client_key_share_recv_pq_hybrid(struct s2n_connection *conn, stru } /* The length of the hybrid key share must be one of two possible lengths. Its internal values are either length - * prefixed, or they are not. If actual_hybrid_share_size is not one of these two lengths, then - * s2...
codereview_new_cpp_data_6296
static int s2n_client_key_share_recv_pq_hybrid(struct s2n_connection *conn, stru } /* The length of the hybrid key share must be one of two possible lengths. Its internal values are either length - * prefixed, or they are not. If actual_hybrid_share_size is not one of these two lengths, then - * s2...
codereview_new_cpp_data_6297
int s2n_config_set_ktls_mode(struct s2n_config *config, s2n_ktls_mode ktls_mode) config->ktls_send_requested = true; break; case S2N_KTLS_MODE_SEND: config->ktls_send_requested = true; break; case S2N_KTLS_MODE_RECV: config->ktls_recv_r...
codereview_new_cpp_data_6298
int s2n_config_set_ktls_mode(struct s2n_config *config, s2n_ktls_mode ktls_mode) config->ktls_send_requested = true; break; case S2N_KTLS_MODE_SEND: config->ktls_send_requested = true; break; case S2N_KTLS_MODE_RECV: config->ktls_recv_r...
codereview_new_cpp_data_6299
int main(int argc, char **argv) DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close); EXPECT_SUCCESS(s2n_io_pair_init_non_blocking(&io_pair)); EXPECT_SUCCESS(s2n_connection_set_io_pair(conn, &io_pair)); - EXPECT_TRUE(conn->managed_send_io); - EXPECT_TRUE(co...
codereview_new_cpp_data_6300
static S2N_RESULT s2n_verify_host_information_san(struct s2n_connection *conn, X int n = sk_GENERAL_NAME_num(names_list); RESULT_ENSURE(n > 0, S2N_ERR_CERT_UNTRUSTED); for (int i = 0; i < n; i++) { GENERAL_NAME *current_name = sk_GENERAL_NAME_value(names_list, i); /* return success...
codereview_new_cpp_data_6301
int s2n_fuzz_test(const uint8_t *buf, size_t len) POSIX_GUARD(s2n_connection_set_blinding(server_conn, S2N_SELF_SERVICE_BLINDING)); uint8_t test_data[] = "test psk identity"; - struct s2n_blob test_blob = { 0 }; POSIX_GUARD(s2n_blob_init(&test_blob, test_data, sizeof(test_data))); /* Ignor...
codereview_new_cpp_data_6302
int main(int argc, char *const *argv) GUARD_EXIT(renegotiate(conn, sockfd, reneg_ctx.wait), "Renegotiation failed"); } - wait_for_shutdown(conn, sockfd); GUARD_EXIT(s2n_connection_free(conn), "Error freeing connection"); Since `wait_for_event` can return an error, should th...
codereview_new_cpp_data_6303
int s2n_server_key_recv(struct s2n_connection *conn) struct s2n_blob signature = { 0 }; POSIX_GUARD(s2n_blob_init(&signature, s2n_stuffer_raw_read(in, signature_length), signature_length)); POSIX_ENSURE_REF(signature.data); POSIX_ENSURE_GT(signature_length, 0); If you're not altering this file...
codereview_new_cpp_data_6304
void usage() fprintf(stderr, " Display this message and quit.\n"); fprintf(stderr, " --buffered-send <buffer size>\n"); fprintf(stderr, " Set s2n_send to buffer up to <buffer size> bytes before sending records over the wire.\n"); - fprintf(stderr, " -X, --max-conns \n"); fprintf(stderr, ...
codereview_new_cpp_data_6305
void usage() fprintf(stderr, " --buffered-send <buffer size>\n"); fprintf(stderr, " Set s2n_send to buffer up to <buffer size> bytes before sending records over the wire.\n"); fprintf(stderr, " -X, --max-conns <max connections>\n"); - fprintf(stderr, " Sets the max number of connections s2nd ...
codereview_new_cpp_data_6306
S2N_RESULT s2n_handshake_transcript_update(struct s2n_connection *conn) { struct s2n_stuffer message = conn->handshake.io; RESULT_GUARD_POSIX(s2n_stuffer_reread(&message)); nit: probably should RESULT_ENSURE_REF(conn) S2N_RESULT s2n_handshake_transcript_update(struct s2n_connection *conn) { + ...
codereview_new_cpp_data_6307
const char *s2n_connection_get_handshake_type_name(struct s2n_connection *conn) S2N_RESULT s2n_handshake_message_send(struct s2n_connection *conn, uint8_t content_type, s2n_blocked_status *blocked) { struct s2n_stuffer *in = &conn->handshake.io; uint32_t size = s2n_stuffer_data_available(in); Nit: pro...
codereview_new_cpp_data_6308
int s2n_queue_writer_close_alert_warning(struct s2n_connection *conn) alert[1] = S2N_TLS_ALERT_CLOSE_NOTIFY; struct s2n_blob out = { 0 }; - s2n_blob_init(&out, alert, sizeof(alert)); /* If there is an alert pending or we've already sent a close_notify, do nothing */ if (s2n_stuffer_data_avai...
codereview_new_cpp_data_6309
static int s2n_queue_reader_alert(struct s2n_connection *conn, uint8_t level, ui alert[1] = error_code; struct s2n_blob out = { 0 }; - s2n_blob_init(&out, alert, sizeof(alert)); /* If there is an alert pending, do nothing */ if (s2n_stuffer_data_available(&conn->reader_alert_out)) { A guard...
codereview_new_cpp_data_6310
static int s2n_signature_scheme_valid_to_accept(struct s2n_connection *conn, con POSIX_ENSURE_LTE(conn->actual_protocol_version, scheme->maximum_protocol_version); } - if (conn->actual_protocol_version >= S2N_TLS13 - || conn->actual_protocol_version == S2N_UNKNOWN_PROTOCOL_VERSION) { ...
codereview_new_cpp_data_6311
static int s2n_signature_scheme_valid_to_accept(struct s2n_connection *conn, con if (conn->actual_protocol_version >= S2N_TLS13) { POSIX_ENSURE_NE(scheme->hash_alg, S2N_HASH_SHA1); POSIX_ENSURE_NE(scheme->sig_alg, S2N_SIGNATURE_RSA); - } - - if (conn->actual_protocol_version < S2N_TLS13) {...
codereview_new_cpp_data_6312
static int s2n_signature_scheme_valid_to_accept(struct s2n_connection *conn, con } POSIX_ENSURE_NE(conn->actual_protocol_version, S2N_UNKNOWN_PROTOCOL_VERSION); - if (conn->actual_protocol_version >= S2N_TLS13) { POSIX_ENSURE_NE(scheme->hash_alg, S2N_HASH_SHA1); POSIX_ENSURE_NE(schem...
codereview_new_cpp_data_6313
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2017[] = { &s2n_ecdhe_rsa_with_chacha20_poly1305_sha256, &s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384, &s2n_ecdhe_rsa_with_aes_256_cbc_sha384, &s2n_rsa_with_aes_128_gcm_sha256, &s2n_rsa_with_aes_256_gcm_sha384, - &s2n_rsa_with_aes_128_cb...
codereview_new_cpp_data_6314
struct s2n_cipher_suite *cipher_suites_cloudfront_tls_1_2_2017[] = { &s2n_ecdhe_rsa_with_chacha20_poly1305_sha256, &s2n_ecdhe_ecdsa_with_aes_256_cbc_sha384, &s2n_ecdhe_rsa_with_aes_256_cbc_sha384, - &s2n_ecdhe_rsa_with_aes_256_cbc_sha, &s2n_ecdhe_ecdsa_with_aes_256_cbc_sha, &s2n_rsa_with_ae...
codereview_new_cpp_data_6324
int main(int argc, char **argv) EXPECT_EQUAL(record_type, 0x16); /** test: padding without record type should fail *= https://tools.ietf.org/rfc/rfc8446#section-5.4 *= type=test *# If a receiving implementation does not Nit, but might help readability ```suggestion ...
codereview_new_cpp_data_6509
void P002_data_struct::setTwoPointCalibration( /***************************************************** - * plugin_write ****************************************************/ bool P002_data_struct::plugin_set_config(struct EventStruct *event, String & string) { Th...
codereview_new_cpp_data_6510
int16_t P025_data_struct::read() const { return (int16_t)readConversionRegister025(); } -uint8_t P025_data_struct::getMux() const -{ - return mux; -} - uint16_t P025_data_struct::readConversionRegister025() const { bool is_ok = false; const uint16_t wConversionRegister = I2C_read1...
codereview_new_cpp_data_6511
bool do_process_c009_delay_queue(int controller_number, const Queue_element_base jsonString += F("\"ESP\":{"); { // Create nested objects in "ESP": - jsonString += to_json_object_value(F("name"), Settings.getUnitname()); jsonString += ','; jsonString += to_js...