Commit 82fc1d9c authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Add new -notext option to 'ca', -pubkey option to spkac.

Remove some "WTF??" casts from applications.

Fixes to keep VC++ happy and avoid warnings.

Docs tidy.
parent 7999c65c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@

 Changes between 0.9.4 and 0.9.5  [xx XXX 2000]

  *) Add a new -notext option to 'ca' and a -pubkey option to 'spkac'.
     [Steve Henson]

  *) Use a less unusual form of the Miller-Rabin primality test (it used
     a binary algorithm for exponentiation integrated into the Miller-Rabin
     loop, our standard modexp algorithms are faster).
+11 −10
Original line number Diff line number Diff line
@@ -200,7 +200,7 @@ static int certify_spkac(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
			 char *enddate, int days, char *ext_sect,LHASH *conf,
				int verbose);
static int fix_data(int nid, int *type);
static void write_new_certificate(BIO *bp, X509 *x, int output_der);
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext);
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst,
	STACK_OF(CONF_VALUE) *policy, TXT_DB *db, BIGNUM *serial,
	char *startdate, char *enddate, int days, int batch, int verbose,
@@ -247,6 +247,7 @@ int MAIN(int argc, char **argv)
	char *enddate=NULL;
	int days=0;
	int batch=0;
	int notext=0;
	X509 *x509=NULL;
	X509 *x=NULL;
	BIO *in=NULL,*out=NULL,*Sout=NULL,*Cout=NULL;
@@ -357,6 +358,8 @@ EF_ALIGNMENT=0;
			if (--argc < 1) goto bad;
			outdir= *(++argv);
			}
		else if (strcmp(*argv,"-notext") == 0)
			notext=1;
		else if (strcmp(*argv,"-batch") == 0)
			batch=1;
		else if (strcmp(*argv,"-preserveDN") == 0)
@@ -984,8 +987,8 @@ bad:
				perror(buf[2]);
				goto err;
				}
			write_new_certificate(Cout,x, 0);
			write_new_certificate(Sout,x, output_der);
			write_new_certificate(Cout,x, 0, notext);
			write_new_certificate(Sout,x, output_der, notext);
			}

		if (sk_num(cert_sk))
@@ -1893,17 +1896,16 @@ err:
	return(ok);
	}

static void write_new_certificate(BIO *bp, X509 *x, int output_der)
static void write_new_certificate(BIO *bp, X509 *x, int output_der, int notext)
	{
	char *f;
	char buf[256];

	if (output_der)
		{
		(void)i2d_X509_bio(bp,x);
		return;
		}

#if 0
	/* ??? Not needed since X509_print prints all this stuff anyway */
	f=X509_NAME_oneline(X509_get_issuer_name(x),buf,256);
	BIO_printf(bp,"issuer :%s\n",f);

@@ -1913,10 +1915,9 @@ static void write_new_certificate(BIO *bp, X509 *x, int output_der)
	BIO_puts(bp,"serial :");
	i2a_ASN1_INTEGER(bp,x->cert_info->serialNumber);
	BIO_puts(bp,"\n\n");
	X509_print(bp,x);
	BIO_puts(bp,"\n");
#endif
	if(!notext)X509_print(bp,x);
	PEM_write_bio_X509(bp,x);
	BIO_puts(bp,"\n");
	}

static int certify_spkac(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
+5 −6
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@
 * -genkey
 */

static void MS_CALLBACK dsa_cb(int p, int n, char *arg);
static void MS_CALLBACK dsa_cb(int p, int n, void *arg);
int MAIN(int argc, char **argv)
	{
	DSA *dsa=NULL;
@@ -225,8 +225,7 @@ bad:
		assert(need_rand);
		BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
	        BIO_printf(bio_err,"This could take some time\n");
	        dsa=DSA_generate_parameters(num,NULL,0,NULL,NULL,
			dsa_cb,(char *)bio_err);
	        dsa=DSA_generate_parameters(num,NULL,0,NULL,NULL, dsa_cb,bio_err);
		}
	else if	(informat == FORMAT_ASN1)
		dsa=d2i_DSAparams_bio(in,NULL);
@@ -350,7 +349,7 @@ end:
	EXIT(ret);
	}

static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
	{
	char c='*';

@@ -358,8 +357,8 @@ static void MS_CALLBACK dsa_cb(int p, int n, char *arg)
	if (p == 1) c='+';
	if (p == 2) c='*';
	if (p == 3) c='\n';
	BIO_write((BIO *)arg,&c,1);
	(void)BIO_flush((BIO *)arg);
	BIO_write(arg,&c,1);
	(void)BIO_flush(arg);
#ifdef LINT
	p=n;
#endif
+1 −1
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ bad:
				}
			}
		p=(unsigned char *)buf->data;
		rsa=(RSA *)d2i_Netscape_RSA(NULL,&p,(long)size,NULL);
		rsa=d2i_Netscape_RSA(NULL,&p,(long)size,NULL);
		BUF_MEM_free(buf);
		}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ bad:
		}


	con=(SSL *)SSL_new(ctx);
	con=SSL_new(ctx);
/*	SSL_set_cipher_list(con,"RC4-MD5"); */

re_start:
Loading