Suggestions for pqueue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestions for pqueue

Andrija Antonijevic
I am using OpenSSL on an architecture that has a shared library model in
which the arguments are passed through the (32-bit) registers and for which
passing the arguments whose size is larger than 32-bit would create some
problems.

In an OpenSSL beta announcement, I read the part about pqueue which made me
have a look at the code. I saw that there already is some useful code for
VMS, but that there are 64-bit arguments passed to pitem_new and pqueue_find.

I would like to suggest the attached patch (against OpenSSL 0.9.8 beta 3)
which changes these two functions to have a pointer to PQ_64BIT variable
instead of the variable itself and also changes for other dependent parts.

The patch doesn't address the following code in d1_pkt.c

dtls1_buffer_record(s, wr->data, wr->length,
  *((PQ_64BIT *)&(s->s3->write_sequence[0])));

since it's surrounded by #if 0/#endif pair and since it seems that it's
intented to be replaced with static PQ_64BIT bytes_to_long_long(unsigned char
*bytes, PQ_64BIT *num); function which is currently not used. I would like to
suggest that bytes_to_long_long shouldn't return a PQ_64BIT, even if it is
convenient since it will create problems on some platforms.

Additionally, it seems to me that pqueue_print should either not be included
when OPENSSL_NOSTDIO is defined since it uses printf or it should be replaced
with a version that takes a FILE * argument (guarded with #ifndef
OPENSSL_NO_FP_API/#endif pair) and a version that takes a BIO * (if this
function is intended to be used for anything else besides debugging
purposes).

I have included another patch (to be applied after the first patch) which
defines USE_BIGNUM_PQ_64BIT when OPENSSL_SYS_VMS or VMS_TEST is defined and
changes the #if defined(OPENSSL_SYS_VMS) || defined(VMS_TEST) and similar
tests with #ifdef USE_BIGNUM_PQ_64BIT etc test in all places. This would make
it easier for other systems to use the VMS changes, only pq_compat.h would
have to be changed.

I hope that you find these patches useful and that they will be accepted.

Sorry if this has already been discussed before and what I wrote above is
redundant, I have searched the mailing list archives but found only a few
posts related to pqueue.

Andrija

openssl-pq1.diff (8K) Download Attachment
openssl-pq2.diff (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Suggestions for pqueue

Richard Levitte - VMS Whacker
In message <[hidden email]> on Sat, 4 Jun 2005 04:31:21 +0200 (CEST), Andrija Antonijevic <[hidden email]> said:

openssl> I am using OpenSSL on an architecture that has a shared
openssl> library model in which the arguments are passed through the
openssl> (32-bit) registers and for which passing the arguments whose
openssl> size is larger than 32-bit would create some problems.

I assume you're talking about VMS, or is there another architecture
involved as well?  Would you mind telling me the VMS version and C
compiler version?  Is it on VAX?  Can you tell me a little more about
the problem?  See, I assume you work on Alpha or ia64, otherwise
pqueue would use BIGNUM for PQ_64BIT (because VAX doesn't have 'long
long' according to our configuration parameters), so I've a hard time
understanding the argument about 32-bit registers.

openssl> Additionally, it seems to me that pqueue_print should either
openssl> not be included when OPENSSL_NOSTDIO is defined since it uses
openssl> printf or it should be replaced with a version that takes a
openssl> FILE * argument (guarded with #ifndef
openssl> OPENSSL_NO_FP_API/#endif pair) and a version that takes a BIO
openssl> * (if this function is intended to be used for anything else
openssl> besides debugging purposes).

Good point, I'll take a look at that.

openssl> I have included another patch (to be applied after the first
openssl> patch) which defines USE_BIGNUM_PQ_64BIT when OPENSSL_SYS_VMS
openssl> or VMS_TEST is defined and changes the #if
openssl> defined(OPENSSL_SYS_VMS) || defined(VMS_TEST) and similar
openssl> tests with #ifdef USE_BIGNUM_PQ_64BIT etc test in all
openssl> places. This would make it easier for other systems to use
openssl> the VMS changes, only pq_compat.h would have to be changed.

Good point as well.

Cheers,
Richard

-----
Please consider sponsoring my work on free software.
See http://www.free.lp.se/sponsoring.html for details.

--
Richard Levitte                         [hidden email]
                                        http://richard.levitte.org/

"When I became a man I put away childish things, including
 the fear of childishness and the desire to be very grown up."
                                                -- C.S. Lewis
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Suggestions for pqueue

Andrija Antonijevic
On 4-Jun-2005, Richard Levitte - VMS Whacker wrote:

> In message <[hidden email]> on Sat, 4 Jun 2005 04:31:21 +0200 (CEST), Andrija Antonijevic <[hidden email]> said:
>
> openssl> I am using OpenSSL on an architecture that has a shared
> openssl> library model in which the arguments are passed through the
> openssl> (32-bit) registers and for which passing the arguments whose
> openssl> size is larger than 32-bit would create some problems.
>
> I assume you're talking about VMS, or is there another architecture
> involved as well?  Would you mind telling me the VMS version and C
> compiler version?  Is it on VAX?  Can you tell me a little more about
> the problem?  See, I assume you work on Alpha or ia64, otherwise
> pqueue would use BIGNUM for PQ_64BIT (because VAX doesn't have 'long
> long' according to our configuration parameters), so I've a hard time
> understanding the argument about 32-bit registers.

It's not VMS, it's AmigaOS. Some compilers don't have 64-bit variable support
so I thought VMS changes would be useful. The shared library model is
compiler independent, but passing of larger than 32-bit arguments in shared
libraries is not supported on some compilers.

This can be worked around, but I think it would make more sense to have
pitem_new and pqueue_find take pointers to PQ_64BIT arguments, ie. I think it
would be better to have BIGNUM * passed than the whole BIGNUM structure.

For systems using 64-bit BN_U[L]LONG for PQ_64BIT, there should be no
performance penalty (or a very minimal one, but this doesn't seem to be
a performance critical component).

Andrija
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]