bss_dgram changes and Re: run-checker NO DGRAM and test cases

2022-03-22 Thread Michael Richardson

I've continued to work on:
 https://github.com/openssl/openssl/pull/5257

I'm summarizing this here because the pull request is now very convoluted to 
follow.

a) It's rebased to openssl-3.1-dev, although now 30 commits behind head since
   last week, but should be easy to bring it to the tip.

b) I've remove TRAVIS_NO_IPV6, as we don't use Travis-CI anymore.

c) there have been comments about whether ip6.h can be included or not, and
   it seems to me that if there are systems that have posix sockets, but don't 
have
   IPv6 support, that they are very non-mainstream, and probably not in CI
   today.  I don't know what #ifdef will be relevant yet.

d) I've tried to fix my build.info to avoid testing on no-sock, as I'm told
   that dgram is off when sock is off, but I am getting failure cases that I
   don't quite understand.  Maybe it's not always true?
   Works fine on linux-x86_64, but seems to fail for cross compile cases,
   such as:

https://github.com/mcr/openssl/runs/5616934201?check_suite_focus=true
This test case explicitely does no-dgram, yet it tries to run
my test case which hasn't been built.

https://github.com/mcr/openssl/runs/5616935614?check_suite_focus=true
"minimal"   Appears to also have sock, and I guess !dgram.

https://github.com/mcr/openssl/runs/5616934286?check_suite_focus=true
all sorts of cross-compiles: mips, m68k, hppa...
Proably also sock and !dgram?

https://github.com/mcr/openssl/runs/5616934565?check_suite_focus=true
Explicit no-sock, but it doesn't appear to have turned off dgram.a

e) added man page for BIO_dgram_{set,get}_{origin,dest}
   I wind up writing another pull request on how to do the documentation.
   See: https://github.com/openssl/openssl/pull/17926
   and that resulted in: https://github.com/openssl/openssl/pull/17933


f) I rewrote the dgram_read_unconnected_v4 to do the #ifdef within the
   function.  It's a mess. I wouldn't want to maintain it like that!!!

   I agree that there is some duplicate for() loop and stuff, but for IPv4,
   it's a mess of different options on difference OSes with different 
structures.
   When sometime writes the Windows WSARecvMsg() version it will be an even
   bigger mess. (I don't have the knowledge or tools to test such a thing)
   
https://github.com/openssl/openssl/pull/5257/commits/64d181a331d0fc8d99d4f54744403003afee5c78
   The commit is above.

   I tested this with BSD-generic64 on a NetBSD 9.2 VM, which I happened to have
   around.  I think that I got it right.  I couldn't have done it within the
   #ifdef first thing though.

g) I've tried to refactor the bio_write_test and bio_read_test into using
   some common helpers.  I'm using read()/write() for the side which is not
   being tested to avoid using the code under test in the test.
   I'm not really happy with the result, and I think that the results are
   less clearly understood.



This pull request is a prequel to another one involves making DTLS more like
accept(2) / TLS.

My target application is in Ruby-on-Rails, and the ruby-openssl gem is not
yet fully 3.x happy.

--
]   Never tell me the odds! | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works| network architect  [
] m...@sandelman.ca  http://www.sandelman.ca/|   ruby on rails[



signature.asc
Description: PGP signature


Re: run-checker NO DGRAM and test cases

2022-03-20 Thread Michael Richardson

Hi, could/should someone run sort on util/other.syms?



signature.asc
Description: PGP signature


Re: run-checker NO DGRAM and test cases

2022-03-18 Thread Michael Richardson

Tomas Mraz  wrote:
>> Perhaps my use of:     IF[{- !$disabled{dgram} -}]
>> 
>> is wrong in some way.

> You've included the bio_write_test and bio_read_test also on the bare
> PROGRAMS{noinst} assignment. You need to remove them from there.
> Interestingly the http_test is included there as well which means it
> will also be always compiled.

Ah, I was a bit dim, but I understand now.

-- 
Michael Richardson , Sandelman Software Works
 -= IPv6 IoT consulting =-





signature.asc
Description: PGP signature


Re: run-checker NO DGRAM and test cases

2022-03-18 Thread Tomas Mraz
On Fri, 2022-03-18 at 05:24 -0400, Michael Richardson wrote:
> 
> Tomas Mraz  wrote:
>     >> Should the test *ALSO* ifdef itself out if OPENSSL_NO_DGRAM is
>     >> defined?
> 
>     > No, that's not necessary as they won't be built at all with the
>     > build.info change above.
> 
> I didn't find this to be true.  The source file still got built, and
> linked,
> and that failed.
> 
> I had to add an ifdef to the source file.  Please see:
> https://github.com/mcr/openssl/commit/2ae78377969d939d5eedc39ca0c22d914f739e93
> 
> Perhaps my use of:
>     IF[{- !$disabled{dgram} -}]
> 
> is wrong in some way.

You've included the bio_write_test and bio_read_test also on the bare
PROGRAMS{noinst} assignment. You need to remove them from there.
Interestingly the http_test is included there as well which means it
will also be always compiled.

-- 
Tomáš Mráz, OpenSSL




Re: run-checker NO DGRAM and test cases

2022-03-18 Thread Michael Richardson

Tomas Mraz  wrote:
>> Should the test *ALSO* ifdef itself out if OPENSSL_NO_DGRAM is
>> defined?

> No, that's not necessary as they won't be built at all with the
> build.info change above.

I didn't find this to be true.  The source file still got built, and linked,
and that failed.

I had to add an ifdef to the source file.  Please see:
https://github.com/mcr/openssl/commit/2ae78377969d939d5eedc39ca0c22d914f739e93

