req.c (238405) | req.c (264278) |
---|---|
1/* apps/req.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 * --- 630 unchanged lines hidden (view full) --- 639 { 640 char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE"); 641 if (randfile == NULL) 642 ERR_clear_error(); 643 app_RAND_load_file(randfile, bio_err, 0); 644 if (inrand) 645 app_RAND_load_files(inrand); 646 | 1/* apps/req.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 * --- 630 unchanged lines hidden (view full) --- 639 { 640 char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE"); 641 if (randfile == NULL) 642 ERR_clear_error(); 643 app_RAND_load_file(randfile, bio_err, 0); 644 if (inrand) 645 app_RAND_load_files(inrand); 646 |
647 if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey)) 648 { 649 newkey=DEFAULT_KEY_LENGTH; 650 } 651 |
|
647 if (keyalg) 648 { 649 genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey, 650 &keyalgstr, gen_eng); 651 if (!genctx) 652 goto end; 653 } 654 | 652 if (keyalg) 653 { 654 genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey, 655 &keyalgstr, gen_eng); 656 if (!genctx) 657 goto end; 658 } 659 |
655 if (newkey <= 0) 656 { 657 if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey)) 658 newkey=DEFAULT_KEY_LENGTH; 659 } 660 | |
661 if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA)) 662 { 663 BIO_printf(bio_err,"private key length is too short,\n"); 664 BIO_printf(bio_err,"it needs to be at least %d bits, not %ld\n",MIN_KEY_LENGTH,newkey); 665 goto end; 666 } 667 668 if (!genctx) --- 975 unchanged lines hidden (view full) --- 1644#endif 1645 if (*pkey_type == EVP_PKEY_RSA) 1646 { 1647 if (p) 1648 { 1649 keylen = atol(p + 1); 1650 *pkeylen = keylen; 1651 } | 660 if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA)) 661 { 662 BIO_printf(bio_err,"private key length is too short,\n"); 663 BIO_printf(bio_err,"it needs to be at least %d bits, not %ld\n",MIN_KEY_LENGTH,newkey); 664 goto end; 665 } 666 667 if (!genctx) --- 975 unchanged lines hidden (view full) --- 1643#endif 1644 if (*pkey_type == EVP_PKEY_RSA) 1645 { 1646 if (p) 1647 { 1648 keylen = atol(p + 1); 1649 *pkeylen = keylen; 1650 } |
1651 else 1652 keylen = *pkeylen; |
|
1652 } 1653 else if (p) 1654 paramfile = p + 1; 1655 } 1656 1657 if (paramfile) 1658 { 1659 pbio = BIO_new_file(paramfile, "r"); --- 177 unchanged lines hidden --- | 1653 } 1654 else if (p) 1655 paramfile = p + 1; 1656 } 1657 1658 if (paramfile) 1659 { 1660 pbio = BIO_new_file(paramfile, "r"); --- 177 unchanged lines hidden --- |