STATIC CFDataRef my_CFDataCreateWithRandomBytes(CFIndex size) { CFMutableDataRef data; data = CFDataCreateMutable(NULL, size); CFDataSetLength(data, size); fill_with_random(CFDataGetMutableBytePtr(data), (int)size); return (data); }
PRIVATE_EXTERN void CGAPrepareSetForInterface(const char * name, struct in6_cga_prepare * cga_prep) { if (S_cga_enabled == FALSE) { return; } cga_prep->cga_security_level = 0; fill_with_random(cga_prep->cga_modifier.octets, sizeof(cga_prep->cga_modifier.octets)); return; }
/** * \fn test_libcoap_builder_option_800(void) * * \brief Build CoAP message - ACK - changed - proxy URI option, length 800 bytes * */ void test_libcoap_builder_option_800(void) { fill_with_random(option_800, sizeof(option_800)); coap_header.options_list_ptr->proxy_uri_len = sizeof(option_800); coap_header.options_list_ptr->proxy_uri_ptr = option_800; message_len = sn_coap_builder_calc_needed_packet_data_size(&coap_header); message_ptr = malloc(message_len); sn_coap_builder(message_ptr, &coap_header); TEST_ASSERT_EQUAL(sizeof(coap_message_option_800) + sizeof(option_800), message_len); TEST_ASSERT_EQUAL_INT8_ARRAY(coap_message_option_800, message_ptr, sizeof(coap_message_option_800)); free(message_ptr); message_ptr = 0; }