quic_tls_negotiation (quic v1.10.0)

View Source

Summary

Functions

Convert an internal cipher atom to its TLS cipher suite code.

Convert a TLS cipher suite code to its internal atom.

Extract the client's key_share public key for a given group atom.

Named-group wire code to atom. An unknown code stays an integer.

Server: pick the first server protocol the client also offered.

Server: select a cipher suite from the client's list.

Decide the key-exchange group for a ClientHello (RFC 8446 §4.1.4).

Functions

cipher_atom_to_code(_)

-spec cipher_atom_to_code(atom()) -> integer().

Convert an internal cipher atom to its TLS cipher suite code.

Used when building ServerHello to send the correct suite to the client.

cipher_code_to_atom(_)

-spec cipher_code_to_atom(integer()) -> atom().

Convert a TLS cipher suite code to its internal atom.

extract_group_key(Group, Rest)

-spec extract_group_key(atom(), [{integer(), binary()}] | undefined) -> binary() | undefined.

Extract the client's key_share public key for a given group atom.

group_atom(Other)

-spec group_atom(integer()) -> atom() | integer().

Named-group wire code to atom. An unknown code stays an integer.

negotiate_alpn(ClientALPN, ServerALPN)

-spec negotiate_alpn([binary()], [binary()]) -> binary() | undefined.

Server: pick the first server protocol the client also offered.

select_cipher(ClientCipherSuites, ServerPreference)

-spec select_cipher([integer()], [atom()]) -> atom().

Server: select a cipher suite from the client's list.

ClientCipherSuites is a list of TLS cipher suite codes (integers), converted to atoms for internal use. The server's own order decides, so a deployment that must not negotiate a particular suite can say so; without this the preference was fixed in code and a ciphers option had nowhere to take effect.

select_key_share_group(ServerGroups, KeyShareEntries, SupportedGroups)

-spec select_key_share_group([atom()], [{integer(), binary()}] | undefined, [atom()]) ->
                                {direct, atom()} | {hrr, atom()} | none.

Decide the key-exchange group for a ClientHello (RFC 8446 §4.1.4).

Returns {direct, Group} when the client already sent a usable key_share, {hrr, Group} when a HelloRetryRequest is needed, or none when there is no group both sides support.