Skip to content

Commit 98037b8

Browse files
committed
ssl: Improve error handling of client certificate messages
Make sure to check pre-condition as well as post-condition for client certificate messages.
1 parent ce72bbc commit 98037b8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/ssl/src/tls_dtls_connection.erl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ certify(internal, #certificate{asn1_certificates = []},
321321
certify(internal, #certificate{asn1_certificates = []},
322322
#state{static_env = #static_env{role = server,
323323
protocol_cb = Connection},
324+
client_certificate_status = requested,
324325
ssl_options = #{verify := verify_peer,
325326
fail_if_no_peer_cert := false}} =
326327
State0) ->
@@ -330,9 +331,10 @@ certify(internal, #certificate{},
330331
ssl_options = #{verify := verify_none}}) ->
331332
throw(?ALERT_REC(?FATAL,?UNEXPECTED_MESSAGE, unrequested_certificate));
332333
certify(internal, #certificate{},
333-
#state{static_env = #static_env{protocol_cb = Connection},
334-
handshake_env = #handshake_env{
335-
ocsp_stapling_state = #{ocsp_expect := staple}}} = State) ->
334+
#state{client_certificate_status = requested,
335+
static_env = #static_env{protocol_cb = Connection},
336+
handshake_env =
337+
#handshake_env{ocsp_stapling_state = #{ocsp_expect := staple}}} = State) ->
336338
Connection:next_event(wait_ocsp_stapling, no_record, State, [{postpone, true}]);
337339
certify(internal, #certificate{asn1_certificates = [Peer|_]} = Cert,
338340
#state{static_env = #static_env{

0 commit comments

Comments
 (0)