tls-server: TLS 1.3 support for TLS server implementation

Add basic support to establish a TLS 1.3 connection with a client capable
of the same protocol version.
This commit is contained in:
Pascal Knecht
2021-02-12 14:35:23 +01:00
committed by Tobias Brunner
parent 328d7af6d2
commit 7fbe2e27ec
3 changed files with 624 additions and 195 deletions
+22
View File
@@ -1487,6 +1487,16 @@ static signature_params_t *params_for_scheme(tls_signature_scheme_t sig)
for (i = 0; i < countof(schemes); i++)
{
/* strongSwan supports only RSA_PSS_RSAE schemes for signing but can
* verify public keys in rsaEncryption as well as rsassaPss encoding.
* Current implementation does not distinguish between signing and
* verifying. */
if (sig == TLS_SIG_RSA_PSS_PSS_SHA256 ||
sig == TLS_SIG_RSA_PSS_PSS_SHA384 ||
sig == TLS_SIG_RSA_PSS_PSS_SHA512)
{
continue;
}
if (schemes[i].sig == sig)
{
return &schemes[i].params;
@@ -1677,6 +1687,18 @@ METHOD(tls_crypto_t, sign, bool,
chunk_t sig;
bool done = FALSE;
if (this->tls->get_version_max(this->tls) >= TLS_1_3)
{
chunk_t transcript_hash;
if (!hash_data(this, data, &transcript_hash))
{
DBG1(DBG_TLS, "unable to create transcript hash");
return FALSE;
}
data = chunk_cata("cm", tls13_sig_data_server, transcript_hash);
}
if (!hashsig.len)
{ /* fallback if none given */
hashsig = hashsig_def;