Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: openssl/apps/ciphers.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « openssl/apps/ca.c ('k') | openssl/apps/cms.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* apps/ciphers.c */ 1 /* apps/ciphers.c */
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This package is an SSL implementation written 5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com). 6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL. 7 * The implementation was written so as to conform with Netscapes SSL.
8 * 8 *
9 * This library is free for commercial and non-commercial use as long as 9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions 10 * the following conditions are aheared to. The following conditions
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #endif 64 #endif
65 #include "apps.h" 65 #include "apps.h"
66 #include <openssl/err.h> 66 #include <openssl/err.h>
67 #include <openssl/ssl.h> 67 #include <openssl/ssl.h>
68 68
69 #undef PROG 69 #undef PROG
70 #define PROG ciphers_main 70 #define PROG ciphers_main
71 71
72 static const char *ciphers_usage[]={ 72 static const char *ciphers_usage[]={
73 "usage: ciphers args\n", 73 "usage: ciphers args\n",
74 " -v - verbose mode, a textual listing of the ciphers in SSLeay\n", 74 " -v - verbose mode, a textual listing of the SSL/TLS ciphers in OpenSS L\n",
75 " -V - even more verbose\n",
75 " -ssl2 - SSL2 mode\n", 76 " -ssl2 - SSL2 mode\n",
76 " -ssl3 - SSL3 mode\n", 77 " -ssl3 - SSL3 mode\n",
77 " -tls1 - TLS1 mode\n", 78 " -tls1 - TLS1 mode\n",
78 NULL 79 NULL
79 }; 80 };
80 81
81 int MAIN(int, char **); 82 int MAIN(int, char **);
82 83
83 int MAIN(int argc, char **argv) 84 int MAIN(int argc, char **argv)
84 { 85 {
85 int ret=1,i; 86 int ret=1,i;
86 » int verbose=0; 87 » int verbose=0,Verbose=0;
87 const char **pp; 88 const char **pp;
88 const char *p; 89 const char *p;
89 int badops=0; 90 int badops=0;
90 SSL_CTX *ctx=NULL; 91 SSL_CTX *ctx=NULL;
91 SSL *ssl=NULL; 92 SSL *ssl=NULL;
92 char *ciphers=NULL; 93 char *ciphers=NULL;
93 » SSL_METHOD *meth=NULL; 94 » const SSL_METHOD *meth=NULL;
94 STACK_OF(SSL_CIPHER) *sk; 95 STACK_OF(SSL_CIPHER) *sk;
95 char buf[512]; 96 char buf[512];
96 BIO *STDout=NULL; 97 BIO *STDout=NULL;
97 98
98 #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) 99 #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3)
99 meth=SSLv23_server_method(); 100 meth=SSLv23_server_method();
100 #elif !defined(OPENSSL_NO_SSL3) 101 #elif !defined(OPENSSL_NO_SSL3)
101 meth=SSLv3_server_method(); 102 meth=SSLv3_server_method();
102 #elif !defined(OPENSSL_NO_SSL2) 103 #elif !defined(OPENSSL_NO_SSL2)
103 meth=SSLv2_server_method(); 104 meth=SSLv2_server_method();
104 #endif 105 #endif
105 106
106 apps_startup(); 107 apps_startup();
107 108
108 if (bio_err == NULL) 109 if (bio_err == NULL)
109 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); 110 bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
110 STDout=BIO_new_fp(stdout,BIO_NOCLOSE); 111 STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
111 #ifdef OPENSSL_SYS_VMS 112 #ifdef OPENSSL_SYS_VMS
112 { 113 {
113 BIO *tmpbio = BIO_new(BIO_f_linebuffer()); 114 BIO *tmpbio = BIO_new(BIO_f_linebuffer());
114 STDout = BIO_push(tmpbio, STDout); 115 STDout = BIO_push(tmpbio, STDout);
115 } 116 }
116 #endif 117 #endif
118 if (!load_config(bio_err, NULL))
119 goto end;
117 120
118 argc--; 121 argc--;
119 argv++; 122 argv++;
120 while (argc >= 1) 123 while (argc >= 1)
121 { 124 {
122 if (strcmp(*argv,"-v") == 0) 125 if (strcmp(*argv,"-v") == 0)
123 verbose=1; 126 verbose=1;
127 else if (strcmp(*argv,"-V") == 0)
128 verbose=Verbose=1;
124 #ifndef OPENSSL_NO_SSL2 129 #ifndef OPENSSL_NO_SSL2
125 else if (strcmp(*argv,"-ssl2") == 0) 130 else if (strcmp(*argv,"-ssl2") == 0)
126 meth=SSLv2_client_method(); 131 meth=SSLv2_client_method();
127 #endif 132 #endif
128 #ifndef OPENSSL_NO_SSL3 133 #ifndef OPENSSL_NO_SSL3
129 else if (strcmp(*argv,"-ssl3") == 0) 134 else if (strcmp(*argv,"-ssl3") == 0)
130 meth=SSLv3_client_method(); 135 meth=SSLv3_client_method();
131 #endif 136 #endif
132 #ifndef OPENSSL_NO_TLS1 137 #ifndef OPENSSL_NO_TLS1
133 else if (strcmp(*argv,"-tls1") == 0) 138 else if (strcmp(*argv,"-tls1") == 0)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 { 177 {
173 for (i=0; ; i++) 178 for (i=0; ; i++)
174 { 179 {
175 p=SSL_get_cipher_list(ssl,i); 180 p=SSL_get_cipher_list(ssl,i);
176 if (p == NULL) break; 181 if (p == NULL) break;
177 if (i != 0) BIO_printf(STDout,":"); 182 if (i != 0) BIO_printf(STDout,":");
178 BIO_printf(STDout,"%s",p); 183 BIO_printf(STDout,"%s",p);
179 } 184 }
180 BIO_printf(STDout,"\n"); 185 BIO_printf(STDout,"\n");
181 } 186 }
182 » else 187 » else /* verbose */
183 { 188 {
184 sk=SSL_get_ciphers(ssl); 189 sk=SSL_get_ciphers(ssl);
185 190
186 for (i=0; i<sk_SSL_CIPHER_num(sk); i++) 191 for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
187 { 192 {
188 » » » BIO_puts(STDout,SSL_CIPHER_description( 193 » » » SSL_CIPHER *c;
189 » » » » sk_SSL_CIPHER_value(sk,i), 194
190 » » » » buf,sizeof buf)); 195 » » » c = sk_SSL_CIPHER_value(sk,i);
196 » » »
197 » » » if (Verbose)
198 » » » » {
199 » » » » unsigned long id = c->id;
200 » » » » int id0 = (int)(id >> 24);
201 » » » » int id1 = (int)((id >> 16) & 0xffL);
202 » » » » int id2 = (int)((id >> 8) & 0xffL);
203 » » » » int id3 = (int)(id & 0xffL);
204 » » » »
205 » » » » if ((id & 0xff000000L) == 0x02000000L)
206 » » » » » BIO_printf(STDout, " 0x%02X,0x%02X,0 x%02X - ", id1, id2, id3); /* SSL2 cipher */
207 » » » » else if ((id & 0xff000000L) == 0x03000000L)
208 » » » » » BIO_printf(STDout, " 0x%02X,0x% 02X - ", id2, id3); /* SSL3 cipher */
209 » » » » else
210 » » » » » BIO_printf(STDout, "0x%02X,0x%02X,0x%02X ,0x%02X - ", id0, id1, id2, id3); /* whatever */
211 » » » » }
212
213 » » » BIO_puts(STDout,SSL_CIPHER_description(c,buf,sizeof buf) );
191 } 214 }
192 } 215 }
193 216
194 ret=0; 217 ret=0;
195 if (0) 218 if (0)
196 { 219 {
197 err: 220 err:
198 SSL_load_error_strings(); 221 SSL_load_error_strings();
199 ERR_print_errors(bio_err); 222 ERR_print_errors(bio_err);
200 } 223 }
201 end: 224 end:
202 if (ctx != NULL) SSL_CTX_free(ctx); 225 if (ctx != NULL) SSL_CTX_free(ctx);
203 if (ssl != NULL) SSL_free(ssl); 226 if (ssl != NULL) SSL_free(ssl);
204 if (STDout != NULL) BIO_free_all(STDout); 227 if (STDout != NULL) BIO_free_all(STDout);
205 apps_shutdown(); 228 apps_shutdown();
206 OPENSSL_EXIT(ret); 229 OPENSSL_EXIT(ret);
207 } 230 }
208 231
OLDNEW
« no previous file with comments | « openssl/apps/ca.c ('k') | openssl/apps/cms.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698