~sbeattie/ubuntu/oneiric/openssl/lp850608

« back to all changes in this revision

Viewing changes to apps/prime.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-05-01 23:51:53 UTC
  • mfrom: (11.1.20 sid)
  • Revision ID: james.westby@ubuntu.com-20110501235153-bjcxitndquaezb68
Tags: 1.0.0d-2ubuntu1
* Resynchronise with Debian (LP: #675566).  Remaining changes:
  - debian/libssl1.0.0.postinst:
    + Display a system restart required notification bubble on libssl1.0.0
      upgrade.
    + Use a different priority for libssl1.0.0/restart-services depending
      on whether a desktop, or server dist-upgrade is being performed.
  - debian/{libssl1.0.0-udeb.dirs, control, rules}: Create
    libssl1.0.0-udeb, for the benefit of wget-udeb (no wget-udeb package
    in Debian).
  - debian/{libcrypto1.0.0-udeb.dirs, libssl1.0.0.dirs, libssl1.0.0.files,
    rules}: Move runtime libraries to /lib, for the benefit of
    wpasupplicant.
  - debian/patches/aesni.patch: Backport Intel AES-NI support, now from
    http://rt.openssl.org/Ticket/Display.html?id=2065 rather than the
    0.9.8 variant.
  - debian/patches/Bsymbolic-functions.patch: Link using
    -Bsymbolic-functions.
  - debian/patches/perlpath-quilt.patch: Don't change perl #! paths under
    .pc.
  - debian/rules:
    + Don't run 'make test' when cross-building.
    + Use host compiler when cross-building.  Patch from Neil Williams.
    + Don't build for processors no longer supported: i486, i586 (on
      i386), v8 (on sparc).
    + Fix Makefile to properly clean up libs/ dirs in clean target.
    + Replace duplicate files in the doc directory with symlinks.
* Update architectures affected by Bsymbolic-functions.patch.
* Drop debian/patches/no-sslv2.patch; Debian now adds the 'no-ssl2'
  configure option, which compiles out SSLv2 support entirely, so this is
  no longer needed.
* Drop openssl-doc in favour of the libssl-doc package introduced by
  Debian.  Add Conflicts/Replaces until the next LTS release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
    {
63
63
    int hex=0;
64
64
    int checks=20;
 
65
    int generate=0;
 
66
    int bits=0;
 
67
    int safe=0;
65
68
    BIGNUM *bn=NULL;
66
69
    BIO *bio_out;
67
70
 
77
80
        {
78
81
        if(!strcmp(*argv,"-hex"))
79
82
            hex=1;
 
83
        else if(!strcmp(*argv,"-generate"))
 
84
            generate=1;
 
85
        else if(!strcmp(*argv,"-bits"))
 
86
            if(--argc < 1)
 
87
                goto bad;
 
88
            else
 
89
                bits=atoi(*++argv);
 
90
        else if(!strcmp(*argv,"-safe"))
 
91
            safe=1;
80
92
        else if(!strcmp(*argv,"-checks"))
81
93
            if(--argc < 1)
82
94
                goto bad;
91
103
        ++argv;
92
104
        }
93
105
 
94
 
    if (argv[0] == NULL)
 
106
    if (argv[0] == NULL && !generate)
95
107
        {
96
108
        BIO_printf(bio_err,"No prime specified\n");
97
109
        goto bad;
98
110
        }
99
111
 
100
 
   if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 
112
    if ((bio_out=BIO_new(BIO_s_file())) != NULL)
101
113
        {
102
114
        BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
103
115
#ifdef OPENSSL_SYS_VMS
108
120
#endif
109
121
        }
110
122
 
111
 
    if(hex)
112
 
        BN_hex2bn(&bn,argv[0]);
 
123
    if(generate)
 
124
        {
 
125
        char *s;
 
126
 
 
127
        if(!bits)
 
128
            {
 
129
            BIO_printf(bio_err,"Specifiy the number of bits.\n");
 
130
            return 1;
 
131
            }
 
132
        bn=BN_new();
 
133
        BN_generate_prime_ex(bn,bits,safe,NULL,NULL,NULL);
 
134
        s=hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
 
135
        BIO_printf(bio_out,"%s\n",s);
 
136
        OPENSSL_free(s);
 
137
        }
113
138
    else
114
 
        BN_dec2bn(&bn,argv[0]);
 
139
        {
 
140
        if(hex)
 
141
            BN_hex2bn(&bn,argv[0]);
 
142
        else
 
143
            BN_dec2bn(&bn,argv[0]);
115
144
 
116
 
    BN_print(bio_out,bn);
117
 
    BIO_printf(bio_out," is %sprime\n",
118
 
               BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
 
145
        BN_print(bio_out,bn);
 
146
        BIO_printf(bio_out," is %sprime\n",
 
147
                   BN_is_prime_ex(bn,checks,NULL,NULL) ? "" : "not ");
 
148
        }
119
149
 
120
150
    BN_free(bn);
121
151
    BIO_free_all(bio_out);