]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
proposal: Strip redundant integrity algos for ESP proposals only
authorMartin Willi <martin@revosec.ch>
Thu, 20 Jun 2013 14:10:55 +0000 (16:10 +0200)
committerMartin Willi <martin@revosec.ch>
Fri, 11 Oct 2013 08:15:21 +0000 (10:15 +0200)
src/libcharon/config/proposal.c

index 0b702e0141f09754d86c29f2567d44d5804c6210..0acc425d6e76feabf01631f423dcaf4b51f58caa 100644 (file)
@@ -429,30 +429,33 @@ static void check_proposal(private_proposal_t *this)
                e->destroy(e);
        }
 
-       e = create_enumerator(this, ENCRYPTION_ALGORITHM);
-       while (e->enumerate(e, &alg, &ks))
+       if (this->protocol == PROTO_ESP)
        {
-               if (!encryption_algorithm_is_aead(alg))
+               e = create_enumerator(this, ENCRYPTION_ALGORITHM);
+               while (e->enumerate(e, &alg, &ks))
                {
-                       all_aead = FALSE;
-                       break;
+                       if (!encryption_algorithm_is_aead(alg))
+                       {
+                               all_aead = FALSE;
+                               break;
+                       }
                }
-       }
-       e->destroy(e);
+               e->destroy(e);
 
-       if (all_aead)
-       {
-               /* if all encryption algorithms in the proposal are AEADs,
-                * we MUST NOT propose any integrity algorithms */
-               e = array_create_enumerator(this->transforms);
-               while (e->enumerate(e, &entry))
+               if (all_aead)
                {
-                       if (entry->type == INTEGRITY_ALGORITHM)
+                       /* if all encryption algorithms in the proposal are AEADs,
+                        * we MUST NOT propose any integrity algorithms */
+                       e = array_create_enumerator(this->transforms);
+                       while (e->enumerate(e, &entry))
                        {
-                               array_remove_at(this->transforms, e);
+                               if (entry->type == INTEGRITY_ALGORITHM)
+                               {
+                                       array_remove_at(this->transforms, e);
+                               }
                        }
+                       e->destroy(e);
                }
-               e->destroy(e);
        }
 
        if (this->protocol == PROTO_AH || this->protocol == PROTO_ESP)