TLS-PSK isn't working with sec_protocol_options_add_pre_shared_key in iOS 13

dispatch_data_t psk = dispatch_data_create("test", sizeof("test"), nil, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
dispatch_data_t client_id = dispatch_data_create("test", 4, nil, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
sec_protocol_options_add_pre_shared_key(sec_options, psk, client_id);

Am I doing something wrong? the PSK identity is passed because I can see that in the packets in wireshark, is the PSK expecting a hex value or an ASCII value? both seem to fail for me when running:

openssl3 s_server -tls1_2 -accept 8888 -4 -nocert -psk 74657374 -psk_identity=test -no_etm -no_dhe -serverpref -bugs -cipher PSK-AES256-GCM-SHA384 -state -msg -debug (not that 74657374 is the hex equivilant of 'test' as OpenSSL requires the PSK in hex)

Note that I will attempt to address this item on the TSI mentioned from your other thread. If you have not asked this question on your TSI, please ask it there as well.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
TLS-PSK isn't working with sec_protocol_options_add_pre_shared_key in iOS 13
 
 
Q