Perhaps my use of:
IF[{- !$disabled{dgram} -}]

is wrong in some way.





signature.asc
Description: PGP signature


Re: run-checker NO DGRAM and test cases

2022-03-17 Thread Tomas Mraz
On Thu, 2022-03-17 at 10:17 -0400, Michael Richardson wrote:
> 
> Tomas Mraz  wrote:
>     >> I figured out that this means that ./Configure should have
> "no-dgram"
>     >> appended to it.  That seems to result in OPENSSL_NO_DGRAM
> being
>     >> defined.
>     >>
>     >> My test case naturally does not compile for that.
>     >>
>     >> Should my test case just be surrounded by #ifndef
> OPENSSL_NO_DGRAM
>     >> from top to bottom (leaving...?), or is there something more
>     >> sophisticated that should go into build.info in order to skip
> the test
>     >> in that configuration?
> 
>     > Please look at the other examples in tests/build.info - there
> are
>     > things disabled for no-sock and other stuff. But you'll also
> need to
>     > skip the test in the perl test recipe.
> 
> I thought it was shell script, but now that I look more at it, I
> guess it is
> a custom DSL.
> 
>   IF[{- !$disabled{dgram} -}]
>     PROGRAMS{noinst}=bio_write_test
>   ENDIF
>   SOURCE[bio_write_test]=bio_write_test.c
>   INCLUDE[bio_write_test]=../include ../apps/include
>   DEPEND[bio_write_test]=../libcrypto libtestutil.a
> 
> Should I repeat the test for the two programs, or should I group into
> a
> single IF for both programs?
> 
> i.e.
>   IF[{- !$disabled{dgram} -}]
>     PROGRAMS{noinst}=bio_write_test bio_read_test
>   ENDIF

Grouping them is fine.

> I guess maybe the tests could be named with dgram in the file name,
> since that's all they do. 

I guess that we could later add more testcases there for other
bio_write/bio_read functions? Of course then we would have to switch
from disabling them in build.info to ifdefs.

>  Should the test *ALSO* ifdef itself out if
> OPENSSL_NO_DGRAM is defined?

No, that's not necessary as they won't be built at all with the
build.info change above.

> It already does:
> 
> #if defined(_WIN32)
> int setup_tests(void)
> {
>     return 1;
> }
> ...
> 
> 

-- 
Tomáš Mráz, OpenSSL




Re: run-checker NO DGRAM and test cases

2022-03-17 Thread Michael Richardson

Tomas Mraz  wrote:
>> I figured out that this means that ./Configure should have "no-dgram"
>> appended to it.  That seems to result in OPENSSL_NO_DGRAM being
>> defined.
>>
>> My test case naturally does not compile for that.
>>
>> Should my test case just be surrounded by #ifndef OPENSSL_NO_DGRAM
>> from top to bottom (leaving...?), or is there something more
>> sophisticated that should go into build.info in order to skip the test
>> in that configuration?

> Please look at the other examples in tests/build.info - there are
> things disabled for no-sock and other stuff. But you'll also need to
> skip the test in the perl test recipe.

I thought it was shell script, but now that I look more at it, I guess it is
a custom DSL.

  IF[{- !$disabled{dgram} -}]
PROGRAMS{noinst}=bio_write_test
  ENDIF
  SOURCE[bio_write_test]=bio_write_test.c
  INCLUDE[bio_write_test]=../include ../apps/include
  DEPEND[bio_write_test]=../libcrypto libtestutil.a

Should I repeat the test for the two programs, or should I group into a
single IF for both programs?

i.e.
  IF[{- !$disabled{dgram} -}]
PROGRAMS{noinst}=bio_write_test bio_read_test
  ENDIF

I guess maybe the tests could be named with dgram in the file name, since
that's all they do.  Should the test *ALSO* ifdef itself out if
OPENSSL_NO_DGRAM is defined?

It already does:

#if defined(_WIN32)
int setup_tests(void)
{
return 1;
}
...




signature.asc
Description: PGP signature


Re: run-checker NO DGRAM and test cases

2022-03-17 Thread Tomas Mraz
On Wed, 2022-03-16 at 16:20 -0400, Michael Richardson wrote:
> 
> One of the run checkers is marked "no dgram".
>  
> https://github.com/mcr/openssl/runs/5563998914?check_suite_focus=true
> 
> I figured out that this means that ./Configure should have "no-dgram"
> appended to it.  That seems to result in OPENSSL_NO_DGRAM being
> defined.
> 
> My test case naturally does not compile for that.
> 
> Should my test case just be surrounded by #ifndef OPENSSL_NO_DGRAM
> from top
> to bottom (leaving...?), or is there something more sophisticated
> that should go into
> build.info in order to skip the test in that configuration?

Please look at the other examples in tests/build.info - there are
things disabled for no-sock and other stuff. But you'll also need to
skip the test in the perl test recipe.


-- 
Tomáš Mráz, OpenSSL




run-checker NO DGRAM and test cases

2022-03-17 Thread Michael Richardson

One of the run checkers is marked "no dgram".
  https://github.com/mcr/openssl/runs/5563998914?check_suite_focus=true

I figured out that this means that ./Configure should have "no-dgram"
appended to it.  That seems to result in OPENSSL_NO_DGRAM being defined.

My test case naturally does not compile for that.

Should my test case just be surrounded by #ifndef OPENSSL_NO_DGRAM from top
to bottom (leaving...?), or is there something more sophisticated that should 
go into
build.info in order to skip the test in that configuration?

--
]   Never tell me the odds! | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works| network architect  [
] m...@sandelman.ca  http://www.sandelman.ca/|   ruby on rails[




signature.asc
Description: PGP signature