~ubuntu-branches/ubuntu/maverick/openssl/maverick

« back to all changes in this revision

Viewing changes to ssl/ssltest.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Martin
  • Date: 2004-12-16 18:41:29 UTC
  • mto: (11.1.1 lenny)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041216184129-z7xjkul57mh1jiha
Tags: upstream-0.9.7e
ImportĀ upstreamĀ versionĀ 0.9.7e

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
#endif
134
134
#include <openssl/err.h>
135
135
#include <openssl/rand.h>
 
136
#include <openssl/fips.h>
136
137
 
137
138
#define _XOPEN_SOURCE_EXTENDED  1 /* Or gethostname won't be declared properly
138
139
                                     on Compaq platforms (at least with DEC C).
198
199
        {
199
200
        fprintf(stderr,"usage: ssltest [args ...]\n");
200
201
        fprintf(stderr,"\n");
 
202
#ifdef OPENSSL_FIPS
 
203
        fprintf(stderr,"-F             - run test in FIPS mode\n");
 
204
#endif
201
205
        fprintf(stderr," -server_auth  - check server certificate\n");
202
206
        fprintf(stderr," -client_auth  - do client authentication\n");
203
207
        fprintf(stderr," -v            - more output\n");
369
373
        clock_t s_time = 0, c_time = 0;
370
374
        int comp = 0;
371
375
        COMP_METHOD *cm = NULL;
 
376
#ifdef OPENSSL_FIPS
 
377
        int fips_mode=0;
 
378
        const char *path=argv[0];
 
379
#endif
372
380
 
373
381
        verbose = 0;
374
382
        debug = 0;
400
408
 
401
409
        while (argc >= 1)
402
410
                {
403
 
                if      (strcmp(*argv,"-server_auth") == 0)
 
411
                if(!strcmp(*argv,"-F"))
 
412
                        {
 
413
#ifdef OPENSSL_FIPS
 
414
                        fips_mode=1;
 
415
#else
 
416
                        fprintf(stderr,"not compiled with FIPS support, so exitting without running.\n");
 
417
                        exit(0);
 
418
#endif
 
419
                        }
 
420
                else if (strcmp(*argv,"-server_auth") == 0)
404
421
                        server_auth=1;
405
422
                else if (strcmp(*argv,"-client_auth") == 0)
406
423
                        client_auth=1;
534
551
                goto end;
535
552
                }
536
553
 
 
554
 
537
555
        if (!ssl2 && !ssl3 && !tls1 && number > 1 && !reuse && !force)
538
556
                {
539
557
                fprintf(stderr, "This case cannot work.  Use -f to perform "
543
561
                EXIT(1);
544
562
                }
545
563
 
 
564
#ifdef OPENSSL_FIPS
 
565
        if(fips_mode)
 
566
                {
 
567
                if(!FIPS_mode_set(1,path))
 
568
                        {
 
569
                        ERR_load_crypto_strings();
 
570
                        ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
 
571
                        exit(1);
 
572
                        }
 
573
                else
 
574
                        fprintf(stderr,"*** IN FIPS MODE ***\n");
 
575
                }
 
576
#endif
 
577
 
546
578
        if (print_time)
547
579
                {
548
580
                if (!bio_pair)