anchor.diff:  %% Pre TLS-1.3, on the client side, the connection state variable `negotiated_version` will initially be
   %% the requested version. On the server side the same variable is initially undefined.
   %% When the client can support TLS-1.3 and one or more prior versions and we are waiting
  -%% for the server hello (with or without a RetryRequest, that is in state hello or in state wait_sh),
  -%% the "initial requested version" kept in the connection state variable `negotiated_version`
  +%% for the server hello the "initial requested version" kept in the connection state variable `negotiated_version`
   %% (before the versions is actually negotiated) will always be the value of TLS-1.2 (which is a legacy
   %% field in TLS-1.3 client hello). The versions are instead negotiated with an hello extension. When
   %% decoding the server_hello messages we want to go through TLS-1.3 decode functions to be able
   %% to handle TLS-1.3 extensions if TLS-1.3 will be the negotiated version.
  -effective_version({3,3} , #{versions := [{3,4} = Version |_]}, client, StateName) when StateName == hello;
  -                                                                                       StateName == wait_sh ->
  -    Version;
  +handle_unnegotiated_version({3,3} , #{versions := [{3,4} = Version |_]} = Options, Data, Buffer, client, hello) ->
  +    %% The effective version for decoding the server hello message should be the TLS-1.3. Possible coalesced TLS-1.2
  +    %% server handshake messages should be decoded with the negotiated version in later state.
  +    <<_:8, ?UINT24(Length), _/binary>> = Data,
  +    <<FirstPacket:(Length+4)/binary, Rest/binary>> = Data,
  +    {Packet, <<>>} = tls_handshake:get_tls_handshakes(Version, FirstPacket, Buffer, Options),
  +    {Packet, Rest};
  +%% TLS-1.3 RetryRequest
  +handle_unnegotiated_version({3,3} , #{versions := [{3,4} = Version |_]} = Options, Data, Buffer, client, wait_sh) ->
  +    tls_handshake:get_tls_handshakes(Version, Data, Buffer, Options);
   %% When the `negotiated_version` variable is not yet set use the highest supported version.
  -effective_version(undefined, #{versions := [Version|_]}, _, _) ->
  -    Version;
  +handle_unnegotiated_version(undefined, #{versions := [Version|_]} = Options, Data, Buff, _, _) ->
  +    tls_handshake:get_tls_handshakes(Version, Data, Buff, Options);
   %% In all other cases use the version saved in the connection state variable `negotiated_version`
  -effective_version(Version, _, _, _) ->
  -    Version.
  +handle_unnegotiated_version(Version, Options, Data, Buff, _, _) ->
  +    tls_handshake:get_tls_handshakes(Version, Data, Buff, Options).
   
   assert_buffer_sanity(<<?BYTE(_Type), ?UINT24(Length), Rest/binary>>, 
                        #{max_handshake_size := Max}) when
  
positive.code: %%====================================================================
  %% Internal functions 
  %%====================================================================	     
  tls_handshake_events(Packets) ->
      lists:map(fun(Packet) ->
  		      {next_event, internal, {handshake, Packet}}
  
negative.code:             next_event(StateName, Record, State)
      end;
  %%% TLS record protocol level handshake messages 
  handle_protocol_record(#ssl_tls{type = ?HANDSHAKE, fragment = Data}, StateName, #state{protocol_buffers = Buffers,
                                                                                         ssl_options = Options} = State0) ->
      try
          {Packets, Buffer} = get_tls_handshakes(Data, StateName, State0),
          State = State0#state{protocol_buffers =
                                   Buffers#protocol_buffers{tls_handshake_buffer = Buffer}},
  	case Packets of
              [] -> 
                  assert_buffer_sanity(Buffer, Options),
                  next_event(StateName, no_record, State);
              _ ->                
                  Events = tls_handshake_events(Packets),
  