Hi All,
We built openssl code by enabling debug options and found that in TLS_ST_SR_CERT_VRFY state openssl checks for the following conditions
1) If the datagram type is SCTP : : In this case it is DTLS and set to 1.
2) Value of s->renegotiate : : in this case the value was set to 2. I guess this is set in post processing function of client hello.
3) If any sctp message is waiting to be received : : In this case this was true (1). When we debug inside the BIO_dgram_sctp_msg_waiting. We observed that the recvmsg system call returning the size (n = 14 bytes) that is exactly size of the next package (Auth Change Cipher Spec) as shown in the below screenshot.
So this function return "WORK_MORE_A" to the caller "read_state_machine" which intern returns SUB_STATE_ERROR. And this flow keeps repeating.
And also we observed that this issue is something to do with the timing of the messages received at SCTP layer. If the post processing message function executed before the next message arrives at SCTP layer, then the SSL negotiation is successful else SSL negotiation hangs at TLS_ST_SR_CERT_VEFY state.
Can someone who is familiar with the openssl code give us some insights about what is the logic behind the if check in TLS_ST_SR_CERT_VRFY state in post processing function ?
On Mon, Apr 17, 2017 at 4:14 PM, mahesh gs <mahesh116@xxxxxxxxx> wrote:
Hi All,Adding to this, When we changed the path MTU of the source and destination VM's we could see the SSL connection is successful and application data getting exchanged which confirms that there is issue in segmentation and reassembly of packets.Do we have some system configuration that need to be enabled for DTLS ? as i mentioned in my previous mails, TLS negotiation is successful without changing path MTU but not DTLS.Thanks,Mahesh G SOn Mon, Apr 17, 2017 at 12:36 PM, mahesh gs <mahesh116@xxxxxxxxx> wrote:Hi All,Sorry for delayed response, thank you all for responding to my query.1) We are using non-blocking sockets on RHEL 7.0 machine with the kernel version 3.10.2) When we run client and server in the same machine it works fine. Client and server able to exchange the data without any issues. But if we run client and server in different machines, we face this problem.Server side logs when we run the server and client in same machineClient side log when we run the server and client in the same machine.3) as suggested by Matt i disable the client auth when client-server run in different machines and surprisingly the TLS negotiation is successful. That leads me to suspect on segmentation and reassembly.Server side logs when the client auth is disabledClient side logs when the client auth is disabled.I took a wireshark trace and found that the server is able to receive the client certificate in 3 fragments and responding with the proper sack with right TSN. But server do not respond with its own certificate after that. I have attached the wireshark trace for the same. Path MTU in both the systems set to 1500.I took the strace of the calls between server and client but i could not figure out anything with the strace. I have attached the same in the mail. strace summary table is as below.^C% time seconds usecs/call calls errors syscall------ ----------- ----------- --------- --------- ----------------33.71 0.000326 3 99 76 open18.10 0.000175 3 54 mmap15.10 0.000146 4 37 mprotect9.72 0.000094 13 7 recvmsg5.07 0.000049 2 26 read4.03 0.000039 2 24 close3.93 0.000038 2 17 fstat3.83 0.000037 19 2 sendto1.24 0.000012 3 4 3 stat0.93 0.000009 2 5 brk0.62 0.000006 6 1 munmap0.52 0.000005 3 2 futex0.41 0.000004 1 3 rt_sigaction0.41 0.000004 4 1 1 access0.41 0.000004 1 3 socket0.41 0.000004 4 1 execve0.31 0.000003 3 1 set_tid_address0.21 0.000002 1 3 rt_sigprocmask0.21 0.000002 1 2 bind0.21 0.000002 1 3 getsockname0.21 0.000002 2 1 getrlimit0.21 0.000002 2 1 arch_prctl0.21 0.000002 2 1 set_robust_list0.00 0.000000 0 25 write0.00 0.000000 0 1 ioctl0.00 0.000000 0 1 listen0.00 0.000000 0 6 clone0.00 0.000000 0 4 epoll_ctl0.00 0.000000 0 1 timerfd_create0.00 0.000000 0 1 eventfd20.00 0.000000 0 1 epoll_create1------ ----------- ----------- --------- --------- ----------------100.00 0.000967 338 80 totalI am new to openssl code could not figure out how to debug the issue at socket layer. Can some one help me to understand how to go forward to resolve this issue ?Thanks and Regards,Mahesh G SOn Fri, Apr 14, 2017 at 3:32 AM, Matt Caswell <matt@xxxxxxxxxxx> wrote:--That's an interesting question. The segmented messages are for the
On 13/04/17 18:26, Martin Brejcha wrote:
>
>
> Matt Caswell wrote on 04/13/2017 03:45 PM:
>>
>>
>> On 13/04/17 10:11, mahesh gs wrote:
>>> Hi,
>>>
>>> We are running SCTP connections with DTLS enabled in our application. We
>>> have adapted openssl version (openssl-1.1.0e) to achieve the same.
>>>
>>> We have generated the self signed root and node certificates for
>>> testing. We have a strange problem with the incomplete DTLS handshake if
>>> we run the DTLS client and DTLS server is different systems.If we run
>>> the DTLS client and server in same system handshake is successful,
>>> handshake is not successful if run client and server in different VM's.
>>>
>>> This strange problem happens only for SCTP/DTLS connection. With the
>>> same set of certificates TCP/TLS connection is successful and we are
>>> able to exchange the application data.
>>>
>>> I am attaching the code bits for SSL_accept and SSL_connect and also the
>>> wireshark trace of unsuccessful handshake. Please assist me to debug
>>> this problem.
>>>
>>> SSL_accept returns SSL_ERROR_WANT_READ(2) infinite times but
>>> SSL_connect is called 4 or 5 times and select system call timeout.
>>
>> Your trace shows the following interactions occurring:
>>
>> Client Server
>> ------ ------
>>
>> ClientHello -------->
>> <-------- ServerHello
>> <-------- Certificate
>> <-------- CertificateRequest
>> <-------- ServerDone
>> Certificate --------->
>> ClientKeyExchange --------->
>> CertificateVerify --------->
>> CCS --------->
>> [Encrypted Finished]
>>
>> We would expect the server to continue with its own CCS and Encrypted
>> Finished to complete the handshake. It seems that, for some reason, the
>> server is not receiving (or acting upon) the client's second flight of
>> messages.
>>
>> Normally in DTLS this sort of thing can happen due to lost messages etc
>> but, obviously, with SCTP, this is not the case. Something else must be
>> happening.
>>
>
> There are some SCTP segmented messages during handshake.
> May be some issue in reassembling could lead to strange behavior.
> Can be observed these segmented messages also when the handshake is successful?
Certificate messages. Obviously the client is able to read them just
fine (because it responds with its own Certificate message), but there
could plausibly be an issue on the server side. It would be interesting
to see what happens if you temporarily disable client auth so that the
client does not send this large Certficate message.
Matt
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Attachment:
server.cap
Description: Binary data
-- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users