New function X509_CTX_rget_chain(), make SSL_SESSION_print() display return code.
authorDr. Stephen Henson <steve@openssl.org>
Sun, 9 Jan 2000 14:21:40 +0000 (14:21 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 9 Jan 2000 14:21:40 +0000 (14:21 +0000)
Remove references to 'TXT' in -inform and -outform switches.

13 files changed:
CHANGES
apps/crl.c
apps/crl2p7.c
apps/dh.c
apps/dsaparam.c
apps/pkcs12.c
apps/pkcs7.c
apps/req.c
apps/sess_id.c
crypto/x509/x509_vfy.c
crypto/x509/x509_vfy.h
ssl/ssl_lib.c
ssl/ssl_txt.c

diff --git a/CHANGES b/CHANGES
index 18e0c28e7b04857e2e3a0ff0dcc2610596599a84..49ed7aef5ab35f15c39b7c53349c0e243176d26e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,16 @@
 
  Changes between 0.9.4 and 0.9.5  [xx XXX 1999]
 
 
  Changes between 0.9.4 and 0.9.5  [xx XXX 1999]
 
+  *) New function X509_CTX_rget_chain(), this returns the chain
+     from an X509_CTX structure with a dup of the stack and all
+     the X509 reference counts upped: so the stack will exist
+     after X509_CTX_cleanup() has been called. Modify pkcs12.c
+     to use this.
+
+     Also make SSL_SESSION_print() print out the verify return
+     code.
+     [Steve Henson]
+
   *) Add manpage for the pkcs12 command. Also change the default
      behaviour so MAC iteration counts are used unless the new
      -nomaciter option is used. This improves file security and
   *) Add manpage for the pkcs12 command. Also change the default
      behaviour so MAC iteration counts are used unless the new
      -nomaciter option is used. This improves file security and
