Factories honor charon IKEv1/IKEv2 protocol support flags
authorMartin Willi <martin@revosec.ch>
Mon, 19 Dec 2011 12:32:41 +0000 (13:32 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:26 +0000 (17:31 +0100)
src/libcharon/sa/authenticator.c
src/libcharon/sa/keymat.c
src/libcharon/sa/task_manager.c

index d7a4b3e..ea1889a 100644 (file)
@@ -45,6 +45,8 @@ ENUM_NEXT(auth_method_names, AUTH_XAUTH_INIT_PSK, AUTH_HYBRID_RESP_RSA, AUTH_ECD
 );
 ENUM_END(auth_method_names, AUTH_HYBRID_RESP_RSA);
 
+#ifdef USE_IKEV2
+
 /**
  * Described in header.
  */
@@ -106,6 +108,10 @@ authenticator_t *authenticator_create_verifier(
        }
 }
 
+#endif /* USE_IKEV2 */
+
+#ifdef USE_IKEV1
+
 /**
  * Described in header.
  */
@@ -137,3 +143,5 @@ authenticator_t *authenticator_create_v1(ike_sa_t *ike_sa, bool initiator,
                        return NULL;
        }
 }
+
+#endif /* USE_IKEV1 */
index bcf131f..d04d966 100644 (file)
@@ -26,12 +26,19 @@ keymat_t *keymat_create(ike_version_t version, bool initiator)
        switch (version)
        {
                case IKEV1:
+#ifdef USE_IKEV1
                        return &keymat_v1_create(initiator)->keymat;
+#endif
+                       break;
                case IKEV2:
+#ifdef USE_IKEV2
                        return &keymat_v2_create(initiator)->keymat;
+#endif
+                       break;
                default:
-                       return NULL;
+                       break;
        }
+       return NULL;
 }
 
 /**
index 70f732f..c42008b 100644 (file)
@@ -26,11 +26,18 @@ task_manager_t *task_manager_create(ike_sa_t *ike_sa)
        switch (ike_sa->get_version(ike_sa))
        {
                case IKEV1:
+#ifdef USE_IKEV1
                        return &task_manager_v1_create(ike_sa)->task_manager;
+#endif
+                       break;
                case IKEV2:
+#ifdef USE_IKEV2
                        return &task_manager_v2_create(ike_sa)->task_manager;
+#endif
+                       break;
                default:
-                       return NULL;
+                       break;
        }
+       return NULL;
 }