This functionality fits better with src/tls (i.e., internal TLS implementation), so move it there to make crypto_internal.c more of a wrapper like other crypto_*.c files.