projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT3548: Remove unsupported platforms
[openssl.git]
/
apps
/
req.c
diff --git
a/apps/req.c
b/apps/req.c
index 85526581cefed10a9ec539cac8b9a04568a754f9..e23c9197a5d32b3477f6be199af7aebd94b8bc5c 100644
(file)
--- a/
apps/req.c
+++ b/
apps/req.c
@@
-56,19
+56,10
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
-/* Until the key-gen callbacks are modified to use newer prototypes, we allow
- * deprecated functions for openssl-internal code */
-#ifdef OPENSSL_NO_DEPRECATED
-#undef OPENSSL_NO_DEPRECATED
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
#include "apps.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
@@
-105,7
+96,8
@@
#undef PROG
#define PROG req_main
#undef PROG
#define PROG req_main
-/* -inform arg - input format - default PEM (DER or PEM)
+/*-
+ * -inform arg - input format - default PEM (DER or PEM)
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
* -outform arg - output format - default PEM
* -in arg - input file - default stdin
* -out arg - output file - default stdout
@@
-511,7
+503,7
@@
bad:
oid_bio=BIO_new_file(p,"r");
if (oid_bio == NULL)
{
oid_bio=BIO_new_file(p,"r");
if (oid_bio == NULL)
{
- /*
+ /*
-
BIO_printf(bio_err,"problems opening %s for extra oid's\n",p);
ERR_print_errors(bio_err);
*/
BIO_printf(bio_err,"problems opening %s for extra oid's\n",p);
ERR_print_errors(bio_err);
*/
@@
-644,6
+636,11
@@
bad:
if (inrand)
app_RAND_load_files(inrand);
if (inrand)
app_RAND_load_files(inrand);
+ if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
+ {
+ newkey=DEFAULT_KEY_LENGTH;
+ }
+
if (keyalg)
{
genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
if (keyalg)
{
genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
@@
-652,12
+649,6
@@
bad:
goto end;
}
goto end;
}
- if (newkey <= 0)
- {
- if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
- newkey=DEFAULT_KEY_LENGTH;
- }
-
if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA))
{
BIO_printf(bio_err,"private key length is too short,\n");
if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA))
{
BIO_printf(bio_err,"private key length is too short,\n");
@@
-904,7
+895,7
@@
loop:
if (subj && x509)
{
if (subj && x509)
{
- BIO_printf(bio_err, "Cannot modif
i
y certificate subject\n");
+ BIO_printf(bio_err, "Cannot modify certificate subject\n");
goto end;
}
goto end;
}
@@
-1159,15
+1150,12
@@
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int multirdn,
/* setup version number */
if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
/* setup version number */
if (!X509_REQ_set_version(req,0L)) goto err; /* version 1 */
- if (no_prompt)
+ if (subj)
+ i = build_subject(req, subj, chtype, multirdn);
+ else if (no_prompt)
i = auto_info(req, dn_sk, attr_sk, attribs, chtype);
i = auto_info(req, dn_sk, attr_sk, attribs, chtype);
- else
- {
- if (subj)
- i = build_subject(req, subj, chtype, multirdn);
- else
- i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs, chtype);
- }
+ else
+ i = prompt_info(req, dn_sk, dn_sect, attr_sk, attr_sect, attribs, chtype);
if(!i) goto err;
if (!X509_REQ_set_pubkey(req,pkey)) goto err;
if(!i) goto err;
if (!X509_REQ_set_pubkey(req,pkey)) goto err;
@@
-1490,7
+1478,13
@@
start:
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
- if(!req_check_len(i, n_min, n_max)) goto start;
+ if(!req_check_len(i, n_min, n_max))
+ {
+ if (batch || value)
+ return 0;
+ goto start;
+ }
+
if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
(unsigned char *) buf, -1,-1,mval)) goto err;
ret=1;
if (!X509_NAME_add_entry_by_NID(n,nid, chtype,
(unsigned char *) buf, -1,-1,mval)) goto err;
ret=1;
@@
-1549,7
+1543,12
@@
start:
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
- if(!req_check_len(i, n_min, n_max)) goto start;
+ if(!req_check_len(i, n_min, n_max))
+ {
+ if (batch || value)
+ return 0;
+ goto start;
+ }
if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
(unsigned char *)buf, -1)) {
if(!X509_REQ_add1_attr_by_NID(req, nid, chtype,
(unsigned char *)buf, -1)) {
@@
-1649,6
+1648,8
@@
static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
keylen = atol(p + 1);
*pkeylen = keylen;
}
keylen = atol(p + 1);
*pkeylen = keylen;
}
+ else
+ keylen = *pkeylen;
}
else if (p)
paramfile = p + 1;
}
else if (p)
paramfile = p + 1;
@@
-1764,9
+1765,6
@@
static int genpkey_cb(EVP_PKEY_CTX *ctx)
if (p == 3) c='\n';
BIO_write(b,&c,1);
(void)BIO_flush(b);
if (p == 3) c='\n';
BIO_write(b,&c,1);
(void)BIO_flush(b);
-#ifdef LINT
- p=n;
-#endif
return 1;
}
return 1;
}