Commit 6d5c4125e1f for nodejs

commit 6d5c4125e1f15370ab5582f1e06fb28f09175d9c
Author: James M Snell <jasnell@gmail.com>
Date:   Fri Nov 27 22:21:09 2026 +0000

    crypto: accept DTLS 1.3 PSK in verifyPeerCertificate

    A DTLS 1.3 PSK handshake has no peer certificate and looks like a
    resumption, as with TLS 1.3, but only TLS1_3_VERSION was checked.

    Assisted-by: Claude Opus 5.5
    Signed-off-by: James M Snell <jasnell@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67837
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>

diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc
index 29391ba531d..24029055b70 100644
--- a/deps/ncrypto/ncrypto.cc
+++ b/deps/ncrypto/ncrypto.cc
@@ -5295,11 +5295,15 @@ std::optional<uint32_t> SSLPointer::verifyPeerCertificate() const {
   const SSL_CIPHER* curr_cipher = SSL_get_current_cipher(get());
   const SSL_SESSION* sess = SSL_get_session(get());
   // Allow no-cert for PSK authentication in TLS1.2 and lower.
-  // In TLS1.3 check that session was reused because TLS1.3 PSK
+  // In (D)TLS1.3 check that session was reused because (D)TLS1.3 PSK
   // looks like session resumption.
+  const int version = SSL_SESSION_get_protocol_version(sess);
+  bool is_13 = version == TLS1_3_VERSION;
+#ifdef DTLS1_3_VERSION
+  is_13 = is_13 || version == DTLS1_3_VERSION;
+#endif
   if (SSL_CIPHER_get_auth_nid(curr_cipher) == NID_auth_psk ||
-      (SSL_SESSION_get_protocol_version(sess) == TLS1_3_VERSION &&
-       SSL_session_reused(get()))) {
+      (is_13 && SSL_session_reused(get()))) {
     return X509_V_OK;
   }