~ubuntu-branches/ubuntu/lucid/openssl/lucid-proposed

« back to all changes in this revision

Viewing changes to apps/dsa.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2009-06-13 18:15:46 UTC
  • mto: (11.1.5 squeeze)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: james.westby@ubuntu.com-20090613181546-vbfntai3b009dl1u
Tags: upstream-0.9.8k
ImportĀ upstreamĀ versionĀ 0.9.8k

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
 
97
97
int MAIN(int argc, char **argv)
98
98
        {
99
 
#ifndef OPENSSL_NO_ENGINE
100
99
        ENGINE *e = NULL;
101
 
#endif
102
100
        int ret=1;
103
101
        DSA *dsa=NULL;
104
102
        int i,badops=0;
240
238
                goto end;
241
239
        }
242
240
 
243
 
        in=BIO_new(BIO_s_file());
244
241
        out=BIO_new(BIO_s_file());
245
 
        if ((in == NULL) || (out == NULL))
 
242
        if (out == NULL)
246
243
                {
247
244
                ERR_print_errors(bio_err);
248
245
                goto end;
249
246
                }
250
247
 
251
 
        if (infile == NULL)
252
 
                BIO_set_fp(in,stdin,BIO_NOCLOSE);
253
 
        else
254
 
                {
255
 
                if (BIO_read_filename(in,infile) <= 0)
256
 
                        {
257
 
                        perror(infile);
258
 
                        goto end;
259
 
                        }
260
 
                }
261
 
 
262
248
        BIO_printf(bio_err,"read DSA key\n");
263
 
        if      (informat == FORMAT_ASN1) {
264
 
                if(pubin) dsa=d2i_DSA_PUBKEY_bio(in,NULL);
265
 
                else dsa=d2i_DSAPrivateKey_bio(in,NULL);
266
 
        } else if (informat == FORMAT_PEM) {
267
 
                if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL);
268
 
                else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,passin);
269
 
        } else
270
 
                {
271
 
                BIO_printf(bio_err,"bad input format specified for key\n");
272
 
                goto end;
273
 
                }
 
249
        {
 
250
                EVP_PKEY        *pkey;
 
251
                if (pubin)
 
252
                        pkey = load_pubkey(bio_err, infile, informat, 1,
 
253
                                passin, e, "Public Key");
 
254
                else
 
255
                        pkey = load_key(bio_err, infile, informat, 1,
 
256
                                passin, e, "Private Key");
 
257
 
 
258
                if (pkey != NULL)
 
259
                dsa = pkey == NULL ? NULL : EVP_PKEY_get1_DSA(pkey);
 
260
                EVP_PKEY_free(pkey);
 
261
        }
274
262
        if (dsa == NULL)
275
263
                {
276
264
                BIO_printf(bio_err,"unable to load Key\n");