<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head><body lang="EN-IN" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi </span>Matt,<o:p></o:p></p>
<p class="MsoNormal">                Thanks for the response, <span lang="EN-US">
the application code has been around a very long time and no one knows the rationale behind it<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">As I understand from your reply that the application need not have to do these operations internally, so we will go ahead and stub it out for now
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Sunil<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> openssl-users <openssl-users-bounces@openssl.org>
<b>On Behalf Of </b>openssl-users-request@openssl.org<br>
<b>Sent:</b> 17 November 2020 08:44<br>
<b>To:</b> openssl-users@openssl.org<br>
<b>Subject:</b> openssl-users Digest, Vol 72, Issue 14<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class="MsoNormal">NOTICE: This email was received from an EXTERNAL sender<o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class="MsoNormal"><br>
Send openssl-users mailing list submissions to<br>
<a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://mta.openssl.org/mailman/listinfo/openssl-users">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:openssl-users-request@openssl.org">openssl-users-request@openssl.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:openssl-users-owner@openssl.org">openssl-users-owner@openssl.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of openssl-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: ## Application accessing 'ex_kusage' ## (Matt Caswell)<br>
2. Re: RAND_bytes() thread safety (Matt Caswell)<br>
3. Re: test cases failed after enabling ktls (Matt Caswell)<br>
4. Handling BIO errors (Jo?o Santos)<br>
5. Re: test cases failed after enabling ktls (rui zang)<br>
6. Re: Server application hangs on SS_read, even when client<br>
disconnects (Jakob Bohm)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Mon, 16 Nov 2020 10:16:24 +0000<br>
From: Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>><br>
To: <a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
Subject: Re: ## Application accessing 'ex_kusage' ##<br>
Message-ID: <<a href="mailto:b854f116-568a-d795-9186-098a6d8f4281@openssl.org">b854f116-568a-d795-9186-098a6d8f4281@openssl.org</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
<br>
<br>
On 13/11/2020 19:10, Narayana, Sunil Kumar wrote:<br>
> Hi ,<br>
> <br>
> ??????????????? We are porting our Application from ?openssl 1.0.1 to<br>
> openssl 3.0. in related to this activity we require to access the<br>
> variable ?*ex_kusage*? pointed by *X509*<br>
> <br>
> But there are no set utilities available to access this variable. Only<br>
> ?X509_get_key_usage Is available.<br>
> <br>
> ?<br>
> <br>
> Our code for 1.0.1 is as below. Please suggest the right way to achieve<br>
> this.<br>
<br>
I'd like to ask why you feel you need to do this at all. It seems to me<br>
like you are replicating libcrypto internal code in your own<br>
application. This is code in libcrypto:<br>
<br>
/* Handle (basic) key usage */<br>
if ((usage = X509_get_ext_d2i(x, NID_key_usage, &i, NULL)) != NULL) {<br>
x->ex_kusage = 0;<br>
if (usage->length > 0) {<br>
x->ex_kusage = usage->data[0];<br>
if (usage->length > 1)<br>
x->ex_kusage |= usage->data[1] << 8;<br>
}<br>
x->ex_flags |= EXFLAG_KUSAGE;<br>
ASN1_BIT_STRING_free(usage);<br>
/* Check for empty key usage according to RFC 5280 section<br>
<a href="http://4.2.1.3">4.2.1.3</a> */<br>
if (x->ex_kusage == 0) {<br>
ERR_raise(ERR_LIB_X509, X509V3_R_EMPTY_KEY_USAGE);<br>
x->ex_flags |= EXFLAG_INVALID;<br>
}<br>
} else if (i != -1) {<br>
x->ex_flags |= EXFLAG_INVALID;<br>
}<br>
<br>
So it seems very similar to what you are trying to do, and I guess some<br>
earlier version of this code was the original source of what is in your<br>
application now.<br>
<br>
The purpose of this code is to decode the key usage extension and cache<br>
it in the internal `ex_flags` value. This code gets called in numerous<br>
code paths whenever we need to query extension data - including if you<br>
were to call X509_get_key_usage().<br>
<br>
Your application seems to want to manage for itself when libcrypto does<br>
this caching. It should not need to do so - it's entirely internal. My<br>
guess is that, perhaps, in some older version of OpenSSL the caching<br>
didn't happen when it was supposed to and you implemented this<br>
workaround?? Or possibly the workaround is still needed due to a bug in<br>
OpenSSL that still doesn't do the caching when needed? If so I'd like to<br>
understand the circumstances behind that.<br>
<br>
Matt<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Mon, 16 Nov 2020 10:35:06 +0000<br>
From: Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>><br>
To: <a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
Subject: Re: RAND_bytes() thread safety<br>
Message-ID: <<a href="mailto:f84a0efa-0a0b-d118-8430-18ea43957251@openssl.org">f84a0efa-0a0b-d118-8430-18ea43957251@openssl.org</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
<br>
<br>
On 14/11/2020 11:00, Rahul Godbole wrote:<br>
> Is OpenSSL function RAND_bytes () thread safe?<br>
<br>
Short answer: Yes<br>
<br>
Longer answer: Yes assuming that:<br>
- you are using >= OpenSSL 1.1.0<br>
or<br>
- you are using OpenSSL 1.0.2 or below and you have set up the locking<br>
callbacks<br>
<br>
AND<br>
<br>
- You have not compiled OpenSSL with "no-threads"<br>
<br>
Matt<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Mon, 16 Nov 2020 11:45:20 +0000<br>
From: Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>><br>
To: <a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
Subject: Re: test cases failed after enabling ktls<br>
Message-ID: <<a href="mailto:749b7676-2c84-1b63-9b75-575f903e14f7@openssl.org">749b7676-2c84-1b63-9b75-575f903e14f7@openssl.org</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
<br>
On 16/11/2020 07:56, rui zang wrote:<br>
> Resend in plain text.<br>
> ======================================<br>
> <br>
> Greetings,<br>
> <br>
> I am trying openssl+ktls on ubuntu 20.04.<br>
> I have tried openssl-3.0.0-alpha8 from <a href="https://www.openssl.org/source/openssl-3.0.0-alpha8.tar.gz">
https://www.openssl.org/source/openssl-3.0.0-alpha8.tar.gz</a> <br>
> and also the current master branch from the github repo.<br>
> The kernels I have tried are v5.9 and v5.9.8.<br>
> On every combination, same group of test case could not pass.<br>
<br>
<br>
Please can you open this as a github issue?<br>
<br>
Thanks<br>
<br>
Matt<br>
<br>
<br>
> <br>
> Test Summary Report<br>
> -------------------<br>
> 70-test_key_share.t (Wstat: 1536 Tests: 22 Failed: 6)<br>
> Failed tests: 1, 4, 6-7, 13-14<br>
> Non-zero exit status: 6<br>
> 70-test_sslextension.t (Wstat: 256 Tests: 8 Failed: 1)<br>
> Failed test: 8<br>
> Non-zero exit status: 1<br>
> 70-test_sslrecords.t (Wstat: 768 Tests: 20 Failed: 3)<br>
> Failed tests: 18-20<br>
> Non-zero exit status: 3<br>
> 70-test_sslsigalgs.t (Wstat: 1536 Tests: 26 Failed: 6)<br>
> Failed tests: 1, 6, 22-23, 25-26<br>
> Non-zero exit status: 6<br>
> 70-test_sslsignature.t (Wstat: 256 Tests: 4 Failed: 1)<br>
> Failed test: 1<br>
> Non-zero exit status: 1<br>
> 70-test_sslversions.t (Wstat: 512 Tests: 8 Failed: 2)<br>
> Failed tests: 5, 7<br>
> Non-zero exit status: 2<br>
> 70-test_tls13cookie.t (Wstat: 512 Tests: 2 Failed: 2)<br>
> Failed tests: 1-2<br>
> Non-zero exit status: 2<br>
> 70-test_tls13downgrade.t (Wstat: 256 Tests: 6 Failed: 1)<br>
> Failed test: 6<br>
> Non-zero exit status: 1<br>
> 70-test_tls13kexmodes.t (Wstat: 7424 Tests: 1 Failed: 1)<br>
> Failed test: 1<br>
> Non-zero exit status: 29<br>
> Parse errors: Bad plan. You planned 11 tests but ran 1.<br>
> 70-test_tls13messages.t (Wstat: 7424 Tests: 1 Failed: 0)<br>
> Non-zero exit status: 29<br>
> Parse errors: Bad plan. You planned 17 tests but ran 1.<br>
> 70-test_tls13psk.t (Wstat: 7424 Tests: 1 Failed: 1)<br>
> Failed test: 1<br>
> Non-zero exit status: 29<br>
> Parse errors: Bad plan. You planned 5 tests but ran 1.<br>
> 70-test_tlsextms.t (Wstat: 256 Tests: 10 Failed: 1)<br>
> Failed test: 10<br>
> Non-zero exit status: 1<br>
> Files=223, Tests=3571, 615 wallclock secs (11.00 usr 0.93 sys + 343.65 cusr 84.69 csys = 440.27 CPU)<br>
> Result: FAIL<br>
> make[1]: *** [Makefile:3197: _tests] Error 1<br>
> make[1]: Leaving directory '/home/ubuntu/openssl'<br>
> make: *** [Makefile:3194: tests] Error 2<br>
> <br>
> Complete `make test` output (kernel v5.9.8 + openssl master) is copied here <a href="https://cl1p.net/openssl_ktls_make_test_failure">
https://cl1p.net/openssl_ktls_make_test_failure</a> (due to the 100K limit of this mailing list)<br>
> I am sure that the kernel tls module is loaded correctly since /proc/net/tls_stat is exposed correctly and I can see the counters increasing while doing `make test`.<br>
> So is this supposed to happen? What should I do to make ktls work?<br>
> <br>
> Thanks,<br>
> Rui Zang<br>
> <br>
<br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Tue, 17 Nov 2020 02:33:30 +0000<br>
From: Jo?o Santos <<a href="mailto:jps@xce.pt">jps@xce.pt</a>><br>
To: <a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
Subject: Handling BIO errors<br>
Message-ID: <<a href="mailto:009450BD-7D9B-47D7-A1D2-8A4476EE52BE@xce.pt">009450BD-7D9B-47D7-A1D2-8A4476EE52BE@xce.pt</a>><br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
I'm writing a daemon that talks to a server using HTTP/2 over TLS 1.2+ and leveraging OpenSSL 1.1.1h to provide the TLS support.<br>
<br>
At the moment I think that I have the whole TLS part figured, and I could probably have the project running by now if I used SSL_set_fd to assign a connected socket to the underlying BIO of an SSL object, but I want to simplify the code as much as possible
 by using the highest level interfaces at my disposal, which in the case of OpenSSL means using BIO objects.<br>
