According to specification, to create data that will be signed with server private key for CertificateVerify message, we need to concatenate 64 space characters, the string "TLS 1.3, server CertificateVerify", null and the hash of all handshake messages to this point. During the handshake process, we choosing the cipher suite and signature scheme...
So, if the cipher suite is, for example, TLS_AES_256_GCM_SHA384 and the signature scheme is rsa_pss_rsae_sha256 (different hash algorithms), hash of which algorithm should be used as handshake hash in data to sign, SHA-384 or SHA-256?
rsa_pss_rsae_sha256
(and alsorsa_pss_pss_sha256
with different OID in the cert) uses sha256 both for MGF1 and to hash the data (which in 1.3 includes the handshake transcript); see rfc8446 4.2.3. In 1.2 the hash in the ciphersuite is used in PRF which is used for key derivation and Finished, and HMAC if applicable, but not signature. In 1.3 it is used in HKDF which replaces PRF and is again used for key derivation and Finished and never HMAC, but not signature. – dave_thompson_085 Mar 08 '21 at 01:28