Marin Kraemer <Martin.Kraemer@MchP.Siemens.De> sent us patches to make
[openssl.git] / apps / req.c
index 55e53342cf978eb08e5797824d459be407c9e6b0..2c1b9ee8766f47b90d8ebf739fdbea716b8b4643 100644 (file)
  * -key file   - make a request using key in file (or use it for verification).
  * -keyform    - key file format.
  * -rand file(s) - load the file(s) into the PRNG.
- * -egd file   - load PRNG seed from EGD named socket.
  * -newkey     - make a key and a request.
  * -modulus    - print RSA modulus.
  * -x509       - output a self signed X509 structure instead.
@@ -157,7 +156,7 @@ int MAIN(int argc, char **argv)
        char *req_exts = NULL;
        EVP_CIPHER *cipher=NULL;
        int modulus=0;
-       char *inrand=NULL,*inegd=NULL;
+       char *inrand=NULL;
        char *passargin = NULL, *passargout = NULL;
        char *passin = NULL, *passout = NULL;
        char *p;
@@ -246,11 +245,6 @@ int MAIN(int argc, char **argv)
                        if (--argc < 1) goto bad;
                        inrand= *(++argv);
                        }
-               else if (strcmp(*argv,"-egd") == 0)
-                       {
-                       if (--argc < 1) goto bad;
-                       inegd= *(++argv);
-                       }
                else if (strcmp(*argv,"-newkey") == 0)
                        {
                        int is_numeric;
@@ -387,7 +381,6 @@ bad:
                BIO_printf(bio_err," -rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
                BIO_printf(bio_err,"                load the file (or the files in the directory) into\n");
                BIO_printf(bio_err,"                the random number generator\n");
-               BIO_printf(bio_err," -egd file      load random seed from EGD socket\n");
                BIO_printf(bio_err," -newkey rsa:bits generate a new RSA key of 'bits' in size\n");
                BIO_printf(bio_err," -newkey dsa:file generate a new DSA key, parameters taken from CA in 'file'\n");
 
@@ -554,6 +547,11 @@ bad:
                        BIO_printf(bio_err,"unable to load Private key\n");
                        goto end;
                        }
+                if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA)
+                       {
+                       char *randfile = CONF_get_string(req_conf,SECTION,"RANDFILE");
+                       app_RAND_load_file(randfile, bio_err, 0);
+                       }
                }
 
        if (newreq && (pkey == NULL))
@@ -562,9 +560,7 @@ bad:
                app_RAND_load_file(randfile, bio_err, 0);
                if (inrand)
                        app_RAND_load_files(inrand);
-               if (inegd)
-                       RAND_egd(inegd);
-
+       
                if (newkey <= 0)
                        {
                        newkey=(int)CONF_get_number(req_conf,SECTION,BITS);
@@ -1103,7 +1099,11 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
                 * multiple instances 
                 */
                for(p = v->name; *p ; p++) 
+#ifndef CHARSET_EBCDIC
                        if ((*p == ':') || (*p == ',') || (*p == '.')) {
+#else
+                       if ((*p == os_toascii[':']) || (*p == os_toascii[',']) || (*p == os_toascii['.'])) {
+#endif
                                p++;
                                if(*p) type = p;
                                break;
@@ -1219,6 +1219,9 @@ start:
                return(0);
                }
        buf[--i]='\0';
+#ifdef CHARSET_EBCDIC
+       ebcdic2ascii(buf, buf, i);
+#endif
        if(!req_check_len(i, min, max)) goto start;
 
        if(!X509_REQ_add1_attr_by_NID(req, nid, MBSTRING_ASC,