[Psi-devel] [Delta] QCA 2.0 Beta 7

Justin Karneges justin-psi2 at affinix.com
Mon Jul 9 11:12:07 PDT 2007


On Monday 09 July 2007 5:16 am, Norman Rasmussen wrote:
> On 7/6/07, Justin Karneges <justin-psi2 at affinix.com> wrote:
> > QCA 2.0 Beta 7 is here.
>
> Psi darcs got QCA 2.0 Beta 7 yesterday,  I'm using the msvc compiler
> and found a tls bug:
>
> in sql-ossl.cpp,
> MyTLSContext.reset(),
> result_encoded needs to be inited to 0
>
> msvc inits the values to 0xcdcdcdcd otherwise and causes a cpu hog
> until result_encoded reaches 0 (which would takes ages)
>
> another bug:
>
> in qca_securelayer.cpp,
> in TLS::Private.update and TLS::Private.tls_resultsReady
> what should the values of pending_write be?
> I'd assume zero mostly right?
>
> pending_write is increased once for each set of data, and is decreased
> once that data is sent, and again when other data is received - woops.
>  So pending_write decreases as more and more data is sent on the wire.
>
> It seems that the extra updates are coming from: TLS::writeIncoming.
> So it looks like the pending_write buffer is incorrectly being
> decreased when data arrives.
>
> This could just be the way that Psi is using qca2.0 beta 7, but I'm
> not sure that the way the library is used should create a bug like
> this.

I think both bugs are related to the problem of QCA using the provider's 
encoded() function when no data has actually been encoded (e.g., returned in 
to_net(), which is held in the 'a' variable).  A bogus return value here 
should be okay, since the value would be undefined within this context.

Here's a patch to try:

--- src/qca_securelayer.cpp     (revision 685765)
+++ src/qca_securelayer.cpp     (working copy)
@@ -599,9 +599,12 @@
                        bool more = false;
                        if(mode == TLS::Stream)
                        {
-                               pending_write -= enc;
-                               if(pending_write > 0)
-                                       more = true;
+                               if(!a.isEmpty())
+                               {
+                                       pending_write -= enc;
+                                       if(pending_write > 0)
+                                               more = true;
+                               }
                        }
                        else
                        {


More information about the psi-devel mailing list