rsa.c (1.1.1.4) | rsa.c (1.1.1.5) |
---|---|
1/* apps/rsa.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 97 unchanged lines hidden (view full) --- 106 int i, badops = 0, sgckey = 0; 107 const EVP_CIPHER *enc = NULL; 108 BIO *out = NULL; 109 int informat, outformat, text = 0, check = 0, noout = 0; 110 int pubin = 0, pubout = 0; 111 char *infile, *outfile, *prog; 112 char *passargin = NULL, *passargout = NULL; 113 char *passin = NULL, *passout = NULL; | 1/* apps/rsa.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 97 unchanged lines hidden (view full) --- 106 int i, badops = 0, sgckey = 0; 107 const EVP_CIPHER *enc = NULL; 108 BIO *out = NULL; 109 int informat, outformat, text = 0, check = 0, noout = 0; 110 int pubin = 0, pubout = 0; 111 char *infile, *outfile, *prog; 112 char *passargin = NULL, *passargout = NULL; 113 char *passin = NULL, *passout = NULL; |
114# ifndef OPENSSL_NO_ENGINE | |
115 char *engine = NULL; | 114 char *engine = NULL; |
116# endif | |
117 int modulus = 0; 118 119 int pvk_encr = 2; 120 121 apps_startup(); 122 123 if (bio_err == NULL) 124 if ((bio_err = BIO_new(BIO_s_file())) != NULL) --- 124 unchanged lines hidden (view full) --- 249 BIO_printf(bio_err, 250 " -engine e use engine e, possibly a hardware device.\n"); 251# endif 252 goto end; 253 } 254 255 ERR_load_crypto_strings(); 256 | 115 int modulus = 0; 116 117 int pvk_encr = 2; 118 119 apps_startup(); 120 121 if (bio_err == NULL) 122 if ((bio_err = BIO_new(BIO_s_file())) != NULL) --- 124 unchanged lines hidden (view full) --- 247 BIO_printf(bio_err, 248 " -engine e use engine e, possibly a hardware device.\n"); 249# endif 250 goto end; 251 } 252 253 ERR_load_crypto_strings(); 254 |
257# ifndef OPENSSL_NO_ENGINE | |
258 e = setup_engine(bio_err, engine, 0); | 255 e = setup_engine(bio_err, engine, 0); |
259# endif | |
260 261 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { 262 BIO_printf(bio_err, "Error getting passwords\n"); 263 goto end; 264 } 265 266 if (check && pubin) { 267 BIO_printf(bio_err, "Only private keys can be checked\n"); --- 146 unchanged lines hidden (view full) --- 414 goto end; 415 } 416 if (i <= 0) { 417 BIO_printf(bio_err, "unable to write key\n"); 418 ERR_print_errors(bio_err); 419 } else 420 ret = 0; 421 end: | 256 257 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { 258 BIO_printf(bio_err, "Error getting passwords\n"); 259 goto end; 260 } 261 262 if (check && pubin) { 263 BIO_printf(bio_err, "Only private keys can be checked\n"); --- 146 unchanged lines hidden (view full) --- 410 goto end; 411 } 412 if (i <= 0) { 413 BIO_printf(bio_err, "unable to write key\n"); 414 ERR_print_errors(bio_err); 415 } else 416 ret = 0; 417 end: |
418 release_engine(e); |
|
422 if (out != NULL) 423 BIO_free_all(out); 424 if (rsa != NULL) 425 RSA_free(rsa); 426 if (passin) 427 OPENSSL_free(passin); 428 if (passout) 429 OPENSSL_free(passout); 430 apps_shutdown(); 431 OPENSSL_EXIT(ret); 432} 433#else /* !OPENSSL_NO_RSA */ 434 435# if PEDANTIC 436static void *dummy = &dummy; 437# endif 438 439#endif | 419 if (out != NULL) 420 BIO_free_all(out); 421 if (rsa != NULL) 422 RSA_free(rsa); 423 if (passin) 424 OPENSSL_free(passin); 425 if (passout) 426 OPENSSL_free(passout); 427 apps_shutdown(); 428 OPENSSL_EXIT(ret); 429} 430#else /* !OPENSSL_NO_RSA */ 431 432# if PEDANTIC 433static void *dummy = &dummy; 434# endif 435 436#endif |