]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Reject invalid FFDHE and ECDHE key shares with SSL_AD_ILLEGAL_PARAMETER alert
authorcx <1249843194@qq.com>
Thu, 26 Sep 2024 03:27:14 +0000 (11:27 +0800)
committerTomas Mraz <tomas@openssl.org>
Thu, 2 Jan 2025 13:12:54 +0000 (14:12 +0100)
This changes the alert according to RFC 8446.

Fixes: #25402
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25547)

ssl/statem/statem_srvr.c

index c6abfd3319585e4024d7905d9a84e3c2836e1fde..3d1cb90018cb400a5220eca19acc0662db675df3 100644 (file)
@@ -3087,7 +3087,7 @@ static int tls_process_cke_dhe(SSL_CONNECTION *s, PACKET *pkt)
     }
 
     if (EVP_PKEY_set1_encoded_public_key(ckey, data, i) <= 0) {
-        SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
+        SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_R_BAD_KEY_SHARE);
         goto err;
     }
 
@@ -3141,7 +3141,7 @@ static int tls_process_cke_ecdhe(SSL_CONNECTION *s, PACKET *pkt)
         }
 
         if (EVP_PKEY_set1_encoded_public_key(ckey, data, i) <= 0) {
-            SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_EC_LIB);
+            SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_R_BAD_KEY_SHARE);
             goto err;
         }
     }