Commit edfdf9c790 for strongswan.org

commit edfdf9c79040d7db1674dcba4f31c45867777aad
Author: Tobias Brunner <tobias@strongswan.org>
Date:   Mon Nov 30 10:27:34 2026 +0100

    proposal: Remove 3DES and SHA-1 from default proposals

    IKEv1 is already deprecated and disabled by default, which was the main
    reason these algorithms were still included, so no need to continue to
    announce them in the default proposal.

    Also remove the weaker and rarely used AES-based integrity algorithms and
    AEAD algorithms with short ICVs.

    Added some checks to make sure the resulting proposal is valid.

diff --git a/src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c b/src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c
index 2ab0af9fd8..67ffa163ec 100644
--- a/src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c
+++ b/src/frontends/android/app/src/main/jni/libandroidbridge/backend/android_service.c
@@ -875,13 +875,13 @@ static job_requeue_t initiate(private_android_service_t *this)
 								"aes256gcm16-aes128gcm16-chacha20poly1305-"
 								"curve25519-ecp384-ecp521-modp3072-modp4096-ecp256-modp8192"));
 		child_cfg->add_proposal(child_cfg, proposal_create_from_string(PROTO_ESP,
-								"aes256-aes192-aes128-sha384-sha256-sha512-sha1-"
+								"aes256-aes192-aes128-sha384-sha256-sha512-"
 								"curve25519-ecp384-ecp521-modp3072-modp4096-ecp256-modp2048-"
 								"modp8192"));
 		child_cfg->add_proposal(child_cfg, proposal_create_from_string(PROTO_ESP,
 								"aes256gcm16-aes128gcm16-chacha20poly1305"));
 		child_cfg->add_proposal(child_cfg, proposal_create_from_string(PROTO_ESP,
-								"aes256-aes192-aes128-sha384-sha256-sha512-sha1"));
+								"aes256-aes192-aes128-sha384-sha256-sha512"));
 	}
 	ts = traffic_selector_create_from_cidr("0.0.0.0/0", 0, 0, 65535);
 	child_cfg->add_traffic_selector(child_cfg, TRUE, ts);
diff --git a/src/libstrongswan/crypto/proposal/proposal.c b/src/libstrongswan/crypto/proposal/proposal.c
index 00b72d5a19..1d0c9faa30 100644
--- a/src/libstrongswan/crypto/proposal/proposal.c
+++ b/src/libstrongswan/crypto/proposal/proposal.c
@@ -1119,7 +1119,7 @@ static bool add_supported_ike(private_proposal_t *this, bool aead)

 	if (aead)
 	{
-		/* Round 1 adds algorithms with at least 128 bit security strength */
+		/* Add algorithms with at least 128 bit security strength */
 		enumerator = lib->crypto->create_aead_enumerator(lib->crypto);
 		while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
 		{
@@ -1142,29 +1142,6 @@ static bool add_supported_ike(private_proposal_t *this, bool aead)
 		}
 		enumerator->destroy(enumerator);

-		/* Round 2 adds algorithms with less than 128 bit security strength */
-		enumerator = lib->crypto->create_aead_enumerator(lib->crypto);
-		while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
-		{
-			switch (encryption)
-			{
-				case ENCR_AES_GCM_ICV12:
-				case ENCR_AES_GCM_ICV8:
-				case ENCR_AES_CCM_ICV12:
-				case ENCR_AES_CCM_ICV8:
-				case ENCR_CAMELLIA_CCM_ICV12:
-				case ENCR_CAMELLIA_CCM_ICV8:
-					/* we assume that we support all AES/Camellia sizes */
-					add_algorithm(this, ENCRYPTION_ALGORITHM, encryption, 128);
-					add_algorithm(this, ENCRYPTION_ALGORITHM, encryption, 192);
-					add_algorithm(this, ENCRYPTION_ALGORITHM, encryption, 256);
-					break;
-				default:
-					break;
-			}
-		}
-		enumerator->destroy(enumerator);
-
 		if (!array_count(this->transforms))
 		{
 			return FALSE;
@@ -1172,7 +1149,7 @@ static bool add_supported_ike(private_proposal_t *this, bool aead)
 	}
 	else
 	{
-		/* Round 1 adds algorithms with at least 128 bit security strength */
+		/* Add algorithms with at least 128 bit security strength */
 		enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
 		while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
 		{
@@ -1193,30 +1170,12 @@ static bool add_supported_ike(private_proposal_t *this, bool aead)
 		}
 		enumerator->destroy(enumerator);

-		/* Round 2 adds algorithms with less than 128 bit security strength */
-		enumerator = lib->crypto->create_crypter_enumerator(lib->crypto);
-		while (enumerator->enumerate(enumerator, &encryption, &plugin_name))
-		{
-			switch (encryption)
-			{
-				case ENCR_3DES:
-					add_algorithm(this, ENCRYPTION_ALGORITHM, encryption, 0);
-					break;
-				case ENCR_DES:
-					/* no, thanks */
-					break;
-				default:
-					break;
-			}
-		}
-		enumerator->destroy(enumerator);
-
 		if (!array_count(this->transforms))
 		{
 			return FALSE;
 		}

-		/* Round 1 adds algorithms with at least 128 bit security strength */
+		/* Add algorithms with at least 128 bit security strength */
 		enumerator = lib->crypto->create_signer_enumerator(lib->crypto);
 		while (enumerator->enumerate(enumerator, &integrity, &plugin_name))
 		{
@@ -1233,25 +1192,10 @@ static bool add_supported_ike(private_proposal_t *this, bool aead)
 		}
 		enumerator->destroy(enumerator);

-		/* Round 2 adds algorithms with less than 128 bit security strength */
-		enumerator = lib->crypto->create_signer_enumerator(lib->crypto);
-		while (enumerator->enumerate(enumerator, &integrity, &plugin_name))
+		if (!get_algorithm(this, INTEGRITY_ALGORITHM, NULL, NULL))
 		{
-			switch (integrity)
-			{
-				case AUTH_AES_XCBC_96:
-				case AUTH_AES_CMAC_96:
-				case AUTH_HMAC_SHA1_96:
-					add_algorithm(this, INTEGRITY_ALGORITHM, integrity, 0);
-					break;
-				case AUTH_HMAC_MD5_96:
-					/* no, thanks */
-					break;
-				default:
-					break;
-			}
+			return FALSE;
 		}
-		enumerator->destroy(enumerator);
 	}

 	/* Round 1 adds algorithms with at least 128 bit security strength */
@@ -1287,26 +1231,13 @@ static bool add_supported_ike(private_proposal_t *this, bool aead)
 	}
 	enumerator->destroy(enumerator);

