{
OSSL_STATEM *st = &s->statem;
int (*confunc) (SSL *s, WPACKET *pkt) = NULL;
- int ret = 1, mt;
+ int mt;
switch (st->hand_state) {
default:
break;
#endif
case TLS_ST_CW_FINISHED:
+ confunc = tls_construct_finished;
mt = SSL3_MT_FINISHED;
break;
}
- if (!ssl_set_handshake_header(s, pkt, mt)) {
- SSLerr(SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE,
- ERR_R_INTERNAL_ERROR);
- return 0;
- }
-
- if (st->hand_state == TLS_ST_CW_FINISHED)
- ret = tls_construct_finished(s, pkt,
- s->method->
- ssl3_enc->client_finished_label,
- s->method->
- ssl3_enc->client_finished_label_len);
- else
- ret = confunc(s, pkt);
-
- if (!ret || !ssl_close_construct_packet(s, pkt, mt)) {
+ if (!ssl_set_handshake_header(s, pkt, mt)
+ || !confunc(s, pkt)
+ || !ssl_close_construct_packet(s, pkt, mt)) {
SSLerr(SSL_F_OSSL_STATEM_CLIENT_CONSTRUCT_MESSAGE,
ERR_R_INTERNAL_ERROR);
return 0;
return 1;
}
-int tls_construct_finished(SSL *s, WPACKET *pkt, const char *sender, int slen)
+int tls_construct_finished(SSL *s, WPACKET *pkt)
{
int i;
+ const char *sender;
+ int slen;
+
+ if (s->server) {
+ sender = s->method->ssl3_enc->server_finished_label;
+ slen = s->method->ssl3_enc->server_finished_label_len;
+ } else {
+ sender = s->method->ssl3_enc->client_finished_label;
+ slen = s->method->ssl3_enc->client_finished_label_len;
+ }
i = s->method->ssl3_enc->final_finish_mac(s,
sender, slen,
__owur int tls_construct_change_cipher_spec(SSL *s, WPACKET *pkt);
__owur int dtls_construct_change_cipher_spec(SSL *s, WPACKET *pkt);
-__owur int tls_construct_finished(SSL *s, WPACKET *pkt, const char *sender,
- int slen);
+__owur int tls_construct_finished(SSL *s, WPACKET *pkt);
__owur WORK_STATE tls_finish_handshake(SSL *s, WORK_STATE wst);
__owur WORK_STATE dtls_wait_for_dry(SSL *s);
{
OSSL_STATEM *st = &s->statem;
int (*confunc) (SSL *s, WPACKET *pkt) = NULL;
- int ret = 1, mt;
+ int mt;
switch (st->hand_state) {
default:
break;
case TLS_ST_SW_FINISHED:
+ confunc = tls_construct_finished;
mt = SSL3_MT_FINISHED;
break;
}
- if (!ssl_set_handshake_header(s, pkt, mt)) {
- SSLerr(SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE,
- ERR_R_INTERNAL_ERROR);
- return 0;
- }
-
- if (st->hand_state == TLS_ST_SW_FINISHED)
- ret = tls_construct_finished(s, pkt,
- s->method->
- ssl3_enc->server_finished_label,
- s->method->
- ssl3_enc->server_finished_label_len);
- else if (confunc != NULL)
- ret = confunc(s, pkt);
-
- if (!ret || !ssl_close_construct_packet(s, pkt, mt)) {
+ if (!ssl_set_handshake_header(s, pkt, mt)
+ || (confunc != NULL && !confunc(s, pkt))
+ || !ssl_close_construct_packet(s, pkt, mt)) {
SSLerr(SSL_F_OSSL_STATEM_SERVER_CONSTRUCT_MESSAGE,
ERR_R_INTERNAL_ERROR);
return 0;