-/* $OpenBSD: d1_srvr.c,v 1.92 2018/04/07 17:02:34 jsing Exp $ */
+/* $OpenBSD: d1_srvr.c,v 1.93 2018/08/24 17:30:32 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
return 0;
}
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &verify,
+ if (!ssl3_handshake_msg_start(s, &cbb, &verify,
DTLS1_MT_HELLO_VERIFY_REQUEST))
goto err;
if (!CBB_add_u16(&verify, s->version))
goto err;
if (!CBB_add_bytes(&cookie, D1I(s)->cookie, D1I(s)->cookie_len))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B;
-/* $OpenBSD: s3_lib.c,v 1.167 2018/06/02 16:29:01 jsing Exp $ */
+/* $OpenBSD: s3_lib.c,v 1.168 2018/08/24 17:30:32 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
SSL3_HM_HEADER_LENGTH);
}
-unsigned char *
-ssl3_handshake_msg_start(SSL *s, uint8_t msg_type)
-{
- unsigned char *d, *p;
-
- d = p = (unsigned char *)s->internal->init_buf->data;
-
- /* Handshake message type and length. */
- *(p++) = msg_type;
- l2n3(0, p);
-
- return (d + ssl3_handshake_msg_hdr_len(s));
-}
-
-void
-ssl3_handshake_msg_finish(SSL *s, unsigned int len)
-{
- unsigned char *p;
- uint8_t msg_type;
-
- p = (unsigned char *)s->internal->init_buf->data;
-
- /* Handshake message length. */
- msg_type = *(p++);
- l2n3(len, p);
-
- s->internal->init_num = ssl3_handshake_msg_hdr_len(s) + (int)len;
- s->internal->init_off = 0;
-
- if (SSL_IS_DTLS(s)) {
- dtls1_set_message_header(s, msg_type, len, 0, len);
- dtls1_buffer_message(s, 0);
- }
-}
-
int
-ssl3_handshake_msg_start_cbb(SSL *s, CBB *handshake, CBB *body,
- uint8_t msg_type)
+ssl3_handshake_msg_start(SSL *s, CBB *handshake, CBB *body, uint8_t msg_type)
{
int ret = 0;
}
int
-ssl3_handshake_msg_finish_cbb(SSL *s, CBB *handshake)
+ssl3_handshake_msg_finish(SSL *s, CBB *handshake)
{
unsigned char *data = NULL;
size_t outlen;
-/* $OpenBSD: ssl_both.c,v 1.11 2017/10/08 16:24:02 jsing Exp $ */
+/* $OpenBSD: ssl_both.c,v 1.12 2018/08/24 17:30:32 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
S3I(s)->previous_server_finished_len = md_len;
}
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &finished,
+ if (!ssl3_handshake_msg_start(s, &cbb, &finished,
SSL3_MT_FINISHED))
goto err;
if (!CBB_add_bytes(&finished, S3I(s)->tmp.finish_md, md_len))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = b;
-/* $OpenBSD: ssl_clnt.c,v 1.32 2018/08/19 15:38:03 jsing Exp $ */
+/* $OpenBSD: ssl_clnt.c,v 1.33 2018/08/24 17:30:32 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (!SSL_IS_DTLS(s) || D1I(s)->send_cookie == 0)
arc4random_buf(s->s3->client_random, SSL3_RANDOM_SIZE);
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &client_hello,
+ if (!ssl3_handshake_msg_start(s, &cbb, &client_hello,
SSL3_MT_CLIENT_HELLO))
goto err;
goto err;
}
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_CW_CLNT_HELLO_B;
goto err;
}
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &kex,
+ if (!ssl3_handshake_msg_start(s, &cbb, &kex,
SSL3_MT_CLIENT_KEY_EXCHANGE))
goto err;
goto err;
}
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_CW_KEY_EXCH_B;
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_CW_CERT_VRFY_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &cert_verify,
+ if (!ssl3_handshake_msg_start(s, &cbb, &cert_verify,
SSL3_MT_CERTIFICATE_VERIFY))
goto err;
if (!CBB_add_bytes(&cbb_signature, signature, signature_len))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_CW_CERT_VRFY_B;
}
if (S3I(s)->hs.state == SSL3_ST_CW_CERT_C) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &client_cert,
+ if (!ssl3_handshake_msg_start(s, &cbb, &client_cert,
SSL3_MT_CERTIFICATE))
goto err;
if (!ssl3_output_cert_chain(s, &client_cert,
(S3I(s)->tmp.cert_req == 2) ? NULL : s->cert->key->x509))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_CW_CERT_D;
-/* $OpenBSD: ssl_locl.h,v 1.207 2018/08/19 15:38:03 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.208 2018/08/24 17:30:32 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int ssl3_pending(const SSL *s);
int ssl3_handshake_msg_hdr_len(SSL *s);
-unsigned char *ssl3_handshake_msg_start(SSL *s, uint8_t htype);
-void ssl3_handshake_msg_finish(SSL *s, unsigned int len);
-int ssl3_handshake_msg_start_cbb(SSL *s, CBB *handshake, CBB *body,
+int ssl3_handshake_msg_start(SSL *s, CBB *handshake, CBB *body,
uint8_t msg_type);
-int ssl3_handshake_msg_finish_cbb(SSL *s, CBB *handshake);
+int ssl3_handshake_msg_finish(SSL *s, CBB *handshake);
int ssl3_handshake_write(SSL *s);
int ssl3_record_write(SSL *s, int type);
-/* $OpenBSD: ssl_srvr.c,v 1.42 2018/08/22 17:46:29 jsing Exp $ */
+/* $OpenBSD: ssl_srvr.c,v 1.43 2018/08/24 17:30:32 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_SW_HELLO_REQ_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &hello,
+ if (!ssl3_handshake_msg_start(s, &cbb, &hello,
SSL3_MT_HELLO_REQUEST))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_HELLO_REQ_B;
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_SW_SRVR_HELLO_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &server_hello,
+ if (!ssl3_handshake_msg_start(s, &cbb, &server_hello,
SSL3_MT_SERVER_HELLO))
goto err;
goto err;
}
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
}
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_SW_SRVR_DONE_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &done,
+ if (!ssl3_handshake_msg_start(s, &cbb, &done,
SSL3_MT_SERVER_DONE))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_SRVR_DONE_B;
if (S3I(s)->hs.state == SSL3_ST_SW_KEY_EXCH_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &server_kex,
+ if (!ssl3_handshake_msg_start(s, &cbb, &server_kex,
SSL3_MT_SERVER_KEY_EXCHANGE))
goto err;
goto err;
}
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_KEY_EXCH_B;
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_SW_CERT_REQ_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &cert_request,
+ if (!ssl3_handshake_msg_start(s, &cbb, &cert_request,
SSL3_MT_CERTIFICATE_REQUEST))
goto err;
goto err;
}
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_CERT_REQ_B;
return (0);
}
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &server_cert,
+ if (!ssl3_handshake_msg_start(s, &cbb, &server_cert,
SSL3_MT_CERTIFICATE))
goto err;
if (!ssl3_output_cert_chain(s, &server_cert, x))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_CERT_B;
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_SW_SESSION_TICKET_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &session_ticket,
+ if (!ssl3_handshake_msg_start(s, &cbb, &session_ticket,
SSL3_MT_NEWSESSION_TICKET))
goto err;
if (!HMAC_Final(&hctx, hmac, &hlen))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_SESSION_TICKET_B;
memset(&cbb, 0, sizeof(cbb));
if (S3I(s)->hs.state == SSL3_ST_SW_CERT_STATUS_A) {
- if (!ssl3_handshake_msg_start_cbb(s, &cbb, &certstatus,
+ if (!ssl3_handshake_msg_start(s, &cbb, &certstatus,
SSL3_MT_CERTIFICATE_STATUS))
goto err;
if (!CBB_add_u8(&certstatus, s->tlsext_status_type))
if (!CBB_add_bytes(&ocspresp, s->internal->tlsext_ocsp_resp,
s->internal->tlsext_ocsp_resplen))
goto err;
- if (!ssl3_handshake_msg_finish_cbb(s, &cbb))
+ if (!ssl3_handshake_msg_finish(s, &cbb))
goto err;
S3I(s)->hs.state = SSL3_ST_SW_CERT_STATUS_B;