-	/* Round 3 adds algorithms with less than 128 bit security strength */
-	enumerator = lib->crypto->create_prf_enumerator(lib->crypto);
-	while (enumerator->enumerate(enumerator, &prf, &plugin_name))
-	{
-		switch (prf)
-		{
-			case PRF_HMAC_SHA1:
-				add_algorithm(this, PSEUDO_RANDOM_FUNCTION, prf, 0);
-				break;
-			case PRF_HMAC_MD5:
-				/* no, thanks */
-				break;
-			default:
-				break;
-		}
-	}
-	enumerator->destroy(enumerator);
-
 	add_supported_ke_methods(this);

+	if (!get_algorithm(this, PSEUDO_RANDOM_FUNCTION, NULL, NULL) ||
+		!get_algorithm(this, KEY_EXCHANGE_METHOD, NULL, NULL))
+	{
+		return FALSE;
+	}
 	return TRUE;
 }

@@ -1333,8 +1264,6 @@ proposal_t *proposal_create_default(protocol_id_t protocol)
 			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA2_256_128,  0);
 			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA2_384_192,  0);
 			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA2_512_256,  0);
-			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA1_96,       0);
-			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_AES_XCBC_96,        0);
 			add_algorithm(this, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
 			/* add all supported KE methods, but make them optional */
 			add_supported_ke_methods(this);
@@ -1344,8 +1273,6 @@ proposal_t *proposal_create_default(protocol_id_t protocol)
 			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA2_256_128,  0);
 			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA2_384_192,  0);
 			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA2_512_256,  0);
-			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_HMAC_SHA1_96,       0);
-			add_algorithm(this, INTEGRITY_ALGORITHM,  AUTH_AES_XCBC_96,        0);
 			add_algorithm(this, EXTENDED_SEQUENCE_NUMBERS, NO_EXT_SEQ_NUMBERS, 0);
 			/* add all supported KE methods, but make them optional */
 			add_supported_ke_methods(this);
diff --git a/src/libstrongswan/crypto/proposal/proposal.h b/src/libstrongswan/crypto/proposal/proposal.h
index 098a704cb8..c2f9f17ce5 100644
--- a/src/libstrongswan/crypto/proposal/proposal.h
+++ b/src/libstrongswan/crypto/proposal/proposal.h
@@ -247,7 +247,7 @@ proposal_t *proposal_create_v1(protocol_id_t protocol, uint8_t number,
  * Create a default proposal.
  *
  * @param protocol			protocol, such as PROTO_ESP
- * @return					proposal_t object
+ * @return					proposal_t object, NULL if none supported
  */
 proposal_t *proposal_create_default(protocol_id_t protocol);