Skip to content

Commit 71fa451

Browse files
author
Ben Laurie
committed
Version skew reduction: trivia (I hope).
1 parent a9e1c50 commit 71fa451

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+570
-636
lines changed

apps/Makefile

Lines changed: 118 additions & 123 deletions
Large diffs are not rendered by default.

apps/apps.c

Lines changed: 46 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,8 @@ int args_verify(char ***pargs, int *pargc,
23342334
else
23352335
{
23362336
long timestamp;
2337-
/* interpret argument as seconds since Epoch */
2337+
/* interpret the -attime argument as seconds since
2338+
* Epoch */
23382339
if (sscanf(argn, "%li", &timestamp) != 1)
23392340
{
23402341
BIO_printf(bio_err,
@@ -2740,6 +2741,50 @@ void jpake_server_auth(BIO *out, BIO *conn, const char *secret)
27402741

27412742
#endif
27422743

2744+
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
2745+
/* next_protos_parse parses a comma separated list of strings into a string
2746+
* in a format suitable for passing to SSL_CTX_set_next_protos_advertised.
2747+
* outlen: (output) set to the length of the resulting buffer on success.
2748+
* err: (maybe NULL) on failure, an error message line is written to this BIO.
2749+
* in: a NUL termianted string like "abc,def,ghi"
2750+
*
2751+
* returns: a malloced buffer or NULL on failure.
2752+
*/
2753+
unsigned char *next_protos_parse(unsigned short *outlen, const char *in)
2754+
{
2755+
size_t len;
2756+
unsigned char *out;
2757+
size_t i, start = 0;
2758+
2759+
len = strlen(in);
2760+
if (len >= 65535)
2761+
return NULL;
2762+
2763+
out = OPENSSL_malloc(strlen(in) + 1);
2764+
if (!out)
2765+
return NULL;
2766+
2767+
for (i = 0; i <= len; ++i)
2768+
{
2769+
if (i == len || in[i] == ',')
2770+
{
2771+
if (i - start > 255)
2772+
{
2773+
OPENSSL_free(out);
2774+
return NULL;
2775+
}
2776+
out[start] = i - start;
2777+
start = i + 1;
2778+
}
2779+
else
2780+
out[i+1] = in[i];
2781+
}
2782+
2783+
*outlen = len + 1;
2784+
return out;
2785+
}
2786+
#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */
2787+
27432788
/*
27442789
* Platform-specific sections
27452790
*/
@@ -3065,46 +3110,3 @@ int raw_write_stdout(const void *buf,int siz)
30653110
int raw_write_stdout(const void *buf,int siz)
30663111
{ return write(fileno(stdout),buf,siz); }
30673112
#endif
3068-
3069-
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
3070-
/* next_protos_parse parses a comma separated list of strings into a string
3071-
* in a format suitable for passing to SSL_CTX_set_next_protos_advertised.
3072-
* outlen: (output) set to the length of the resulting buffer on success.
3073-
* in: a NUL termianted string like "abc,def,ghi"
3074-
*
3075-
* returns: a malloced buffer or NULL on failure.
3076-
*/
3077-
unsigned char *next_protos_parse(unsigned short *outlen, const char *in)
3078-
{
3079-
size_t len;
3080-
unsigned char *out;
3081-
size_t i, start = 0;
3082-
3083-
len = strlen(in);
3084-
if (len >= 65535)
3085-
return NULL;
3086-
3087-
out = OPENSSL_malloc(strlen(in) + 1);
3088-
if (!out)
3089-
return NULL;
3090-
3091-
for (i = 0; i <= len; ++i)
3092-
{
3093-
if (i == len || in[i] == ',')
3094-
{
3095-
if (i - start > 255)
3096-
{
3097-
OPENSSL_free(out);
3098-
return NULL;
3099-
}
3100-
out[start] = i - start;
3101-
start = i + 1;
3102-
}
3103-
else
3104-
out[i+1] = in[i];
3105-
}
3106-
3107-
*outlen = len + 1;
3108-
return out;
3109-
}
3110-
#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */

apps/apps.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
331331
void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
332332
#endif
333333

334+
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
335+
unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
336+
#endif /* !OPENSSL_NO_TLSEXT && !OPENSSL_NO_NEXTPROTONEG */
337+
334338
#define FORMAT_UNDEF 0
335339
#define FORMAT_ASN1 1
336340
#define FORMAT_TEXT 2
@@ -363,10 +367,7 @@ int raw_write_stdout(const void *,int);
363367
#define TM_START 0
364368
#define TM_STOP 1
365369
double app_tminterval (int stop,int usertime);
366-
#endif
367370

368371
#define OPENSSL_NO_SSL_INTERN
369372

370-
#ifndef OPENSSL_NO_NEXTPROTONEG
371-
unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
372373
#endif

apps/s_client.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,18 +2060,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
20602060
BIO_printf(bio,"Expansion: %s\n",
20612061
expansion ? SSL_COMP_get_name(expansion) : "NONE");
20622062
#endif
2063-
2064-
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
2065-
if (next_proto.status != -1) {
2066-
const unsigned char *proto;
2067-
unsigned int proto_len;
2068-
SSL_get0_next_proto_negotiated(s, &proto, &proto_len);
2069-
BIO_printf(bio, "Next protocol: (%d) ", next_proto.status);
2070-
BIO_write(bio, proto, proto_len);
2071-
BIO_write(bio, "\n", 1);
2072-
}
2073-
#endif
2074-
2063+
20752064
#ifdef SSL_DEBUG
20762065
{
20772066
/* Print out local port of connection: useful for debugging */
@@ -2084,6 +2073,17 @@ static void print_stuff(BIO *bio, SSL *s, int full)
20842073
}
20852074
#endif
20862075

2076+
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
2077+
if (next_proto.status != -1) {
2078+
const unsigned char *proto;
2079+
unsigned int proto_len;
2080+
SSL_get0_next_proto_negotiated(s, &proto, &proto_len);
2081+
BIO_printf(bio, "Next protocol: (%d) ", next_proto.status);
2082+
BIO_write(bio, proto, proto_len);
2083+
BIO_write(bio, "\n", 1);
2084+
}
2085+
#endif
2086+
20872087
{
20882088
SRTP_PROTECTION_PROFILE *srtp_profile=SSL_get_selected_srtp_profile(s);
20892089

apps/s_server.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ static int next_proto_cb(SSL *s, const unsigned char **data, unsigned int *len,
926926

927927
return SSL_TLSEXT_ERR_OK;
928928
}
929-
# endif /* ndef OPENSSL_NO_NPN */
929+
# endif /* ndef OPENSSL_NO_NEXTPROTONEG */
930930
#endif
931931

932932
static int not_resumable_sess_cb(SSL *s, int is_forward_secure)
@@ -976,8 +976,6 @@ int MAIN(int argc, char *argv[])
976976
#ifndef OPENSSL_NO_TLSEXT
977977
EVP_PKEY *s_key2 = NULL;
978978
X509 *s_cert2 = NULL;
979-
#endif
980-
#ifndef OPENSSL_NO_TLSEXT
981979
tlsextctx tlsextcbp = {NULL, NULL, SSL_TLSEXT_ERR_ALERT_WARNING};
982980
# ifndef OPENSSL_NO_NEXTPROTONEG
983981
const char *next_proto_neg_in = NULL;
@@ -1274,12 +1272,12 @@ int MAIN(int argc, char *argv[])
12741272
{ off|=SSL_OP_NO_SSLv2; }
12751273
else if (strcmp(*argv,"-no_ssl3") == 0)
12761274
{ off|=SSL_OP_NO_SSLv3; }
1277-
else if (strcmp(*argv,"-no_tls1_2") == 0)
1278-
{ off|=SSL_OP_NO_TLSv1_2; }
1279-
else if (strcmp(*argv,"-no_tls1_1") == 0)
1280-
{ off|=SSL_OP_NO_TLSv1_1; }
12811275
else if (strcmp(*argv,"-no_tls1") == 0)
12821276
{ off|=SSL_OP_NO_TLSv1; }
1277+
else if (strcmp(*argv,"-no_tls1_1") == 0)
1278+
{ off|=SSL_OP_NO_TLSv1_1; }
1279+
else if (strcmp(*argv,"-no_tls1_2") == 0)
1280+
{ off|=SSL_OP_NO_TLSv1_2; }
12831281
else if (strcmp(*argv,"-no_comp") == 0)
12841282
{ off|=SSL_OP_NO_COMPRESSION; }
12851283
#ifndef OPENSSL_NO_TLSEXT
@@ -1295,14 +1293,12 @@ int MAIN(int argc, char *argv[])
12951293
{ meth=SSLv3_server_method(); }
12961294
#endif
12971295
#ifndef OPENSSL_NO_TLS1
1298-
else if (strcmp(*argv,"-tls1_2") == 0)
1299-
{ meth=TLSv1_2_server_method(); }
1300-
else if (strcmp(*argv,"-tls1_1") == 0)
1301-
{ meth=TLSv1_1_server_method(); }
13021296
else if (strcmp(*argv,"-tls1") == 0)
13031297
{ meth=TLSv1_server_method(); }
13041298
else if (strcmp(*argv,"-tls1_1") == 0)
13051299
{ meth=TLSv1_1_server_method(); }
1300+
else if (strcmp(*argv,"-tls1_2") == 0)
1301+
{ meth=TLSv1_2_server_method(); }
13061302
#endif
13071303
#ifndef OPENSSL_NO_DTLS1
13081304
else if (strcmp(*argv,"-dtls1") == 0)
@@ -1489,6 +1485,7 @@ int MAIN(int argc, char *argv[])
14891485
goto end;
14901486
}
14911487
}
1488+
14921489
# ifndef OPENSSL_NO_NEXTPROTONEG
14931490
if (next_proto_neg_in)
14941491
{
@@ -1980,8 +1977,8 @@ int MAIN(int argc, char *argv[])
19801977
if ((ret = SRP_VBASE_init(srp_callback_parm.vb, srp_verifier_file)) != SRP_NO_ERROR)
19811978
{
19821979
BIO_printf(bio_err,
1983-
"Cannot initialize SRP verifier file \"%s\":ret=%d\n",
1984-
srp_verifier_file,ret);
1980+
"Cannot initialize SRP verifier file \"%s\":ret=%d\n",
1981+
srp_verifier_file, ret);
19851982
goto end;
19861983
}
19871984
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE,verify_callback);
@@ -2505,12 +2502,12 @@ static int init_ssl_connection(SSL *con)
25052502
X509 *peer;
25062503
long verify_error;
25072504
MS_STATIC char buf[BUFSIZ];
2505+
#ifndef OPENSSL_NO_KRB5
2506+
char *client_princ;
2507+
#endif
25082508
#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
25092509
const unsigned char *next_proto_neg;
25102510
unsigned next_proto_neg_len;
2511-
#endif
2512-
#ifndef OPENSSL_NO_KRB5
2513-
char *client_princ;
25142511
#endif
25152512
unsigned char *exportedkeymat;
25162513

@@ -2730,6 +2727,7 @@ static int www_body(char *hostname, int s, unsigned char *context)
27302727
}
27312728
SSL_set_bio(con,sbio,sbio);
27322729
SSL_set_accept_state(con);
2730+
27332731
/* SSL_set_fd(con,s); */
27342732
BIO_set_ssl(ssl_bio,con,BIO_CLOSE);
27352733
BIO_push(io,ssl_bio);

apps/s_socket.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,8 @@ int init_client(int *sock, char *host, int port, int type)
235235

236236
ip[0] = ip[1] = ip[2] = ip[3] = 0;
237237
if (!host_ip(host,&(ip[0])))
238-
{
239-
return(0);
240-
}
241-
return(init_client_ip(sock,ip,port,type));
238+
return 0;
239+
return init_client_ip(sock,ip,port,type);
242240
}
243241

244242
static int init_client_ip(int *sock, const unsigned char ip[4], int port,

apps/speed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ int MAIN(int argc, char **argv)
489489
#define D_IGE_128_AES 26
490490
#define D_IGE_192_AES 27
491491
#define D_IGE_256_AES 28
492-
#define D_GHASH 29
492+
#define D_GHASH 29
493493
double d=0.0;
494494
long c[ALGOR_NUM][SIZE_NUM];
495495
#define R_DSA_512 0

0 commit comments

Comments
 (0)