payload: Use common prefixes for all payload type identifiers
[strongswan.git] / src / libcharon / sa / authenticator.c
index d7a4b3e..8571274 100644 (file)
@@ -31,11 +31,12 @@ ENUM_BEGIN(auth_method_names, AUTH_RSA, AUTH_DSS,
        "RSA signature",
        "pre-shared key",
        "DSS signature");
-ENUM_NEXT(auth_method_names, AUTH_ECDSA_256, AUTH_ECDSA_521, AUTH_DSS,
+ENUM_NEXT(auth_method_names, AUTH_ECDSA_256, AUTH_GSPM, AUTH_DSS,
        "ECDSA-256 signature",
        "ECDSA-384 signature",
-       "ECDSA-521 signature");
-ENUM_NEXT(auth_method_names, AUTH_XAUTH_INIT_PSK, AUTH_HYBRID_RESP_RSA, AUTH_ECDSA_521,
+       "ECDSA-521 signature",
+       "secure password method");
+ENUM_NEXT(auth_method_names, AUTH_XAUTH_INIT_PSK, AUTH_HYBRID_RESP_RSA, AUTH_GSPM,
        "XAuthInitPSK",
        "XAuthRespPSK",
        "XAuthInitRSA",
@@ -45,6 +46,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.
  */
@@ -83,7 +86,7 @@ authenticator_t *authenticator_create_verifier(
 {
        auth_payload_t *auth_payload;
 
-       auth_payload = (auth_payload_t*)message->get_payload(message, AUTHENTICATION);
+       auth_payload = (auth_payload_t*)message->get_payload(message, PLV2_AUTH);
        if (auth_payload == NULL)
        {
                return (authenticator_t*)eap_authenticator_create_verifier(ike_sa,
@@ -106,6 +109,10 @@ authenticator_t *authenticator_create_verifier(
        }
 }
 
+#endif /* USE_IKEV2 */
+
+#ifdef USE_IKEV1
+
 /**
  * Described in header.
  */
@@ -121,13 +128,19 @@ authenticator_t *authenticator_create_v1(ike_sa_t *ike_sa, bool initiator,
                case AUTH_XAUTH_RESP_PSK:
                        return (authenticator_t*)psk_v1_authenticator_create(ike_sa,
                                                                                initiator, dh, dh_value, sa_payload,
-                                                                               id_payload);
+                                                                               id_payload, FALSE);
                case AUTH_RSA:
                case AUTH_XAUTH_INIT_RSA:
                case AUTH_XAUTH_RESP_RSA:
                        return (authenticator_t*)pubkey_v1_authenticator_create(ike_sa,
                                                                                initiator, dh, dh_value, sa_payload,
-                                                                               id_payload);
+                                                                               id_payload, KEY_RSA);
+               case AUTH_ECDSA_256:
+               case AUTH_ECDSA_384:
+               case AUTH_ECDSA_521:
+                       return (authenticator_t*)pubkey_v1_authenticator_create(ike_sa,
+                                                                               initiator, dh, dh_value, sa_payload,
+                                                                               id_payload, KEY_ECDSA);
                case AUTH_HYBRID_INIT_RSA:
                case AUTH_HYBRID_RESP_RSA:
                        return (authenticator_t*)hybrid_authenticator_create(ike_sa,
@@ -137,3 +150,5 @@ authenticator_t *authenticator_create_v1(ike_sa_t *ike_sa, bool initiator,
                        return NULL;
        }
 }
+
+#endif /* USE_IKEV1 */