<br>
Unfortunately I'm having a problem which is that I can't figure out how to convert error codes returned by ERR_get_error and split by ERR_GET_LIB, ERR_GET_FUNC, and ERR_GET_REASON into constants that I can use in a switch statement to react to BIO errors. This
 is not a problem for SSL filter BIOs since those have their own error reporting functions, but is a problem for Internet socket source BIOs since BIO_do_connect in particular can fail due to a system call error, a DNS error,, or even an error generated by
 lower level OpenSSL functions and other BIOs in the chain, and I cannot find any manual pages documenting these error constants, if they even exist.<br>
<br>
Here's a small working example that illustrates the problem that I'm having:<br>
<br>
#include <stdio.h><br>
#include <openssl/bio.h><br>
#include <openssl/err.h><br>
<br>
int main(void) {<br>
ERR_load_ERR_strings();<br>
BIO *bio = BIO_new_connect("<a href="http://wwx.google.com:80">http://wwx.google.com:80</a>");<br>
printf("Connected: %ld\n", BIO_do_connect(bio));<br>
ERR_print_errors_fp(stderr);<br>
return 0;<br>
}<br>
<br>
Running this code, which has a misspelled hostname on purpose so that it can fail, results in the following printed out to the console:<br>
<br>
Connected: -1<br>
4667342272:error:2008F002:BIO routines:BIO_lookup_ex:system lib:crypto/bio/b_addr.c:726:nodename nor servname provided, or not known<br>
<br>
What could I do in that code to use a switch statement on the kind of information printed by ERR_print_errors_fp? I know that, in this example, the error is from getaddrinfo, since I recognize the error message, but assuming that I want to handle that specific
 error, what can I match the library, function, and reason error codes against?<br>
<br>
Thanks in advance!<br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Tue, 17 Nov 2020 11:08:27 +0800<br>
From: rui zang <<a href="mailto:rui.zang@yandex.com">rui.zang@yandex.com</a>><br>
To: Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>>, "<a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a>"<br>
<<a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a>><br>
Subject: Re: test cases failed after enabling ktls<br>
Message-ID: <<a href="mailto:1089471605582408@mail.yandex.com">1089471605582408@mail.yandex.com</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
Thanks, please check out <a href="https://github.com/openssl/openssl/issues/13424">
https://github.com/openssl/openssl/issues/13424</a><br>
<br>
Regards,<br>
Rui Zang<br>
<br>
<br>
16.11.2020, 19:45, "Matt Caswell" <<a href="mailto:matt@openssl.org">matt@openssl.org</a>>:<br>
> On 16/11/2020 07:56, rui zang wrote:<br>
>> ?Resend in plain text.<br>
>> ?======================================<br>
>><br>
>> ?Greetings,<br>
>><br>
>> ?I am trying openssl+ktls on ubuntu 20.04.<br>
>> ?I have tried openssl-3.0.0-alpha8 from <a href="https://www.openssl.org/source/openssl-3.0.0-alpha8.tar.gz">
https://www.openssl.org/source/openssl-3.0.0-alpha8.tar.gz</a><br>
>> ?and also the current master branch from the github repo.<br>
>> ?The kernels I have tried are v5.9 and v5.9.8.<br>
>> ?On every combination, same group of test case could not pass.<br>
><br>
> Please can you open this as a github issue?<br>
><br>
> Thanks<br>
><br>
> Matt<br>
><br>
>> ?Test Summary Report<br>
>> ?-------------------<br>
>> ?70-test_key_share.t (Wstat: 1536 Tests: 22 Failed: 6)<br>
>> ???Failed tests: 1, 4, 6-7, 13-14<br>
>> ???Non-zero exit status: 6<br>
>> ?70-test_sslextension.t (Wstat: 256 Tests: 8 Failed: 1)<br>
>> ???Failed test: 8<br>
>> ???Non-zero exit status: 1<br>
>> ?70-test_sslrecords.t (Wstat: 768 Tests: 20 Failed: 3)<br>
>> ???Failed tests: 18-20<br>
>> ???Non-zero exit status: 3<br>
>> ?70-test_sslsigalgs.t (Wstat: 1536 Tests: 26 Failed: 6)<br>
>> ???Failed tests: 1, 6, 22-23, 25-26<br>
>> ???Non-zero exit status: 6<br>
>> ?70-test_sslsignature.t (Wstat: 256 Tests: 4 Failed: 1)<br>
>> ???Failed test: 1<br>
>> ???Non-zero exit status: 1<br>
>> ?70-test_sslversions.t (Wstat: 512 Tests: 8 Failed: 2)<br>
>> ???Failed tests: 5, 7<br>
>> ???Non-zero exit status: 2<br>
>> ?70-test_tls13cookie.t (Wstat: 512 Tests: 2 Failed: 2)<br>
>> ???Failed tests: 1-2<br>
>> ???Non-zero exit status: 2<br>
>> ?70-test_tls13downgrade.t (Wstat: 256 Tests: 6 Failed: 1)<br>
>> ???Failed test: 6<br>
>> ???Non-zero exit status: 1<br>
>> ?70-test_tls13kexmodes.t (Wstat: 7424 Tests: 1 Failed: 1)<br>
>> ???Failed test: 1<br>
>> ???Non-zero exit status: 29<br>
>> ???Parse errors: Bad plan. You planned 11 tests but ran 1.<br>
>> ?70-test_tls13messages.t (Wstat: 7424 Tests: 1 Failed: 0)<br>
>> ???Non-zero exit status: 29<br>
>> ???Parse errors: Bad plan. You planned 17 tests but ran 1.<br>
>> ?70-test_tls13psk.t (Wstat: 7424 Tests: 1 Failed: 1)<br>
>> ???Failed test: 1<br>
>> ???Non-zero exit status: 29<br>
>> ???Parse errors: Bad plan. You planned 5 tests but ran 1.<br>
>> ?70-test_tlsextms.t (Wstat: 256 Tests: 10 Failed: 1)<br>
>> ???Failed test: 10<br>
>> ???Non-zero exit status: 1<br>
>> ?Files=223, Tests=3571, 615 wallclock secs (11.00 usr 0.93 sys + 343.65 cusr 84.69 csys = 440.27 CPU)<br>
>> ?Result: FAIL<br>
>> ?make[1]: *** [Makefile:3197: _tests] Error 1<br>
>> ?make[1]: Leaving directory '/home/ubuntu/openssl'<br>
>> ?make: *** [Makefile:3194: tests] Error 2<br>
>><br>
>> ?Complete `make test` output (kernel v5.9.8 + openssl master) is copied here <a href="https://cl1p.net/openssl_ktls_make_test_failure">
https://cl1p.net/openssl_ktls_make_test_failure</a> (due to the 100K limit of this mailing list)<br>
>> ?I am sure that the kernel tls module is loaded correctly since /proc/net/tls_stat is exposed correctly and I can see the counters increasing while doing `make test`.<br>
>> ?So is this supposed to happen? What should I do to make ktls work?<br>
>><br>
>> ?Thanks,<br>
>> ?Rui Zang<br>
<br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Tue, 17 Nov 2020 04:13:54 +0100<br>
From: Jakob Bohm <<a href="mailto:jb-openssl@wisemo.com">jb-openssl@wisemo.com</a>><br>
To: <a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
Subject: Re: Server application hangs on SS_read, even when client<br>
disconnects<br>
Message-ID: <<a href="mailto:66c3b7e7-871f-b0c0-3e4c-1968c8d6b91c@wisemo.com">66c3b7e7-871f-b0c0-3e4c-1968c8d6b91c@wisemo.com</a>><br>
Content-Type: text/plain; charset=utf-8; format=flowed<br>
<br>
(Top posting to match what Mr. Andr? does):<br>
<br>
TCP without keepalive will time out the connection a few minutes after<br>
sending any data that doesn't get a response.<br>
<br>
TCP without keepalive with no outstanding send (so only a blocking<br>
recv) and nothing outstanding at the other end will probably hang<br>
almost forever as there is nothing indicating that there is actual<br>
data lost in transit.<br>
<br>
On 2020-11-13 17:13, Brice Andr? wrote:<br>
> Hello,<br>
><br>
> And many thanks for the answer.<br>
><br>
> "Does the server parent process close its copy of the conversation <br>
> socket?" : I checked in my code, but it seems that no. Is it needed? ? <br>
> May it explain my problem ?<br>
><br>
> " Do you have keepalives enabled?" To be honest, I did not know it was <br>
> possible to not enable them. I checked with command "netstat -tnope" <br>
> and it tells me that it is not enabled.<br>
><br>
> I suppose that, if for some reason, the communication with the client <br>
> is lost (crash of client, loss of network, etc.) and keepalive is not <br>
> enabled, this may fully explain my problem ?<br>
><br>
> If yes, do you have an idea of why keepalive is not enabled ? I <br>
> thought that by default on linux it was ?<br>
><br>
> Many thanks,<br>
> Brice<br>
><br>
><br>
> Le?ven. 13 nov. 2020 ??15:43, Michael Wojcik <br>
> <<a href="mailto:Michael.Wojcik@microfocus.com%20%3cmailto:Michael.Wojcik@microfocus.com">Michael.Wojcik@microfocus.com <mailto:Michael.Wojcik@microfocus.com</a>>>
<br>
> a ?crit?:<br>
><br>
> > From: openssl-users <<a href="mailto:openssl-users-bounces@openssl.org%0b">openssl-users-bounces@openssl.org<br>
</a>> <<a href="mailto:openssl-users-bounces@openssl.org">mailto:openssl-users-bounces@openssl.org</a>>> On Behalf Of Brice Andr?<br>
> > Sent: Friday, 13 November, 2020 05:06<br>
><br>
> > ... it seems that in some rare execution cases, the server<br>
> performs a SSL_read,<br>
> > the client disconnects in the meantime, and the server never<br>
> detects the<br>
> > disconnection and remains stuck in the SSL_read operation.<br>
><br>
> ...<br>
><br>
> > #0? 0x00007f836575d210 in __read_nocancel () from<br>
> /lib/x86_64-linux-gnu/libpthread.so.0<br>
> > #1? 0x00007f8365c8ccec in ?? () from<br>
> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1<br>
> > #2? 0x00007f8365c8772b in BIO_read () from<br>
> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1<br>
><br>
> So OpenSSL is in a blocking read of the socket descriptor.<br>
><br>
> > tcp? ? ? ? 0? ? ? 0 <a href="http://5.196.111.132:5413">
http://5.196.111.132:5413</a><br>
> <<a href="http://5.196.111.132:5413">http://5.196.111.132:5413</a>>
<a href="http://85.27.92.8:25856">
http://85.27.92.8:25856</a><br>
> <<a href="http://85.27.92.8:25856">http://85.27.92.8:25856</a>> ? ? ? ESTABLISHED 19218/./MabeeServer<br>
> > tcp? ? ? ? 0? ? ? 0 <a href="http://5.196.111.132:5412">
http://5.196.111.132:5412</a><br>
> <<a href="http://5.196.111.132:5412">http://5.196.111.132:5412</a>>
<a href="http://85.27.92.8:26305">
http://85.27.92.8:26305</a><br>
> <<a href="http://85.27.92.8:26305">http://85.27.92.8:26305</a>> ? ? ? ESTABLISHED 19218/./MabeeServer<br>
><br>
> > From this log, I can see that I have two established connections<br>
> with remote<br>
> > client machine on IP <a href="http://109.133.193.70">
109.133.193.70</a>. Note that it's normal to<br>
> have two connexions<br>
> > because my client-server protocol relies on two distinct TCP<br>
> connexions.<br>
><br>
> So the client has not, in fact, disconnected.<br>
><br>
> When a system closes one end of a TCP connection, the stack will<br>
> send a TCP packet<br>
> with either the FIN or the RST flag set. (Which one you get<br>
> depends on whether the<br>
> stack on the closing side was holding data for the conversation<br>
> which the application<br>
> hadn't read.)<br>
><br>
> The sockets are still in ESTABLISHED state; therefore, no FIN or<br>
> RST has been<br>
> received by the local stack.<br>
><br>
> There are various possibilities:<br>
><br>
> - The client system has not in fact closed its end of the<br>
> conversation. Sometimes<br>
> this happens for reasons that aren't immediately apparent; for<br>
> example, if the<br>
> client forked and allowed the descriptor for the conversation<br>
> socket to be inherited<br>
> by the child, and the child still has it open.<br>
><br>
> - The client system shut down suddenly (crashed) and so couldn't<br>
> send the FIN/RST.<br>
><br>
> - There was a failure in network connectivity between the two<br>
> systems, and consequently<br>
> the FIN/RST couldn't be received by the local system.<br>
><br>
> - The connection is in a state where the peer can't send the<br>
> FIN/RST, for example<br>
> because the local side's receive window is zero. That shouldn't be<br>
> the case, since<br>
> OpenSSL is (apparently) blocked in a receive on the connection.<br>
> but as I don't have<br>
> the complete picture I can't rule it out.<br>
><br>
> > This let me think that the connexion on which the SSL_read is<br>
> listening is<br>
> > definitively dead (no more TCP keepalive)<br>
><br>
> "definitely dead" doesn't have any meaning in TCP. That's not one<br>
> of the TCP states,<br>
> or part of the other TCP or IP metadata associated with the local<br>
> port (which is<br>
> what matters).<br>
><br>
> Do you have keepalives enabled?<br>
><br>
> > and that, for a reason I do not understand, the SSL_read keeps<br>
> blocked into it.<br>
><br>
> The reason is simple: The connection is still established, but<br>
> there's no data to<br>
> receive. The question isn't why SSL_read is blocking; it's why you<br>
> think the<br>
> connection is gone, but the stack thinks otherwise.<br>
><br>
> > Note that the normal behavior of my application is : client<br>
> connects, server<br>
> > daemon forks a new instance,<br>
><br>
> Does the server parent process close its copy of the conversation<br>
> socket?<br>
><br>
><br>
<br>
<br>
Enjoy<br>
<br>
Jakob<br>
-- <br>
Jakob Bohm, CIO, Partner, WiseMo A/S. <a href="https://www.wisemo.com">
https://www.wisemo.com</a><br>
Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10<br>
This public discussion message is non-binding and may contain errors.<br>
WiseMo - Remote Service Management for PCs, Phones and Embedded<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
openssl-users mailing list<br>
<a href="mailto:openssl-users@openssl.org">openssl-users@openssl.org</a><br>
<a href="https://mta.openssl.org/mailman/listinfo/openssl-users">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
<br>
<br>
------------------------------<br>
<br>
End of openssl-users Digest, Vol 72, Issue 14<br>
*********************************************<o:p></o:p></p>
</div>


<br><br><span style="font-family:Arial; Font-size:8.0pt"> <hr> Notice: This e-mail together with any attachments may contain information of Ribbon Communications Inc. that is confidential and/or proprietary for the sole use of the intended recipient.  Any review, disclosure, reliance or distribution by others or forwarding without express permission is strictly prohibited.  If you are not the intended recipient, please notify the sender immediately and then delete all copies, including any attachments.<hr> </span></body></html>