MCPcopy Create free account
hub / github.com/apache/qpid-proton / client_handshake_init

Function client_handshake_init

c/src/ssl/schannel.cpp:1072–1108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1070}
1071
1072static void client_handshake_init(pn_transport_t *transport)
1073{
1074 pni_ssl_t *ssl = transport->ssl;
1075 // Tell SChannel to create the first handshake token (ClientHello)
1076 // and place it in sc_outbuf
1077 SEC_CHAR *host = (SEC_CHAR *)(ssl->peer_hostname);
1078 ULONG ctxt_requested = ISC_REQ_STREAM | ISC_REQ_USE_SUPPLIED_CREDS | ISC_REQ_EXTENDED_ERROR;
1079 ULONG ctxt_attrs;
1080
1081 SecBuffer send_buffs[2];
1082 send_buffs[0].cbBuffer = ssl->sc_out_size;
1083 send_buffs[0].BufferType = SECBUFFER_TOKEN;
1084 send_buffs[0].pvBuffer = ssl->sc_outbuf;
1085 send_buffs[1].cbBuffer = 0;
1086 send_buffs[1].BufferType = SECBUFFER_EMPTY;
1087 send_buffs[1].pvBuffer = 0;
1088 SecBufferDesc send_buff_desc;
1089 send_buff_desc.ulVersion = SECBUFFER_VERSION;
1090 send_buff_desc.cBuffers = 2;
1091 send_buff_desc.pBuffers = send_buffs;
1092 csguard g(&ssl->cred->cslock);
1093 SECURITY_STATUS status = InitializeSecurityContext(&ssl->cred_handle,
1094 NULL, host, ctxt_requested, 0, 0, NULL, 0,
1095 &ssl->ctxt_handle, &send_buff_desc,
1096 &ctxt_attrs, NULL);
1097
1098 if (status == SEC_I_CONTINUE_NEEDED) {
1099 ssl->sc_out_count = send_buffs[0].cbBuffer;
1100 ssl->network_out_pending = ssl->sc_out_count;
1101 // the token is the whole quantity to send
1102 ssl->network_outp = ssl->sc_outbuf;
1103 ssl_log(transport, PN_LEVEL_TRACE, "Sending client hello %zu bytes", ssl->network_out_pending);
1104 } else {
1105 ssl_log_error_status(status, "InitializeSecurityContext failed");
1106 ssl_failed(transport, 0);
1107 }
1108}
1109
1110static void client_handshake( pn_transport_t* transport) {
1111 pni_ssl_t *ssl = transport->ssl;

Callers 1

process_output_sslFunction · 0.85

Calls 3

ssl_log_error_statusFunction · 0.85
ssl_logFunction · 0.70
ssl_failedFunction · 0.70

Tested by

no test coverage detected