-/* $OpenBSD: d1_clnt.c,v 1.33 2014/08/07 20:02:23 miod Exp $ */
+/* $OpenBSD: d1_clnt.c,v 1.34 2014/08/10 14:42:55 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
.ssl_dispatch_alert = dtls1_dispatch_alert,
.ssl_ctrl = dtls1_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = dtls1_get_cipher,
p += s->d1->cookie_len;
/* Ciphers supported */
- i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0);
+ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0) {
SSLerr(SSL_F_DTLS1_CLIENT_HELLO,
SSL_R_NO_CIPHERS_AVAILABLE);
-/* $OpenBSD: d1_meth.c,v 1.5 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: d1_meth.c,v 1.6 2014/08/10 14:42:56 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
.ssl_dispatch_alert = dtls1_dispatch_alert,
.ssl_ctrl = dtls1_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = dtls1_get_cipher,
-/* $OpenBSD: d1_srvr.c,v 1.35 2014/08/06 20:11:09 miod Exp $ */
+/* $OpenBSD: d1_srvr.c,v 1.36 2014/08/10 14:42:56 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
.ssl_dispatch_alert = dtls1_dispatch_alert,
.ssl_ctrl = dtls1_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = dtls1_get_cipher,
-/* $OpenBSD: s23_clnt.c,v 1.31 2014/07/11 08:17:36 miod Exp $ */
+/* $OpenBSD: s23_clnt.c,v 1.32 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl23_put_cipher_by_char,
.ssl_pending = ssl_undefined_const_function,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
*(p++) = 0;
/* Ciphers supported (using SSL 3.0/TLS 1.0 format) */
- i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]),
- ssl3_put_cipher_by_char);
+ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0) {
SSLerr(SSL_F_SSL23_CLIENT_HELLO,
SSL_R_NO_CIPHERS_AVAILABLE);
-/* $OpenBSD: s23_lib.c,v 1.16 2014/07/11 08:17:36 miod Exp $ */
+/* $OpenBSD: s23_lib.c,v 1.17 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return (300);
}
-int
-ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
-{
- long l;
-
- /* We can write SSLv2 and SSLv3 ciphers */
- if (p != NULL) {
- l = c->id;
- p[0] = ((unsigned char)(l >> 16L))&0xFF;
- p[1] = ((unsigned char)(l >> 8L))&0xFF;
- p[2] = ((unsigned char)(l ))&0xFF;
- }
- return (3);
-}
-
int
ssl23_read(SSL *s, void *buf, int len)
{
-/* $OpenBSD: s23_srvr.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */
+/* $OpenBSD: s23_srvr.c,v 1.34 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl23_put_cipher_by_char,
.ssl_pending = ssl_undefined_const_function,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: s3_clnt.c,v 1.85 2014/08/07 01:24:10 deraadt Exp $ */
+/* $OpenBSD: s3_clnt.c,v 1.86 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
}
/* Ciphers supported */
- i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0);
+ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0) {
SSLerr(SSL_F_SSL3_CLIENT_HELLO,
SSL_R_NO_CIPHERS_AVAILABLE);
&s->session->master_key_length, NULL, &pref_cipher,
s->tls_session_secret_cb_arg)) {
s->session->cipher = pref_cipher ?
- pref_cipher : ssl_get_cipher_by_char(s, p + j);
+ pref_cipher : ssl3_get_cipher_by_char(p + j);
s->s3->flags |= SSL3_FLAGS_CCS_OK;
}
}
memcpy(s->session->session_id,p,j); /* j could be 0 */
}
p += j;
- c = ssl_get_cipher_by_char(s, p);
+ c = ssl3_get_cipher_by_char(p);
if (c == NULL) {
/* unknown cipher */
al = SSL_AD_ILLEGAL_PARAMETER;
SSL_R_WRONG_CIPHER_RETURNED);
goto f_err;
}
- p += ssl_put_cipher_by_char(s, NULL, NULL);
+ p += ssl3_put_cipher_by_char(NULL, NULL);
sk = ssl_get_ciphers_by_id(s);
i = sk_SSL_CIPHER_find(sk, c);
-/* $OpenBSD: s3_srvr.c,v 1.79 2014/07/28 04:23:12 guenther Exp $ */
+/* $OpenBSD: s3_srvr.c,v 1.80 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: d1_clnt.c,v 1.33 2014/08/07 20:02:23 miod Exp $ */
+/* $OpenBSD: d1_clnt.c,v 1.34 2014/08/10 14:42:55 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
.ssl_dispatch_alert = dtls1_dispatch_alert,
.ssl_ctrl = dtls1_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = dtls1_get_cipher,
p += s->d1->cookie_len;
/* Ciphers supported */
- i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0);
+ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0) {
SSLerr(SSL_F_DTLS1_CLIENT_HELLO,
SSL_R_NO_CIPHERS_AVAILABLE);
-/* $OpenBSD: d1_meth.c,v 1.5 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: d1_meth.c,v 1.6 2014/08/10 14:42:56 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
.ssl_dispatch_alert = dtls1_dispatch_alert,
.ssl_ctrl = dtls1_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = dtls1_get_cipher,
-/* $OpenBSD: d1_srvr.c,v 1.35 2014/08/06 20:11:09 miod Exp $ */
+/* $OpenBSD: d1_srvr.c,v 1.36 2014/08/10 14:42:56 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
.ssl_dispatch_alert = dtls1_dispatch_alert,
.ssl_ctrl = dtls1_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = dtls1_get_cipher,
-/* $OpenBSD: s23_clnt.c,v 1.31 2014/07/11 08:17:36 miod Exp $ */
+/* $OpenBSD: s23_clnt.c,v 1.32 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl23_put_cipher_by_char,
.ssl_pending = ssl_undefined_const_function,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
*(p++) = 0;
/* Ciphers supported (using SSL 3.0/TLS 1.0 format) */
- i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]),
- ssl3_put_cipher_by_char);
+ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0) {
SSLerr(SSL_F_SSL23_CLIENT_HELLO,
SSL_R_NO_CIPHERS_AVAILABLE);
-/* $OpenBSD: s23_lib.c,v 1.16 2014/07/11 08:17:36 miod Exp $ */
+/* $OpenBSD: s23_lib.c,v 1.17 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
return (300);
}
-int
-ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p)
-{
- long l;
-
- /* We can write SSLv2 and SSLv3 ciphers */
- if (p != NULL) {
- l = c->id;
- p[0] = ((unsigned char)(l >> 16L))&0xFF;
- p[1] = ((unsigned char)(l >> 8L))&0xFF;
- p[2] = ((unsigned char)(l ))&0xFF;
- }
- return (3);
-}
-
int
ssl23_read(SSL *s, void *buf, int len)
{
-/* $OpenBSD: s23_meth.c,v 1.14 2014/07/11 08:17:36 miod Exp $ */
+/* $OpenBSD: s23_meth.c,v 1.15 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl23_put_cipher_by_char,
.ssl_pending = ssl_undefined_const_function,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: s23_srvr.c,v 1.33 2014/08/07 19:46:31 miod Exp $ */
+/* $OpenBSD: s23_srvr.c,v 1.34 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl23_put_cipher_by_char,
.ssl_pending = ssl_undefined_const_function,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: s3_clnt.c,v 1.85 2014/08/07 01:24:10 deraadt Exp $ */
+/* $OpenBSD: s3_clnt.c,v 1.86 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
}
/* Ciphers supported */
- i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0);
+ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &p[2]);
if (i == 0) {
SSLerr(SSL_F_SSL3_CLIENT_HELLO,
SSL_R_NO_CIPHERS_AVAILABLE);
&s->session->master_key_length, NULL, &pref_cipher,
s->tls_session_secret_cb_arg)) {
s->session->cipher = pref_cipher ?
- pref_cipher : ssl_get_cipher_by_char(s, p + j);
+ pref_cipher : ssl3_get_cipher_by_char(p + j);
s->s3->flags |= SSL3_FLAGS_CCS_OK;
}
}
memcpy(s->session->session_id,p,j); /* j could be 0 */
}
p += j;
- c = ssl_get_cipher_by_char(s, p);
+ c = ssl3_get_cipher_by_char(p);
if (c == NULL) {
/* unknown cipher */
al = SSL_AD_ILLEGAL_PARAMETER;
SSL_R_WRONG_CIPHER_RETURNED);
goto f_err;
}
- p += ssl_put_cipher_by_char(s, NULL, NULL);
+ p += ssl3_put_cipher_by_char(NULL, NULL);
sk = ssl_get_ciphers_by_id(s);
i = sk_SSL_CIPHER_find(sk, c);
-/* $OpenBSD: s3_meth.c,v 1.9 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: s3_meth.c,v 1.10 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: s3_srvr.c,v 1.79 2014/07/28 04:23:12 guenther Exp $ */
+/* $OpenBSD: s3_srvr.c,v 1.80 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: ssl.h,v 1.62 2014/07/12 19:45:53 jsing Exp $ */
+/* $OpenBSD: ssl.h,v 1.63 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int (*ssl_dispatch_alert)(SSL *s);
long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
+ /* XXX - remove get_cipher_by_char and put_cipher_by_char. */
const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr);
int (*ssl_pending)(const SSL *s);
-/* $OpenBSD: ssl_lib.c,v 1.78 2014/07/12 22:33:39 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.79 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
int
-ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
- int (*put_cb)(const SSL_CIPHER *, unsigned char *))
+ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p)
{
- int i, j = 0;
+ int i;
SSL_CIPHER *c;
unsigned char *q;
for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
c = sk_SSL_CIPHER_value(sk, i);
+
/* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
if ((c->algorithm_ssl & SSL_TLSV1_2) &&
(TLS1_get_client_version(s) < TLS1_2_VERSION))
continue;
- j = put_cb ? put_cb(c, p) : ssl_put_cipher_by_char(s, c, p);
- p += j;
+ p += ssl3_put_cipher_by_char(c, p);
}
+
/*
* If p == q, no ciphers and caller indicates an error. Otherwise
* add SCSV if not renegotiating.
static SSL_CIPHER scsv = {
0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- j = put_cb ? put_cb(&scsv, p) :
- ssl_put_cipher_by_char(s, &scsv, p);
- p += j;
+ p += ssl3_put_cipher_by_char(&scsv, p);
}
return (p - q);
if (s->s3)
s->s3->send_connection_binding = 0;
- n = ssl_put_cipher_by_char(s, NULL, NULL);
+ n = ssl3_put_cipher_by_char(NULL, NULL);
if ((num % n) != 0) {
SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,
SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
continue;
}
- c = ssl_get_cipher_by_char(s, p);
+ c = ssl3_get_cipher_by_char(p);
p += n;
if (c != NULL) {
if (!sk_SSL_CIPHER_push(sk, c)) {
-/* $OpenBSD: ssl_locl.h,v 1.63 2014/07/28 04:23:12 guenther Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.64 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
/*#define SSL_DEBUG */
/*#define RSA_DEBUG */
-#define ssl_put_cipher_by_char(ssl,ciph,ptr) \
- ((ssl)->method->put_cipher_by_char((ciph),(ptr)))
-#define ssl_get_cipher_by_char(ssl,ptr) \
- ((ssl)->method->get_cipher_by_char(ptr))
-
/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff
* It is a bit of a mess of functions, but hell, think of it as
* an opaque structure :-) */
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
int num, STACK_OF(SSL_CIPHER) **skp);
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
- unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *));
+ unsigned char *p);
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted,
const char *rule_str);
int ssl23_read(SSL *s, void *buf, int len);
int ssl23_peek(SSL *s, void *buf, int len);
int ssl23_write(SSL *s, const void *buf, int len);
-int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
long ssl23_default_timeout(void);
long tls1_default_timeout(void);
-/* $OpenBSD: ssl_sess.c,v 1.38 2014/07/13 16:03:10 beck Exp $ */
+/* $OpenBSD: ssl_sess.c,v 1.39 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
l2n(l, p);
if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR)
- ret->cipher = ssl_get_cipher_by_char(s, &(buf[2]));
+ ret->cipher = ssl3_get_cipher_by_char(&buf[2]);
else
- ret->cipher = ssl_get_cipher_by_char(s, &(buf[1]));
+ ret->cipher = ssl3_get_cipher_by_char(&buf[1]);
if (ret->cipher == NULL)
goto err;
-/* $OpenBSD: t1_clnt.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: t1_clnt.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: t1_meth.c,v 1.12 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: t1_meth.c,v 1.13 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: t1_srvr.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: t1_srvr.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: ssl.h,v 1.62 2014/07/12 19:45:53 jsing Exp $ */
+/* $OpenBSD: ssl.h,v 1.63 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int (*ssl_dispatch_alert)(SSL *s);
long (*ssl_ctrl)(SSL *s, int cmd, long larg, void *parg);
long (*ssl_ctx_ctrl)(SSL_CTX *ctx, int cmd, long larg, void *parg);
+ /* XXX - remove get_cipher_by_char and put_cipher_by_char. */
const SSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);
int (*put_cipher_by_char)(const SSL_CIPHER *cipher, unsigned char *ptr);
int (*ssl_pending)(const SSL *s);
-/* $OpenBSD: ssl_lib.c,v 1.78 2014/07/12 22:33:39 jsing Exp $ */
+/* $OpenBSD: ssl_lib.c,v 1.79 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
}
int
-ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p,
- int (*put_cb)(const SSL_CIPHER *, unsigned char *))
+ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk, unsigned char *p)
{
- int i, j = 0;
+ int i;
SSL_CIPHER *c;
unsigned char *q;
for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
c = sk_SSL_CIPHER_value(sk, i);
+
/* Skip TLS v1.2 only ciphersuites if lower than v1.2 */
if ((c->algorithm_ssl & SSL_TLSV1_2) &&
(TLS1_get_client_version(s) < TLS1_2_VERSION))
continue;
- j = put_cb ? put_cb(c, p) : ssl_put_cipher_by_char(s, c, p);
- p += j;
+ p += ssl3_put_cipher_by_char(c, p);
}
+
/*
* If p == q, no ciphers and caller indicates an error. Otherwise
* add SCSV if not renegotiating.
static SSL_CIPHER scsv = {
0, NULL, SSL3_CK_SCSV, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- j = put_cb ? put_cb(&scsv, p) :
- ssl_put_cipher_by_char(s, &scsv, p);
- p += j;
+ p += ssl3_put_cipher_by_char(&scsv, p);
}
return (p - q);
if (s->s3)
s->s3->send_connection_binding = 0;
- n = ssl_put_cipher_by_char(s, NULL, NULL);
+ n = ssl3_put_cipher_by_char(NULL, NULL);
if ((num % n) != 0) {
SSLerr(SSL_F_SSL_BYTES_TO_CIPHER_LIST,
SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST);
continue;
}
- c = ssl_get_cipher_by_char(s, p);
+ c = ssl3_get_cipher_by_char(p);
p += n;
if (c != NULL) {
if (!sk_SSL_CIPHER_push(sk, c)) {
-/* $OpenBSD: ssl_locl.h,v 1.63 2014/07/28 04:23:12 guenther Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.64 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
/*#define SSL_DEBUG */
/*#define RSA_DEBUG */
-#define ssl_put_cipher_by_char(ssl,ciph,ptr) \
- ((ssl)->method->put_cipher_by_char((ciph),(ptr)))
-#define ssl_get_cipher_by_char(ssl,ptr) \
- ((ssl)->method->get_cipher_by_char(ptr))
-
/* This is for the SSLv3/TLSv1.0 differences in crypto/hash stuff
* It is a bit of a mess of functions, but hell, think of it as
* an opaque structure :-) */
STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s, unsigned char *p,
int num, STACK_OF(SSL_CIPHER) **skp);
int ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *sk,
- unsigned char *p, int (*put_cb)(const SSL_CIPHER *, unsigned char *));
+ unsigned char *p);
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *meth,
STACK_OF(SSL_CIPHER) **pref, STACK_OF(SSL_CIPHER) **sorted,
const char *rule_str);
int ssl23_read(SSL *s, void *buf, int len);
int ssl23_peek(SSL *s, void *buf, int len);
int ssl23_write(SSL *s, const void *buf, int len);
-int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
long ssl23_default_timeout(void);
long tls1_default_timeout(void);
-/* $OpenBSD: ssl_sess.c,v 1.38 2014/07/13 16:03:10 beck Exp $ */
+/* $OpenBSD: ssl_sess.c,v 1.39 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
l2n(l, p);
if ((ret->ssl_version >> 8) >= SSL3_VERSION_MAJOR)
- ret->cipher = ssl_get_cipher_by_char(s, &(buf[2]));
+ ret->cipher = ssl3_get_cipher_by_char(&buf[2]);
else
- ret->cipher = ssl_get_cipher_by_char(s, &(buf[1]));
+ ret->cipher = ssl3_get_cipher_by_char(&buf[1]);
if (ret->cipher == NULL)
goto err;
-/* $OpenBSD: t1_clnt.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: t1_clnt.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: t1_meth.c,v 1.12 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: t1_meth.c,v 1.13 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
-/* $OpenBSD: t1_srvr.c,v 1.13 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: t1_srvr.c,v 1.14 2014/08/10 14:42:56 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,
.ssl_dispatch_alert = ssl3_dispatch_alert,
.ssl_ctrl = ssl3_ctrl,
.ssl_ctx_ctrl = ssl3_ctx_ctrl,
- .get_cipher_by_char = ssl3_get_cipher_by_char,
- .put_cipher_by_char = ssl3_put_cipher_by_char,
.ssl_pending = ssl3_pending,
.num_ciphers = ssl3_num_ciphers,
.get_cipher = ssl3_get_cipher,