Hi ,
I have client that would connects to a server for a long duration of time.=
=20
And i'm trying to refresh the session keys.=20
From what I have read for open ssl 0.9.7 and up the step to do the same are=
pretty simple.
SSL_renegotiate(SSL *)
SSL_do_handshake(SSL *)
and then to confirm call SSL_renegotiate_pending to check status.
the problem I'm seeing is that i don't see the SSL_renegotiate_pending retu=
rning 0 to indicate=20
renegotiation completed.
I'm using openssl 0.9.7. and SSL_get_version returning TLSv1, which i think=
is fine.
Q1) By the way i'm making this call from the client. should this matter ?=20
Q2) is there any thing else that i need to do. or am i missing something ?
Any insights would appreciated
-Kunal=20
here the client code snippet=20
void run() {
time_t lastRenewTime;
time_t currentTime;
time(&lastRenewTime);
static BIO *out =3D BIO_new_fp(stdout,BIO_NOCLOSE);
printf("SSL/TLS version : %s \n", SSL_get_version(mySSL));
SSL_SESSION *session =3D SSL_get_session(mySSL);
printf("session A\n");
SSL_SESSION_print(out, session);
while (1)
{
time(¤tTime);
if ((currentTime - lastRenewTime) > 10)
{
printf("renegotiating ...\n");
SSL_renegotiate(mySSL);
int pending =3D SSL_renegotiate_pending(mySSL);
int handShake =3D SSL_do_handshake(mySSL);
int timeout =3D 20000;
printf("do_handshake %d\n", handShake);
// int );
do {
timeout--;
// i think the actual renegotiate req would only go to server w=
henever a data is sent. right ?
SendDataToServer();
SSL_do_handshake(mySSL);
=20
} while(pending && SSL_renegotiate_pending(mySSL) && timeout > 0);
=20
SSL_SESSION *newSession =3D SSL_get_session(mySSL);
printf("session compare %d\n", SSL_SESSION_cmp(session, newSession)=
);
if (!newSession) {
printf("session B \n");
SSL_SESSION_print(out, session);
}
printf("timeout %d\n", timeout);
if (timeout <=3D 0)
{
printf("ERROR in refreshing keys\n");
}
}
// read from and write to server.
}
}
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate.=A0 Join i=
n.
www.windowslive.com/smile?ocid=3DTXT_TAGLM_Wave2_oprsmilewlhmtagline=
--_f7c9cf3a-ee16-486c-99d4-74fa2fe036cc_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
Hi ,<br>I have client that would connects to a server for a long duration o=
f time. <br>And i'm trying to refresh the session keys. <br><br>From what I=
have read for open ssl 0.9.7 and up the step to do the same are pretty sim=
ple.<br><br>SSL_renegotiate(SSL *)<br>SSL_do_handshake(SSL *)<br><br>and th=
en to confirm call SSL_renegotiate_pending to check status.<br><br>the prob=
lem I'm seeing is that i don't see the SSL_renegotiate_pending returning 0 =
to indicate <br>renegotiation completed.<br>I'm using openssl 0.9.7. and SS=
L_get_version returning TLSv1, which i think is fine.<br><br>Q1) By the way=
i'm making this call from the client. should this matter ? <br>Q2) is ther=
e any thing else that i need to do. or am i missing something ?<br><br>Any =
insights would appreciated<br><br>-Kunal <br><br><br>here the client code s=
nippet <br><br>void run() {<br>time_t lastRenewTime;<br>time_t currentTime;=
<br><br>time(&lastRenewTime);<br>static BIO *out =3D BIO_new_fp(stdout,=
BIO_NOCLOSE);<br><br>printf("SSL/TLS version : %s \n", SSL_get_version(mySS=
L));<br>SSL_SESSION *session =3D SSL_get_session(mySSL);<br><br>printf("ses=
sion A\n");<br>SSL_SESSION_print(out, session);<br><br>while (1)<br>{<br>&n=
bsp; time(&currentTime);<br><br> if ((cur=
rentTime - lastRenewTime) > 10)<br> {<br> &=
nbsp; printf("renegotiating ...\n");<br>  =
; SSL_renegotiate(mySSL);<br> &nbs=
p; int pending =3D SSL_renegotiate_pending(mySSL);<=
br> int handShake =3D SSL_do_hand=
shake(mySSL);<br> int timeout =3D=
20000;<br><br> printf("do_handsh=
ake %d\n", handShake);<br> // int=
);<br> do {<br>  =
; timeout--;<br>  =
; // i think the actual renegot=
iate req would only go to server whenever a data is sent. right ?<br> =
SendDataToServer();=
<br> SSL_=
do_handshake(mySSL);<br> &nb=
sp; <br> } while(pend=
ing && SSL_renegotiate_pending(mySSL) && timeout > 0);<b=
r> <br> &n=
bsp; SSL_SESSION *newSession =3D SSL_get_session(mySSL);<br>&nb=
sp; printf("session compare %d\n", SSL_=
SESSION_cmp(session, newSession));<br> &=
nbsp; if (!newSession) {<br>  =
; printf("session B \n");<br> &nbs=
p; SSL_SESSION_print(out, session=
);<br><br> }<br><br> &=
nbsp; printf("timeout %d\n", timeout);<br> &nb=
sp; if (timeout <=3D 0)<br> &nb=
sp; {<br> =
printf("ERROR in refreshing keys\n");<br> &nb=
sp; }<br> }<br> =
// read from and write to server.<br>}<br>}<br><br /><hr />Your smil=
e counts. The more smiles you share, the more we donate. <a href=3D'www.win=
dowslive.com/smile?ocid=3DTXT_TAGLM_Wave2_oprsmilewlhmtagline' target=3D'_n=
ew'>Join in!</a></body>
</html>=
--_f7c9cf3a-ee16-486c-99d4-74fa2fe036cc_--
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openss...@openssl.org
Automated List Manager majo...@openssl.org
Ok, so it's kindof working now.=20
kinda because after a do_handshake, any read on the server server return -1=
, but if you ignore this one and continue, subsequent read works.
And data transfer works if back to normal with the new session.
Any reason why the read would fail ?=20
Are there any setting that i could use on the SSL_CTX that might be helpful=
.
Or is there a alternative way to handle this.=20
1) the read would block till renegotiation successfully completes.=20
2) i don't know, maybe read returns zero.
I don't have access to the server code so possibly can't change the way the=
read is performed.
Again any insights would be appreciated.
Thanks=20
Kunal=20
SSL_renegotiate(SSL *)
SSL_do_handshake(SSL *)
Any insights would appreciated
-Kunal=20
while (1)
{
time(¤tTime);
}
Your smile counts. The more smiles you share, the more we donate. Join in!
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate.=A0 Join i=
n.
www.windowslive.com/smile?ocid=3DTXT_TAGLM_Wave2_oprsmilewlhmtagline=
--_04e7eacf-ca92-4572-a598-6e6ccd344a83_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
<br>Ok, so it's kindof working now. <br><br>kinda because after a do_handsh=
ake, any read on the server server return -1, but if you ignore this one an=
d continue, subsequent read works.<br>And data transfer works if back to no=
rmal with the new session.<br><br>Any reason why the read would fail ? <br>=
Are there any setting that i could use on the SSL_CTX that might be helpful=
.<br>Or is there a alternative way to handle this. <br>1) the read would bl=
ock till renegotiation successfully completes. <br>2) i don't know, maybe r=
ead returns zero.<br><br>I don't have access to the server code so possibly=
can't change the way the read is performed.<br><br>Again any insights woul=
d be appreciated.<br>Thanks <br>Kunal <br><br><br><br><blockquote><hr>From:=
k_b...@hotmail.com<br>To: openss...@openssl.org<br>Subject: SSL_reneg=
otiate and SSL_do_handshake<br>Date: Thu, 29 Nov 2007 13:11:04 -0800<br><br=
>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dunicode">
<meta name=3D"Generator" content=3D"Microsoft SafeHTML">
<style>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass EC_body.hmmessage
{font-size:10pt;font-family:Tahoma;}
</style>
// read from and write to server.<br>}<br>}<br><br><hr>Your smile co=
unts. The more smiles you share, the more we donate. <a href=3D"http://www.=
windowslive.com/smile?ocid=3DTXT_TAGLM_Wave2_oprsmilewlhmtagline" target=3D=
"_blank">Join in!</a>
</blockquote><br /><hr />Your smile counts. The more smiles you share, the =
more we donate. <a href=3D'www.windowslive.com/smile?ocid=3DTXT_TAGLM_Wave2=
_oprsmilewlhmtagline' target=3D'_new'>Join in!</a></body>
</html>=
--_04e7eacf-ca92-4572-a598-6e6ccd344a83_--
Please see http://www.openssl.org/docs/ssl/SSL_read.html for more
information, specifically the part just above the huge WARNING
section. (I don't know if 0.9.7 has SSL_get_mode/SSL_set_mode, or if
SSL_MODE_AUTO_RETRY is implemented, so I don't know if setting that
will work in your environment.) It's important to note, though, that
the documentation there is very unclear. (the reason for those codes
is so that a process can implement its own BIOs and fill the buffers
on its own.)
-Kyle H
On Nov 29, 2007 6:11 PM, k b <k_b...@hotmail.com> wrote:
>
>
> Ok, so it's kindof working now.
>
> kinda because after a do_handshake, any read on the server server return -1,
> but if you ignore this one and continue, subsequent read works.
> And data transfer works if back to normal with the new session.
>
> Any reason why the read would fail ?
> Are there any setting that i could use on the SSL_CTX that might be helpful.
> Or is there a alternative way to handle this.
> 1) the read would block till renegotiation successfully completes.
> 2) i don't know, maybe read returns zero.
>
> I don't have access to the server code so possibly can't change the way the
> read is performed.
>
> Again any insights would be appreciated.
> Thanks
> Kunal
>
>
>
>
> ________________________________
> From: k_b...@hotmail.com
> To: openss...@openssl.org
> Subject: SSL_renegotiate and SSL_do_handshake
> Date: Thu, 29 Nov 2007 13:11:04 -0800
>
>
>
> Hi ,
> I have client that would connects to a server for a long duration of time.
> And i'm trying to refresh the session keys.
>
> From what I have read for open ssl 0.9.7 and up the step to do the same are
> pretty simple.
>
> SSL_renegotiate(SSL *)
> SSL_do_handshake(SSL *)
>
> and then to confirm call SSL_renegotiate_pending to check status.
>
> the problem I'm seeing is that i don't see the SSL_renegotiate_pending
> returning 0 to indicate
> renegotiation completed.
> I'm using openssl 0.9.7. and SSL_get_version returning TLSv1, which i think
> is fine.
>
> Q1) By the way i'm making this call from the client. should this matter ?
> Q2) is there any thing else that i need to do. or am i missing something ?
>
> Any insights would appreciated
>
> -Kunal
>
>
> here the client code snippet
>
> void run() {
> time_t lastRenewTime;
> time_t currentTime;
>
> time(&lastRenewTime);
> static BIO *out = BIO_new_fp(stdout,BIO_NOCLOSE);
>
> printf("SSL/TLS version : %s \n", SSL_get_version(mySSL));
> SSL_SESSION *session = SSL_get_session(mySSL);
>
> printf("session A\n");
> SSL_SESSION_print(out, session);
>
> while (1)
> {
> time(¤tTime);
>
> if ((currentTime - lastRenewTime) > 10)
> {
> printf("renegotiating ...\n");
> SSL_renegotiate(mySSL);
> int pending = SSL_renegotiate_pending(mySSL);
> int handShake = SSL_do_handshake(mySSL);
> int timeout = 20000;
>
> printf("do_handshake %d\n", handShake);
> // int );
> do {
> timeout--;
> // i think the actual renegotiate req would only go to server
> whenever a data is sent. right ?
> SendDataToServer();
> SSL_do_handshake(mySSL);
>
> } while(pending && SSL_renegotiate_pending(mySSL) && timeout > 0);
>
> SSL_SESSION *newSession = SSL_get_session(mySSL);
> printf("session compare %d\n", SSL_SESSION_cmp(session,
> newSession));
> if (!newSession) {
> printf("session B \n");
> SSL_SESSION_print(out, session);
>
> }
>
> printf("timeout %d\n", timeout);
> if (timeout <= 0)
> {
> printf("ERROR in refreshing keys\n");
> }
> }
> // read from and write to server.
> }
> }
>
> ________________________________
> Your smile counts. The more smiles you share, the more we donate. Join in!
>
>
> ________________________________
> Your smile counts. The more smiles you share, the more we donate. Join in!