index c73b35db7438ef087294f297f277a1fd2c8fe86d..d91eb7fd807ddad2cb1357c52cb98cc66528de49 100644 (file)
@@ -75,7 +75,7 @@
 static char *crl_usage[]={
 "usage: crl args\n",
 "\n",
 static char *crl_usage[]={
 "usage: crl args\n",
 "\n",
-" -inform arg     - input format - default PEM (one of DER, TXT or PEM)\n",
+" -inform arg     - input format - default PEM (DER or PEM)\n",
 " -outform arg    - output format - default PEM\n",
 " -text           - print out a text format version\n",
 " -in arg         - input file - default stdin\n",
 " -outform arg    - output format - default PEM\n",
 " -text           - print out a text format version\n",
 " -in arg         - input file - default stdin\n",
index 8634e3a1ec075f74fa07e0c80f58fc84367cffb1..8514be2a4f3115e5bfdfbf266d15a3fb752d6b97 100644 (file)
@@ -76,7 +76,7 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
 #undef PROG
 #define PROG   crl2pkcs7_main
 
 #undef PROG
 #define PROG   crl2pkcs7_main
 
-/* -inform arg - input format - default PEM (one of DER, TXT 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
@@ -157,8 +157,8 @@ int MAIN(int argc, char **argv)
 bad:
                BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
                BIO_printf(bio_err,"where options are\n");
 bad:
                BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
                BIO_printf(bio_err,"where options are\n");
-               BIO_printf(bio_err," -inform arg    input format - one of DER TXT PEM\n");
-               BIO_printf(bio_err," -outform arg   output format - one of DER TXT PEM\n");
+               BIO_printf(bio_err," -inform arg    input format - DER or PEM\n");
+               BIO_printf(bio_err," -outform arg   output format - DER or PEM\n");
                BIO_printf(bio_err," -in arg        input file\n");
                BIO_printf(bio_err," -out arg       output file\n");
                BIO_printf(bio_err," -certfile arg  certificates file of chain to a trusted CA\n");
                BIO_printf(bio_err," -in arg        input file\n");
                BIO_printf(bio_err," -out arg       output file\n");
                BIO_printf(bio_err," -certfile arg  certificates file of chain to a trusted CA\n");
index d68b38808540433543fcf5ed6b1c9db2c184df64..e54cd29050b0cac1f7ab576787643e69e3219928 100644 (file)
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -72,7 +72,7 @@
 #undef PROG
 #define PROG   dh_main
 
 #undef PROG
 #define PROG   dh_main
 
-/* -inform arg - input format - default PEM (one of DER, TXT 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
index 1b5380662d8a12b54dd8b1563c40a7225c6e01aa..7d4a12f56256566cb3eb1bf21bb20620ab42f5f6 100644 (file)
@@ -73,7 +73,7 @@
 #undef PROG
 #define PROG   dsaparam_main
 
 #undef PROG
 #define PROG   dsaparam_main
 
-/* -inform arg - input format - default PEM (one of DER, TXT 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
index 800e2a840633e0728373d2824a855100f9467daa..a48f8c2d8b1acebef0dd67a0c78e3045e5cdd6d3 100644 (file)
@@ -607,11 +607,7 @@ int get_cert_chain (X509 *cert, STACK_OF(X509) **chain)
                i = X509_STORE_CTX_get_error (&store_ctx);
                goto err;
        }
                i = X509_STORE_CTX_get_error (&store_ctx);
                goto err;
        }
-       chn =  sk_X509_dup(X509_STORE_CTX_get_chain (&store_ctx));
-       for (i = 0; i < sk_X509_num(chn); i++) {
-               x = sk_X509_value(chn, i);
-               CRYPTO_add(&x->references,1,CRYPTO_LOCK_X509);
-       }
+       chn =  X509_STORE_CTX_rget_chain(&store_ctx);
        i = 0;
        *chain = chn;
 err:
        i = 0;
        *chain = chn;
 err:
index c1973646cd2468761de11f5739fc993af9411491..d7feafd2f582e5efc6766b7842b27ae88db12593 100644 (file)
@@ -71,7 +71,7 @@
 #undef PROG
 #define PROG   pkcs7_main
 
 #undef PROG
 #define PROG   pkcs7_main
 
-/* -inform arg - input format - default PEM (one of DER, TXT 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
@@ -145,8 +145,8 @@ int MAIN(int argc, char **argv)
 bad:
                BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
                BIO_printf(bio_err,"where options are\n");
 bad:
                BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
                BIO_printf(bio_err,"where options are\n");
-               BIO_printf(bio_err," -inform arg   input format - one of DER TXT PEM\n");
-               BIO_printf(bio_err," -outform arg  output format - one of DER TXT PEM\n");
+               BIO_printf(bio_err," -inform arg   input format - DER or PEM\n");
+               BIO_printf(bio_err," -outform arg  output format - DER or PEM\n");
                BIO_printf(bio_err," -in arg       input file\n");
                BIO_printf(bio_err," -out arg      output file\n");
                BIO_printf(bio_err," -print_certs  print any certs or crl in the input\n");
                BIO_printf(bio_err," -in arg       input file\n");
                BIO_printf(bio_err," -out arg      output file\n");
                BIO_printf(bio_err," -print_certs  print any certs or crl in the input\n");
index 78e3edcaea5925da45dee7448d8122f5c5986138..5d4092507b5af33f2fc142227ef330e557af91ca 100644 (file)
@@ -91,7 +91,7 @@
 #undef PROG
 #define PROG   req_main
 
 #undef PROG
 #define PROG   req_main
 
-/* -inform arg - input format - default PEM (one of DER, TXT 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
@@ -377,8 +377,8 @@ int MAIN(int argc, char **argv)
 bad:
                BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
                BIO_printf(bio_err,"where options  are\n");
 bad:
                BIO_printf(bio_err,"%s [options] <infile >outfile\n",prog);
                BIO_printf(bio_err,"where options  are\n");
-               BIO_printf(bio_err," -inform arg    input format - one of DER TXT PEM\n");
-               BIO_printf(bio_err," -outform arg   output format - one of DER TXT PEM\n");
+               BIO_printf(bio_err," -inform arg    input format - DER or PEM\n");
+               BIO_printf(bio_err," -outform arg   output format - DER or PEM\n");
                BIO_printf(bio_err," -in arg        input file\n");
                BIO_printf(bio_err," -out arg       output file\n");
                BIO_printf(bio_err," -text          text form of request\n");
                BIO_printf(bio_err," -in arg        input file\n");
                BIO_printf(bio_err," -out arg       output file\n");
                BIO_printf(bio_err," -text          text form of request\n");
index 8ac118d4a1e6e013ea70fc5c3a83760483b0c0de..3d363d13ebcffdba55a36691465195d557db5ae9 100644 (file)
@@ -72,7 +72,7 @@
 static char *sess_id_usage[]={
 "usage: sess_id args\n",
 "\n",
 static char *sess_id_usage[]={
 "usage: sess_id args\n",
 "\n",
-" -inform arg     - input format - default PEM (one of DER, TXT or PEM)\n",
+" -inform arg     - input format - default PEM (DER or PEM)\n",
 " -outform arg    - output format - default PEM\n",
 " -in arg         - input file - default stdin\n",
 " -out arg        - output file - default stdout\n",
 " -outform arg    - output format - default PEM\n",
 " -in arg         - input file - default stdin\n",
 " -out arg        - output file - default stdout\n",
index 2668bd19594169d6501e76c35a13f30a5de5b5e9..e45c0324a00d7f914f495e5325917a48b96cf757 100644 (file)
@@ -717,6 +717,19 @@ STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx)
        return(ctx->chain);
        }
 
        return(ctx->chain);
        }
 
+STACK_OF(X509) *X509_STORE_CTX_rget_chain(X509_STORE_CTX *ctx)
+       {
+       int i;
+       X509 *x;
+       STACK_OF(X509) *chain;
+       if(!ctx->chain || !(chain = sk_X509_dup(ctx->chain))) return NULL;
+       for(i = 0; i < sk_X509_num(chain); i++) {
+               x = sk_X509_value(chain, i);
+               CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
+       }
+       return(chain);
+       }
+
 void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
        {
        ctx->cert=x;
 void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
        {
        ctx->cert=x;
index 3e97df14eecbf4cc6a5327867c81db8be4f5ecc9..7c7a9c2b80173ded0fe655651143fa03c7ec82ab 100644 (file)
@@ -347,6 +347,7 @@ void        X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
 int    X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
 X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
 STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
 int    X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
 X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
 STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
+STACK_OF(X509) *X509_STORE_CTX_rget_chain(X509_STORE_CTX *ctx);
 void   X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
 void   X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
 int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
 void   X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
 void   X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
 int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
index 02f8d112562bbcd17def13cf1ffdb7dbcaa78816..3770bdf0f572afb59634afc20ef7c83c500a14c6 100644 (file)
@@ -910,7 +910,7 @@ const char *SSL_get_cipher_list(SSL *s,int n)
        return(c->name);
        }
 
        return(c->name);
        }
 
-/** specify the ciphers to be used by defaut by the SSL_CTX */
+/** specify the ciphers to be used by default by the SSL_CTX */
 int SSL_CTX_set_cipher_list(SSL_CTX *ctx,char *str)
        {
        STACK_OF(SSL_CIPHER) *sk;
 int SSL_CTX_set_cipher_list(SSL_CTX *ctx,char *str)
        {
        STACK_OF(SSL_CIPHER) *sk;
index ca67a98d896a61081d92811232cf3a5db9e12bec..7e27857bcfc218f7edd04cfec08527648d06ba30 100644 (file)
@@ -112,7 +112,7 @@ int SSL_SESSION_print(BIO *bp, SSL_SESSION *x)
                sprintf(str,"%02X",x->session_id[i]);
                if (BIO_puts(bp,str) <= 0) goto err;
                }
                sprintf(str,"%02X",x->session_id[i]);
                if (BIO_puts(bp,str) <= 0) goto err;
                }
-       if (BIO_puts(bp,"\nSession-ID-ctx: ") <= 0) goto err;
+       if (BIO_puts(bp,"\n    Session-ID-ctx: ") <= 0) goto err;
        for (i=0; i<x->sid_ctx_length; i++)
                {
                sprintf(str,"%02X",x->sid_ctx[i]);
        for (i=0; i<x->sid_ctx_length; i++)
                {
                sprintf(str,"%02X",x->sid_ctx[i]);
@@ -163,6 +163,11 @@ int SSL_SESSION_print(BIO *bp, SSL_SESSION *x)
                if (BIO_puts(bp,str) <= 0) goto err;
                }
        if (BIO_puts(bp,"\n") <= 0) goto err;
                if (BIO_puts(bp,str) <= 0) goto err;
                }
        if (BIO_puts(bp,"\n") <= 0) goto err;
+
+       if (BIO_puts(bp, "    Verify return code ") <= 0) goto err;
+       sprintf(str, "%ld (%s)\n", x->verify_result, 
+                       X509_verify_cert_error_string(x->verify_result));
+       if (BIO_puts(bp,str) <= 0) goto err;
                
        return(1);
 err:
                
        return(1);
 err: