Extract TLS to library.