Add and use function tls1_in_list to avoid code duplication.