Re: make test revisited
3moeller What's the cleanest way to solve this? Exile the command 3moeller list Run something like the following during compilation of the test directory: $(CC) $(CFLAGS) -E testenc_methods.c | sed -e 'd/^$/' |\ sed -e 's/_/-/g' testenc_methods Replace the appropriate for line in test/testenc with this: for i in `cat testenc_methods` testenc_methods.c should contain this (here indented by tabs): #ifndef NO_DES des_cfb des_ede_cfb des_ede3_cfb des_ofb des_ede_ofb des_ede3_ofb des_ecb des_ede des_ede3 desx des_cbc des_ede_cbc des_ede3_cbc #endif #ifndef NO_IDEA idea_ecb idea_cfb idea_ofb idea_cbc #endif #ifndef NO_RC2 rc2_ecb rc2_cfb rc2_ofb rc2_cbc #endif #ifndef NO_BF bf_ecb bf_cfb bf_ofb bf_cbc #endif #ifndef NO_RC4 rc4 #endif #ifndef NO_CAST cast5_ecb cast5_cfb cast5_ofb cast5_cbc #endif You may wonder why I use _ instead of - in testenc_methods.c. The reason is that some preprocessors put spaces between tokens if there are none already, so for example des-ede-cbc would suddenly become "des - ede - cbc". Using underscores instead makes sure they are treated as symbols and, so to say, stay together. The last sed does the conversion back... Looks simple enough, doesn't it? (I may have gotten som paths wrong. I haven't tested this. Please forgive me for that...) -- Richard Levitte \ Spannvägen 38, II \ [EMAIL PROTECTED] Redakteur@Stacken \ S-161 43 BROMMA \ T: +46-8-26 52 47 \ SWEDEN \ or +46-708-26 53 44 Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED] Unsolicited commercial email is subject to an archival fee of $400. See http://www.stacken.kth.se/~levitte/mail/ for more info. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: make test revisited
On Fri, Apr 09, 1999 at 11:45:47AM +0200, Richard Levitte - VMS Whacker wrote: What's the cleanest way to solve this? Exile the command list Run something like the following during compilation of the test directory: $(CC) $(CFLAGS) -E testenc_methods.c | sed -e 'd/^$/' |\ sed -e 's/_/-/g' testenc_methods [...] You may wonder why I use _ instead of - in testenc_methods.c. The reason is that some preprocessors put spaces between tokens if there are none already, so for example des-ede-cbc would suddenly become "des - ede - cbc". Using underscores instead makes sure they are treated as symbols and, so to say, stay together. The last sed does the conversion back... Thanks. I have to added a new file test/testenc_commands.c[1]: [1] Does the filename really have to end in ".c"? I'd prefer ".in" if it cannot cause any problems with other compilers. Is there a portable option that allows to use a different suffix? Sun's cc version 4.2 accepts anything, but gcc complains when I do "gcc -DNO_IDEA -E testenc_methods.strange_suffix". /* C preprocessor input for producing the list of openssl encryption commands that should be available. Note that we use "_" instead of "-" in the names so that each command looks like one symbol to the C preprocessor -- -- otherwise spaces might be inserted. */ #ifndef NO_RC4 rc4 #endif #ifndef NO_DES des_cfb des_ede_cfb des_ede3_cfb des_ofb des_ede_ofb des_ede3_ofb des_ecb des_ede des_ede3 desx des_cbc des_ede_cbc des_ede3_cbc #endif #ifndef NO_IDEA idea_ecb idea_cfb idea_ofb idea_cbc #endif #ifndef NO_RC2 rc2_ecb rc2_cfb rc2_ofb rc2_cbc #endif #ifndef NO_BLOWFISH bf_ecb bf_cfb bf_ofb bf_cbc #endif #ifndef NO_RC4 rc4 #endif #ifndef NO_CAST cast5_ecb cast5_cfb cast5_ofb cast5_cbc #endif and plan to apply the following patches, unless someone complains: === RCS file: /e/openssl/cvs/openssl/test/Makefile.ssl,v retrieving revision 1.12 diff -u -r1.12 Makefile.ssl --- Makefile.ssl1999/04/08 15:09:24 1.12 +++ Makefile.ssl1999/04/09 10:45:02 @@ -144,8 +144,12 @@ test_rand: ./$(RANDTEST) -test_enc: +test_enc: testenc_commands @sh ./testenc + +testenc_commands: testenc_commands.c + $(CC) $(CFLAGS) -E testenc_commands.c | \ + sed -e 's/_/-/g' -e 's/^#.*//' testenc_commands test_x509: echo test normal x509v1 certificate Index: testenc === RCS file: /e/openssl/cvs/openssl/test/testenc,v retrieving revision 1.2 diff -u -r1.2 testenc --- testenc 1999/01/02 19:01:40 1.2 +++ testenc 1999/04/09 10:45:02 @@ -27,15 +27,7 @@ /bin/rm $test.cipher $test.clear fi -for i in rc4 \ - des-cfb des-ede-cfb des-ede3-cfb \ - des-ofb des-ede-ofb des-ede3-ofb \ - des-ecb des-ede des-ede3 desx \ - des-cbc des-ede-cbc des-ede3-cbc \ - idea-ecb idea-cfb idea-ofb idea-cbc \ - rc2-ecb rc2-cfb rc2-ofb rc2-cbc \ - bf-ecb bf-cfb bf-ofb bf-cbc rc4 \ - cast5-ecb cast5-cfb cast5-ofb cast5-cbc +for i in `cat testenc_commands` do echo $i $cmd $i -bufsize 113 -e -k test $test $test.$i.cipher __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: make test revisited
3moeller [1] Does the filename really have to end in ".c"? I'd prefer ".in" 3moellerif it cannot cause any problems with other compilers. Is there 3moellera portable option that allows to use a different suffix? 3moellerSun's cc version 4.2 accepts anything, but gcc complains 3moellerwhen I do "gcc -DNO_IDEA -E testenc_methods.strange_suffix". I'm afraid there's no way to avoid that. If you use foo.in, you'll just have to copy it to a temoprary .c file and work with that one. I see that as unnecessary (sp?) work. 3moeller and plan to apply the following patches, unless someone complains: Those patches look right to me. -- Richard Levitte \ Spannvägen 38, II \ [EMAIL PROTECTED] Redakteur@Stacken \ S-161 43 BROMMA \ T: +46-8-26 52 47 \ SWEDEN \ or +46-708-26 53 44 Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED] Unsolicited commercial email is subject to an archival fee of $400. See http://www.stacken.kth.se/~levitte/mail/ for more info. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: make test revisited
[EMAIL PROTECTED] wrote: That seems very complicated. How about doing this in the Makefile test: cipherlist cipherlist: cipherlist.c ..usual CC rules. And cipherlist is main() { #ifndef NO_DES printf("des_cfb\ndes_ede_cfb\ndes_ede3_cfb\n...") and so on. Then the test is for I in `cipherlist` ; do Hmmm thats not portable to single Makefile stuff like Win32 which would need a special case of course. How about a 'test' application that works similar to the openssl application which has all the tests linked into it and unimplemented stuff #ifdef'ed out? You could then run it as: test des_cfb or test all this should hopefully work on all platforms. Most of the code could be pinched from apps/ Steve. P.S. Yeah I know: "you suggested it, you get to write it" :-) -- Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/ Personal Email: [EMAIL PROTECTED] Senior crypto engineer, Celo Communications: http://www.celocom.com/ Core developer of the OpenSSL project: http://www.openssl.org/ Business Email: [EMAIL PROTECTED] PGP key: via homepage. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: make test revisited
Dr Stephen Henson wrote: [EMAIL PROTECTED] wrote: That seems very complicated. How about doing this in the Makefile test: cipherlist cipherlist: cipherlist.c ..usual CC rules. And cipherlist is main() { #ifndef NO_DES printf("des_cfb\ndes_ede_cfb\ndes_ede3_cfb\n...") and so on. Then the test is for I in `cipherlist` ; do Hmmm thats not portable to single Makefile stuff like Win32 which would need a special case of course. How about a 'test' application that works similar to the openssl application which has all the tests linked into it and unimplemented stuff #ifdef'ed out? You could then run it as: test des_cfb or test all this should hopefully work on all platforms. Most of the code could be pinched from apps/ Isn't the simplest thing to just #ifdef the test code itself, so the test programs are always there, just don't do anything if there's nothing to test? This is what I was going to suggest in the first place, but the other idea got done first, and seemed OK to me... Cheers, Ben. -- http://www.apache-ssl.org/ben.html "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: make test revisited
On Fri, Apr 09, 1999 at 07:29:51PM +0100, Ben Laurie wrote: Isn't the simplest thing to just #ifdef the test code itself, so the test programs are always there, just don't do anything if there's nothing to test? There are two kinds of tests: First, there are ideatest.c and similar programs. These don't seem to have any problems when NO_IDEA etc. is defined. Probably you were thinking of something like these. The only test that failed for me is testenc, which is a shellscript that tests the openssl application program by running openssl algorithm -bufsize 113 -e -k test and then openssl algorithm -bufsize 157 -d -k test And in a shellscript, we obviously cannot just write #ifndef NO_IDEA. It would be possible, of course, to convert the shellscript into an equivalent C program, but I don't know why one would want to do that -- it's quite natural to use the openssl application in shells or shellscripts, and that's exactly what we want to test. Now when it comes to determining which algorithms we should actually test here, the C pre-processor inevitably becomes involved because the relevant configuration is done by defining NO_IDEA and similar symbols. But except for that, the "enctest" program does not have anything with C. __ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]