implement functions about tls