transform: Move internal identifiers out of private range
authorTobias Brunner <tobias@strongswan.org>
Fri, 23 Feb 2018 07:12:48 +0000 (08:12 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 5 Mar 2018 11:05:36 +0000 (12:05 +0100)
Avoid any conflicts if implementations use transform types in the
private range.
Also removed the unused UNKNOWN_TRANSFORM_TYPE identifier.

src/libstrongswan/crypto/transform.c
src/libstrongswan/crypto/transform.h

index 808cb99..2875fbb 100644 (file)
 #include <crypto/hashers/hasher.h>
 #include <crypto/rngs/rng.h>
 
-ENUM_BEGIN(transform_type_names, UNDEFINED_TRANSFORM_TYPE, EXTENDED_OUTPUT_FUNCTION,
-       "UNDEFINED_TRANSFORM_TYPE",
-       "HASH_ALGORITHM",
-       "RANDOM_NUMBER_GENERATOR",
-       "AEAD_ALGORITHM",
-       "COMPRESSION_ALGORITHM",
-       "EXTENDED OUTPUT FUNCTION");
-ENUM_NEXT(transform_type_names, ENCRYPTION_ALGORITHM, EXTENDED_SEQUENCE_NUMBERS,
-                                                               EXTENDED_OUTPUT_FUNCTION,
+ENUM_BEGIN(transform_type_names, ENCRYPTION_ALGORITHM, EXTENDED_SEQUENCE_NUMBERS,
        "ENCRYPTION_ALGORITHM",
        "PSEUDO_RANDOM_FUNCTION",
        "INTEGRITY_ALGORITHM",
        "DIFFIE_HELLMAN_GROUP",
        "EXTENDED_SEQUENCE_NUMBERS");
-ENUM_END(transform_type_names, EXTENDED_SEQUENCE_NUMBERS);
+ENUM_NEXT(transform_type_names, HASH_ALGORITHM, EXTENDED_OUTPUT_FUNCTION,
+                 EXTENDED_SEQUENCE_NUMBERS,
+       "HASH_ALGORITHM",
+       "RANDOM_NUMBER_GENERATOR",
+       "AEAD_ALGORITHM",
+       "COMPRESSION_ALGORITHM",
+       "EXTENDED OUTPUT FUNCTION");
+ENUM_END(transform_type_names, EXTENDED_OUTPUT_FUNCTION);
 
 
 ENUM(extended_sequence_numbers_names, NO_EXT_SEQ_NUMBERS, EXT_SEQ_NUMBERS,
@@ -64,7 +63,6 @@ enum_name_t* transform_get_enum_names(transform_type_t type)
                        return extended_sequence_numbers_names;
                case EXTENDED_OUTPUT_FUNCTION:
                        return ext_out_function_names;
-               case UNDEFINED_TRANSFORM_TYPE:
                case COMPRESSION_ALGORITHM:
                        break;
        }
index e043e60..9181655 100644 (file)
@@ -29,17 +29,16 @@ typedef enum transform_type_t transform_type_t;
  * Type of a transform, as in IKEv2 RFC 3.3.2.
  */
 enum transform_type_t {
-       UNDEFINED_TRANSFORM_TYPE = 241,
-       HASH_ALGORITHM = 242,
-       RANDOM_NUMBER_GENERATOR = 243,
-       AEAD_ALGORITHM = 244,
-       COMPRESSION_ALGORITHM = 245,
-       EXTENDED_OUTPUT_FUNCTION = 246,
        ENCRYPTION_ALGORITHM = 1,
        PSEUDO_RANDOM_FUNCTION = 2,
        INTEGRITY_ALGORITHM = 3,
        DIFFIE_HELLMAN_GROUP = 4,
-       EXTENDED_SEQUENCE_NUMBERS = 5
+       EXTENDED_SEQUENCE_NUMBERS = 5,
+       HASH_ALGORITHM = 256,
+       RANDOM_NUMBER_GENERATOR = 257,
+       AEAD_ALGORITHM = 258,
+       COMPRESSION_ALGORITHM = 259,
+       EXTENDED_OUTPUT_FUNCTION = 260,
 };
 
 /**